background image
C H A P T E R 3
Views
Using Views
3-43
To determine if a given view is highlighted, check the
vSelected
bit in the
viewFlags
.
vSelected
should not be set by your application, but you can test it
to see if a view is currently selected (that is, highlighted.) If
BAND(viewflags,vSelected) <> 0
is non-
nil
, the view is selected.
Creating View Dependencies
3
You can make one view dependent upon another by using the global function
TieViews
. The dependent view is notified whenever the view it is dependent
on changes.
This dependency relationship is set up outside the normal inheritance hierarchy.
That is, the views don't have to be related to each other in any particular way in the
hierarchy. The views must be able to access each other, and so need references to
each other. Declaring them to a common parent view is one way to accomplish this.
View Synchronization
3
View synchronization refers to the process of synchronizing the graphic representa-
tion of the view with its internal data description. You need to do this when you
add, delete, or modify the children of a view, in order to update the screen.
Typically you would add or remove elements from the
stepChildren
array of a
parent view, and then call one of the view synchronization functions to cause the
child views to be redrawn, created, or closed, as appropriate. Remember that if you
need to modify the
stepChildren
array of a view, the array must be copied into
RAM; you can't modify the array in the view template, since that is usually stored
in ROM or in a package. To ensure that the
stepChildren
array is in RAM, use
this code:
if not HasSlot(self, 'stepChildren) then
self.stepChildren := Clone(self.stepChildren);
To redraw all the child views of a view, you can send two different messages to a
view:
RedoChildren
or
SyncChildren
. These work similarly, except that
RedoChildren
closes and reopens all child views, while
SyncChildren
only
closes obsolete child views and opens new child views.
Laying Out Multiple Child Views
3
Two different methods are provided to help lay out a view that is a table or consists
of some other group of child views.
To lay out a view containing a table in which each cell is a child view, send the
view the message
LayoutTable
.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна