SetToolbar – PB Docs 2017

SetToolbar

PowerScript function

Description

Specifies the alignment, visibility, and title for the specified
toolbar.

Applies to

MDI frame and sheet windows

Syntax

Argument

Description

window

The MDI frame or sheet to which the toolbar
belongs.

toolbarindex

An integer whose value is the index of the toolbar whose
settings you want to change.

visible

A boolean value specifying whether to make the toolbar
visible. Values are:

  • TRUE — Make the toolbar visible

  • FALSE — Hide the toolbar

alignment

(optional)

A value of the ToolbarAlignment enumerated datatype
specifying the alignment for the toolbar. Values are:

  • AlignAtTop! — Dock the toolbar at the top of the
    frame.

  • AlignAtLeft! — Dock the toolbar on the left side of
    the frame.

  • AlignAtRight! — Dock the toolbar on the right side of
    the frame.

  • AlignAtBottom! — Dock the toolbar at the bottom of
    the frame.

  • Floating! — Float the toolbar. The floating toolbar
    has its own frame and miniature title bar

floatingtitle (optional)

A string whose value is the title for the toolbar when its
alignment is Floating!.

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:

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:

This script changes the toolbar alignment:

See also

GetToolbar

GetToolbarPos

SetToolbarPos


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x