_______________________________________________________
PANEL Widget
Used as a "container" or "parent" widget to most other widgets
_______________________________________________________
Legal Usage Level-0 Widget: Yes
Parent to: All widgets except:
MENU BUTTON,
MENU TOGGLE,
MENU SEPARATOR,
and CASCADE MENU
Child of: PANEL
Example Image
Example Program
See the BITMAP Widget program for an example of the PANEL features. This program provides a display similar to that shown above when theappropriate bitmap file is included in the PANEL widget.
NOTE
See the following programs for other examples using the PANEL widget:
Attributes
Remarks
The PANEL widget is used as a "container" or "parent" widget in which you can place other widgets. A PANEL widget can be both a parent and child widget at the same time. The PANELs "client area" is the central area of the panel window into which child widgets are placed.
PANEL introduces the concept of a "virtual client area". This allows you to create a scrollable client area that is larger than the actual client area (the area currently displayed). With a virtual client area, you can easily manage big child widgets or a number of child widgets that would not normally fit on the screen.
A PANEL widget provides a convenient way to manage a group of component (children) widgets that logically belong together as part of some user interface. The PANEL widget can be defined as a parent widget, with each of the widgets placed on the PANEL defined as a child widget. When the PANEL is hidden, the child widgets are also hidden also. When the PANEL is moved, the child widgets are moved together, as a group. Child widgets cannot extend beyond the border of their PANEL parent.
When a PANEL widget is a level-0 widget (it can be a child of another PANEL), it can be MOVABLE, MAXIMIZABLE, MINIMIZABLE, RESIZABLE, and it can be given a TITLE. You can set its origin and dimensions and make it visible or invisible. If the PANEL widget disappears, all of its child widgets also disappear. You can make the PANEL invisible when you create it, populate it with child widgets, and then make the whole assemblage visible at one time.
The PANEL has a SIZE CONTROL attribute that allows it to automatically resize its child widgets or to provide a scrollable client area. The default setting is NONE. However, if you set it to RESIZE CHILDREN, all the child widgets are automatically rescaled when you resize the PANEL.
If you set SIZE CONTROL to SCROLLABLE and then resize the PANEL so that it is smaller than a defined "scroll area", scroll bars appear to allow you to scroll the user interface in the PANEL. A set of related attributes allow you to specify the:
·
|
Scroll increments in pixels (SCROLL WIDTH UNITS and SCROLL HEIGHT UNITS)
|
·
|
Corner of the PANEL to which the scrolling is relative (SCROLL JUSTIFICATION)
|
·
|
Current scroll origin (SCROLL X ORIGIN and SCROLL Y ORIGIN)
|
·
|
Size of the scroll area (SCROLL WIDTH and SCROLL HEIGHT).
|
SCROLL WIDTH UNITS and SCROLL HEIGHT UNITS specify the number of pixels to scroll the PANEL work area. However, the SCROLL WIDTH and the SCROLL HEIGHT are not in pixels, but in multiples of SCROLL WIDTH UNITS and SCROLL HEIGHT UNITS.
For example, if you set SCROLL WIDTH UNITS to 20 (pixels) and then set SCROLL WIDTH to 100, the width over which the PANEL interior scrolls is not 100 pixels, but is 2000 pixels (or 20 * 100). If SCROLL WIDTH or SCROLL HEIGHT evaluates to over 32,767 pixels, an error message is generated.
When placing child widgets into a scrollable PANEL, the origin of the child widgets is relative to the virtual client area, not the actual client area. The SIZE CONTROL attribute allows you to create a scrollable virtual client area. Use SCROLL WIDTH and SCROLL HEIGHT to define the size of the virtual client area.
Events
Events for the PANEL widget are:
REPAINT
When anything happens on the screen that causes the PANEL to be repainted or redrawn,
a REPAINT event is generated. Two examples of events that cause a REPAINT event to be
generated are:
·
|
When a dialog comes up over the PANEL, is answered, and then goes away
|
·
|
When the operator moves or resizes a widget on top of the PANEL
|
Use the REPAINT event to notify other parts of the program that HTBasic has
changed the screen. The REPAINT event lets other HTBasic graphics know that they need
to repaint.
RESIZED
Since a PANEL widget may contain child widgets, resizing it will affect the positioning of the
child widgets. Therefore, the PANEL widget will generate a RESIZED event whenever the user
resizes it.
SYSTEM MENU
This event is generated when the operator selects items from the SYSTEM MENU.