SETMENUCOORDS

Purpose:

Sets the coordinates of a user defined menu or dialog box.

Syntax:

SETMENUCOORDS(handle, id, left, top, right, bottom)

handle

-

An integer, the handle of the menu or dialog.

id

-

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

left

-

An integer, the left coordinate of the menu or dialog.

top

-

An integer, the top coordinate of the menu or dialog.

right

-

An integer, the right coordinate of the menu or dialog.

bottom

-

An integer, the bottom coordinate of the menu or dialog.

Returns:

An integer, 1 if successful.

Example:

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

 

 

// test2.pan

@panel

 

// modeless and embedded into Worksheet

@child 1

@modeless 1

 

// allow width to adjust

@adjust_width 1

 

// upper left device 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 function and set current window formula

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

 

// prevent automatic close

~menureturn

 

The following statements invoke the dialog box and automatically adjust the Worksheet location:

 

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

 

Now, to increase the width of the dialog box by 100 pixels and automatically adjust the left coordinate of the Worksheet:

 

(l,t,r,b) = getmenucoords(m);

setmenucoords(m,l,t,r+100,b);setwsx(getmenucoords(m)+10, -1);

 

Since the dialog box has the @adjust_width property, the width of the controls within the embedded dialog box also increase.

Remarks:

The 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.

 

A value of 1 preserves the previous value of the coordinate.

 

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

See Also:

GETMENUCOORDS

MENUFILE

MENUSHOW

SETWSCOORDS

SETWSX

SETWSY