GetToolbarPos

Gets position information for the specified toolbar.

To get

Use

Docking position of a docked toolbar

Syntax 1 For docked toolbars

Coordinates and size of a floating toolbar

Syntax 2 For floating toolbars


Syntax 1 For docked toolbars

Description

Gets the position of a docked toolbar.

Applies to

MDI frame and sheet windows

Syntax

window.GetToolbarPos ( toolbarindex, dockrow, offset )

Argument

Description

window

The MDI frame or sheet to which the toolbar belongs.

toolbarindex

An integer whose value is the index of the toolbar for which you want the current settings.

dockrow

An integer variable in which you want to store the number of the docking row for the specified toolbar. Docking rows are numbered from left to right or top to bottom.

offset

An integer variable in which you want to store the offset of the toolbar from the beginning of the docking row. For toolbars at the top or bottom, offset is measured from the left edge. For toolbars at the left or right, offset is measured from the top.

Returns

Integer. Returns 1 if it succeeds. GetToolbarPos returns -1 if there is no toolbar for the index you specify or if an error occurs. If any argument’s value is null, GetToolbarPos returns null.

Usage

To find out whether the docked toolbar is at the top, bottom, left, or right edge of the window, call GetToolbar.

Syntax 1 for GetToolbarPos gets the most recent docked position, even if the toolbar is currently floating.

Examples

Example 1

In this example, the user has specified a toolbar index in sle_2. The example gets the toolbar position information and displays it in a MultiLineEdit mle_1:

integer li_index, li_rtn

integer li_dockrow, li_offset


li_index = Integer(sle_2.Text)

li_rtn = w_frame.GetToolbarPos(li_index, &

   li_dockrow, li_offset)


// Report the position settings

IF li_rtn = 1 THEN

   mle_1.Text = String(li_dockrow) + "~r~n" &

      + String(li_offset)

ELSE

   mle_1.Text = "Can't get toolbar position"

END IF

See also


Syntax 2 For floating toolbars

Description

Gets the position and size of a floating toolbar.

Applies to

MDI frame and sheet windows

Syntax

window.GetToolbarPos ( toolbarindex, x, y, width, height )

Argument

Description

window

The MDI frame or sheet to which the toolbar belongs.

toolbarindex

An integer whose value is the index of the toolbar for which you want the current settings.

x

An integer variable in which you want to store the x coordinate of the floating toolbar. If the toolbar is docked, x is set to the most recent value.

y

An integer variable in which you want to store the y coordinate of the floating toolbar. If the toolbar is docked, y is set to the most recent value.

width

An integer variable in which you want to store the width of the floating toolbar. If the toolbar is docked, width is set to the most recent value.

height

An integer variable in which you want to store the height of the floating toolbar. If the toolbar is docked, height is set to the most recent value.

Returns

Integer. Returns 1 if it succeeds. GetToolbarPos 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 whether the toolbar is floating, call GetToolbar.

Syntax 2 for GetToolbarPos gets the most recent floating position, even if the toolbar is currently docked.

Examples

Example 2

This example gets the x and y coordinates and the width and height of toolbar 1:

int ix, iy, iw, ih, li_rtn


li_rtn = w_frame.GetToolbarPos(1, ix, iy, iw, ih)

IF li_rtn = -1 THEN

   mle_1.Text = "Can't get toolbar position"

ELSE

   mle_1.Text = String(ix) + "~r~n" &

      + String(iy) + "~r~n" &

      + String(iw) + "~r~n" &

         + String(ih)

END IF

See also