DADiSP Worksheet Functions > F - K > GETMENUCOORDS

 

GETMENUCOORDS

Purpose:

Returns coordinates of a user defined menu or dialog box.

Syntax:

GETMENUCOORDS(handle, id)

(width, height) = GETMENUCOORDS(handle, id)

(left, top, right, bottom) = GETMENUCOORDS(handle, id)

handle

-

An integer, the handle of the menu or dialog.

id

-

Optional. The integer handle of a control contained by the dialog box.

Returns:

One or more integers, the dimensions or location of the menu or dialog box in device coordinates.

GETMENUCOORDS(handle, id) returns the width of the menu or dialog box.

(width, height) = GETMENUCOORDS(handle, id) returns the width and height of the menu or dialog box.

(left, top, right, bottom) = GETMENUCOORDS(handle, id) returns the coordinates of the menu or dialog box.

Example:

Consider TEST1.PAN, the following embedded dialog box specification:

 

// test1.pan

@panel

 

// modeless and embedded into Worksheet

@child 1

@modeless 1

 

// upper left coords 10 pixels from Worksheet border

@xd 10

@yd 10

 

// default parameters

{defvar("_funcstr", "Gsin")}

{defvar("_funclen", 100)}

{defvar("_funcdx", 0.01)}

 

// dialog box input controls

Function: <w=20>~_funcstr = "<{_funcstr}>" ~ <Gsin><Grand><Gnorm>

Length:   <w=20>~_funclen = <{_funclen}>   ~ input(2)

Deltax:   <w=20>~_funcdx  = <{_funcdx}>    ~ input(1)

 

// evaluate expression and set current window formula

~eval(sprintf("W0:=%s(%d, %g)", _funcstr, _funclen, _funcdx))

 

// prevent automatic close

~menureturn

 

The following statements invoke the embedded dialog box and sets the left coordinate of the Worksheet to accommodate the width of the dialog box.

 

m = menufile("test.pan");setwsx(getmenucoords(m)+10, -1)

Remarks:

The returned values are specified in device (pixel) coordinates. The coordinates of an embedded dialog (@child) are relative to the upper left corner of the Worksheet display area.

 

The optional ID parameter specifies a control within the dialog box marked with the ID identifier. In this case, the dimensions or coordinates of the control are relative to the upper left corner of the containing dialog box.

See Also:

GETWSCOORDS

SETMENUCOORDS

SETWSCOORDS

MENUFILE

SETWSX

SETWSY