Apple Newton Utilities Podręcznik Użytkownika Strona 119

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 942
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 118
CHAPTER 3
Views
Using Views 3-35
If at some point after the child views have been created you want to modify the
contents of the
stepChildren array and build new child views from it, you can
use the
RedoChildren view method. First, make any changes you desire to the
stepChildren array, then send your view the RedoChildren message. All of
the view’s current children will be closed and removed. A new set of child views
will then be recreated from the
stepChildren array.
Also, note that reordering the
stepChildren array and then calling
RedoChildren or MoveBehind is the way to reorder the child views of a
view dynamically.
For details on an easy way to create a template dynamically, see “Creating
Templates” (page 3-36).
Using the AddStepView Function 3
If you need to create a template and add a view yourself at run time, use the
function
AddStepView. This function takes two parameters: the parent view to
which you want to add a view, and the template for the view you want to create.
The function returns a reference to the view it creates. Be sure to save this return
value so you can access the view later.
The
AddStepView function also adds the template to the parent’s
stepChildren array. This means that the stepChildren array needs to be
modiable, or
AddStepView will fail. See the code in the previous section for an
example of how to ensure that the
stepChildren array is modiable.
The
AddStepView function doesn’t force a redraw when the view is created, so
you must take one of the following actions yourself:
Send the new view a Dirty message.
Send the new view’s parent view a Dirty message. This is useful if you’re
using
AddStepView to create several views and you want to show them all at
the same time.
If you created the view template with the vVisible bit cleared, the new view
will remain hidden and you must send it the
Show message to make it visible.
This technique is useful if you want the view to appear with an animation effect
(specied in the
viewEffect slot in the template).
Do not use the
AddStepView function in a ViewSetupFormScript method or
a
ViewSetupChildrenScript method—it won’t work because that’s too early
in the view creation process of the parent for child views to be created. If you are
tempted to do this, you should instead use the second method of dynamic view
creation, in which you add your template to the
stepChildren array and let the
view system create the view for you.
Przeglądanie stron 118
1 2 ... 114 115 116 117 118 119 120 121 122 123 124 ... 941 942

Komentarze do niniejszej Instrukcji

Brak uwag