SetToolbar
PowerScript function
Description
Specifies the alignment, visibility, and title for the specified
toolbar.
Applies to
MDI frame and sheet windows
Syntax
1 |
window.SetToolbar ( toolbarindex, visible {, alignment {, floatingtitle } } ) |
Argument |
Description |
---|---|
window |
The MDI frame or sheet to which the toolbar |
toolbarindex |
An integer whose value is the index of the toolbar whose |
visible |
A boolean value specifying whether to make the toolbar
|
alignment (optional) |
A value of the ToolbarAlignment enumerated datatype
|
floatingtitle (optional) |
A string whose value is the title for the toolbar when its |
Return value
Integer.
Returns 1 if it succeeds. SetToolbar returns -1 if there is no
toolbar for the index you specify or if an error occurs. If any argument’s
value is null, returns null.
Usage
When you use SetToolbar to change the toolbar alignment from a
docked position to Floating!, PowerBuilder uses the last known position
information unless you also call SetToolbarPos to adjust the
position.
The toolbars are not redrawn until the script ends, so setting the
alignment with SetToolbar and the position with SetToolbarPos looks like a
single change to the user.
Examples
This example allows the user to choose an alignment in a ListBox
lb_position. The selected string is converted to a ToolbarAlignment
enumerated value, which is used to change the alignment of toolbar index
1:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
toolbaralignment tba_align CHOOSE CASE lb_position.SelectedItem() CASE "Top" tba_align = AlignAtTop! CASE "Left" tba_align = AlignAtLeft! CASE "Right" tba_align = AlignAtRight! CASE "Bottom" tba_align = AlignAtBottom! CASE "Floating" tba_align = Floating! END CHOOSE w_frame.SetToolbar(1, TRUE, tba_align) |
In this example, the user clicks a radio button to choose an
alignment. The radio button’s Clicked event sets an instance variable of
type ToolbarAlignment. Here the radio buttons are packaged as a custom
visual user object. I_toolbaralign is an instance variable of the user
object. This is the script for the Top radio button:
1 |
Parent.i_toolbaralign = AlignAtTop! |
This script changes the toolbar alignment:
1 2 |
w_frame.SetToolbar(1, TRUE, & uo_toolbarpos.i_toolbaralign ) |
See also