background image
C H A P T E R 3
Views
Using Views
3-33
Displaying, Hiding, and Redrawing Views
3
To display a view (and its visible child views), send it one of the following
view messages:
Open
--to open the view
Toggle
--to open or close the view
Show
--to show the view if it had previously been opened, then hidden
To hide a view (and its child views), send it one of the following view messages:
Close
--to hide and possibly delete it from memory
Toggle
--to close or open the view
Hide
--to hide it temporarily
You can cause a view (and its child views) to be redrawn by using one of the
following view messages or global functions:
Dirty
--flags the view as "dirty" so it is redrawn during the next system
idle loop
RefreshViews
--redraws all dirty views immediately
SetValue
--sets the value of a slot and possibly dirties the view
SyncView
--redraws the view if its bounds have changed
Dynamically Adding Views
3
Creating a view dynamically (that is, at run time) is a complex issue that has
multiple solutions. Depending on what you really need to do, you can use one of
the following solutions:
Don't create the view dynamically because it's easier to accomplish what you
want by creating an invisible view and opening it later.
Create the view by adding a new template to its parent view's
stepChildren
array in the
ViewSetupChildrenScript
method.
Create the template and the view at run time by using the
AddStepView
function.
Create the template and the view at run time by using the
BuildContext
function.
If you want a pop-up list view, called a picker, use the
PopupMenu
function to
create and manage the view.
These techniques are discussed in the following sections. The first four techniques
are listed in order from easiest to most complex (and error prone). You should use
the easiest solution that accomplishes what you want. The last technique, for
creating a picker view, should be used if you want that kind of view.
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна