background image
C H A P T E R 3
Views
About Views
3-13
viewSetupFormScript: func()
begin
local b := GetAppParams();
self.viewbounds := RelBounds(
b.appAreaLeft,
b.appAreaTop,
min(200, b.appAreaWidth), // 200 pixels wide max
min(300, b.appAreaHeight)); // 300 pixels high max
end
Don't blindly size your application to the full extents of the screen. This might look
odd if your application runs on a system with a much larger screen.
Do include a border around your application base view. That way, if the application
runs on a screen that is larger than the size of your application, the user will be able
to clearly see its boundaries.
The important point is to correctly size the application base view. Child views are
positioned relative to the application base view. If you have a dynamically sizing
application base view, make sure that the child views also are sized dynamically, so
that they are laid out correctly no matter how the dimensions of the base view
change. You can ensure correct layout by using parent-relative and sibling-relative
view alignment, as explained in the next section, "View Alignment."
One additional consideration you should note is that on a larger screen, it may be
possible for the user to move applications around. You should not rely on the
top-left coordinate of your application base view being fixed. To prevent this from
happening check your application's current location when you work with global
coordinates. To do this, send the
GlobalBox
message to your application base view.
View Alignment
3
The
viewJustify
slot is used to set the view alignment and is closely linked in
its usage and effects with the
viewBounds
slot.
The
viewJustify
slot specifies how text and graphics are aligned within the
view and how the bounds of the view are aligned relative to its parent or sibling
views. (Sibling views are child views that have a common parent view.)
In the
viewJustify
slot, you can specify one or more alignment attributes,
which are represented by constants defined as bit flags. You can specify one
alignment attribute from each of the following groups:
horizontal alignment of view contents (applies to views of class
clParagraphView
and
clPictureView
only)
vertical alignment of view contents (applies to views of class
clParagraphView
and
clPictureView
only)
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна