Dynamically Sizing a Dialog Box

 

Once invoked, the size of a dialog box is normally fixed. The @adjust_width and @adjust_height dialog box options allows the a user to size of a displayed dialog box with the mouse.

 

// dynbox.pan

@dialog

 

// adjust width and height

@adjust_width  1

@adjust_height 1

 

// default values

{defvar("dist", 0);defvar("len", 100);defvar("dx", 0.01)}

 

Generate Random Data

 

Distribution <r n>~dist = <{dist}>~<Uniform><Normal>

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

Delta X:     <w=20>~dx  = <{dx}>~input(1)

<L>

~menuclear

~if(dist==0, gfunc = "Grandom", gfunc = "Gnormal")

~eval(sprintf("W0 := %s(%d, %g)", gfunc, len, dx))

 

 

  

 

Sizing Options

 

By default, the dialog will display to the last size when re-invoked. Use @adjust_width -1 and @adjust_height -1 to allow a dialog box to size, but restore to the default size when re-invoked.

 

The @minwidth and @minheight options set the minimum width and height of an adjustable dialog box.

 

To prevent a specific control from sizing, use aw=0 modifier in the display area. Use mw=nx and mh=ny to specifiy the minimum width and height of a specific control where nx and ny are integer values.

 

The w=nx and h=ny modifiers explicitly set the width and height of a control in terms of character size where nx and ny are integer values. Use wd=nx and hd=nx to specify the width and height in terms of pixels.