GetToolbar PowerScript function
Description
Gets the current values for alignment, visibility, and title
of the specified toolbar.
Controls
MDI frame and sheet windows
Syntax
|
1 |
<span>window</span>.<span>GetToolbar</span> ( <span>toolbarindex</span>, <span>visible</span> {, <span>alignment</span> {, <span>floatingtitle</span> } } ) |
|
Argument |
Description |
|---|---|
|
window |
The MDI frame or sheet to which the toolbar |
|
toolbarindex |
An integer whose value is the index of |
|
visible |
A boolean variable in which you want |
|
alignment (optional) |
A variable of the ToolbarAlignment enumerated |
|
floatingtitle (optional) |
A string variable in which you want to |
Return Values
Integer. Returns 1 if it succeeds. GetToolbar 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
To find out the position of the docked or floating toolbar,
call GetToolbarPos.
Examples
This example finds out whether toolbar 1 is visible.
It also gets the alignment and title of toolbar 1. The values are
stored in the variables lb_visible, lta_align,
and ls_title:
|
1 |
integer li_rtn |
|
1 |
boolean lb_visible |
|
1 |
toolbaralignment lta_align |
|
1 |
|
1 |
li_rtn = w_frame.<span>GetToolbar</span>(1, lb_visible, & |
|
1 |
   lta_align, ls_title) |
This example displays the settings for the toolbar
index the user specifies in sle_index.
The IF and CHOOSE CASE statements
convert the values to strings so they can be displayed in mle_toolbar:
|
1 |
integer li_index, li_rtn |
|
1 |
boolean lb_visible |
|
1 |
toolbaralignment lta_align |
|
1 |
string ls_visible, ls_align, ls_title |
|
1 |
|
1 |
li_index = Integer(sle_index.Text) |
|
1 |
li_rtn = w_frame.<span>GetToolbar</span>(li_index, & |
|
1 |
   lb_visible, lta_align, ls_title) |
|
1 |
|
1 |
IF li_rtn = -1 THEN |
|
1 |
   MessageBox("Toolbars", "Can't get" & |
|
1 |
      + " toolbar settings.") |
|
1 |
   RETURN -1 |
|
1 |
END IF |
|
1 |
|
1 |
IF lb_visible = TRUE THEN |
|
1 |
   ls_visible = "TRUE" |
|
1 |
ELSE |
|
1 |
   ls_visible = "FALSE" |
|
1 |
END IF |
|
1 |
|
1 |
CHOOSE CASE lta_align |
|
1 |
   CASE AlignAtTop! |
|
1 |
      ls_align = "top" |
|
1 |
   CASE AlignAtLeft! |
|
1 |
      ls_align = "left" |
|
1 |
   CASE AlignAtRight! |
|
1 |
      ls_align = "right" |
|
1 |
   CASE AlignAtBottom! |
|
1 |
      ls_align = "bottom" |
|
1 |
   CASE Floating! |
|
1 |
      ls_align = "floating" |
|
1 |
END CHOOSE |
|
1 |
|
1 |
mle_1.Text = ls_visible + "~r~n" & |
|
1 |
   + ls_align + "~r~n" & |
|
1 |
      + ls_title |