TOGGLE Gadget
- Last UpdatedNov 07, 2024
- 2 minute read
Member
|
Name |
Type |
Purpose |
|---|---|---|
|
Val |
BOOLEAN |
Toggles value between TRUE and FALSE. |
Methods
|
Name |
Result |
Purpose |
|---|---|---|
|
AddPixmap(STRING file1, STRING file2, STRING file3 ) AddPixmap(STRING file1, STRING file2) AddPixmap |
NO RESULT |
Adds pixmaps to be used for the unselected, selected and inactive states. The last two are optional. |
|
FullName() |
STRING |
Get the full gadget name, for example, '!!Form.gadget'. |
|
Name() |
STRING |
Get the gadget's name, for example, 'gadget'. |
|
Owner() |
FORM |
Get owning form. |
|
SetFocus() |
NO RESULT |
Moves keyboard focus to this gadget. |
|
SetPopup(MENU) |
NO RESULT |
Links the given menu with the gadget as a pop-up. |
|
RemovePopup(MENU) |
NO RESULT |
Removes the given pop-up menu from the gadget. |
|
GetPickedPopup() |
MENU |
Returns the last picked pop-up menu for the gadget. |
|
Refresh() |
NO RESULT |
Refreshes the display of the gadget. |
|
Shown() |
BOOLEAN |
Get ‘shown’ status. |
|
SetToolTip |
STRING |
Sets or edits the text of the TOOLTIP. |
|
Type() |
STRING |
Get the gadget type as a string. |
|
Background() |
STRING |
Get Background Color Name. Some gadgets do not support this property in all circumstances, for example, gadgets which are showing a pixmap. Gadgets whose color has not been set explicitly may not have a color with a known colorname. In this case, an error is raised. |
Command
The TOGGLE command defines a toggle gadget, and specifies its position, tag, and callback text. Also allows you to specify different text strings for the default ON and OFF states.
You can define the TOGGLE to be either PML-controlled, or core-code controlled using the gadget qualifier attribute control type, with values "PML" or "CORE".
.-------<------------.
/ |
>- TOGGLE gname -+- <fgtagw> -----------|
+- PIXMAP <vshap> -----|
+- CALLback text —-----|
+- <fgpos> ------------|
+- <fganch> -----------|
+- TOOLTIP text -------|
+- CORE ---------------* Core managed gadget
+- STATES text1 text2 -.
‘----------------------+- TOOLTIP text -.
‘----------------‘--->
Figure 2:7. Syntax Graph: Setting Up a TOGGLE Object
Here, 'text1' corresponds to the OFF setting and 'text2' corresponds to the ON setting.
Note:
It is bad practice to place one gadget on top of another. This may lead to gadgets
being obscured.
|
Default: |
Default text strings for the two toggle settings are ‘OFF’ and ‘ON’. Default state when a toggle is first defined is ‘OFF’; i.e. button raised. |
Pixmaps associated with Toggle gadgets can be changed after the gadgets have been displayed on a form.
Method syntax:
AddPixmap( !pixmap1 is STRING )
AddPixmap( !pixmap1 is STRING, !pixmap2 is STRING )
Here, '!pixmap' is a string holding the file pathname of the required .png file, for example, '%pmllib%\png\camera.png'.
'!pixmap1' shows the Unselected state of the gadget, and pixmap2 shows the Selected state.
Notes:
-
It is recommended that when you define the gadget, you set its size to encompass the largest pixmap which you will later add. Failure to do this may result in unexpected behavior.
-
Historically, you could add a third pixmap which was used when the gadget was de-activated. This practice is no longer necessary as the gadget pixmapped is automatically grayed-out on de-activation.