The DlgArea class provides assistance in laying out the dialog controls in a dynamically defined dialog. The DlgAreaU class provides assistance in resizing and / or positioning controls when a dialog is resized. Used together, the two classes provide a convenient way to create resizable dialogs.
The DlgArea class defines an area of a UserDialog and provides co-ordinates of and within it. It is a helper for the DefineDialog Method of an OODialog UserDialog Object and has no effect on any Windows Object.
To use objects of the DlgArea class include this line in your code:
::requires "OODIALOG.CLS"
The following figure shows the measuement attributes used to position a DlgArea on a UserDialog.
>>- aDlgArea~Init(--X--,--Y--,--Width--,--Height--+-------------+--)-->< +--,--Margin--+
The arguments you pass to the new method when creating a DlgArea Object are:
The X Co-ordinate in dialog units relative to the UserDialog of the top left corner of the area you wish to define
The Y Co-ordinate in dialog units relative to the UserDialog of the top left corner of the area you wish to define.
The width in dialog units of the area of the UserDialog you wish to define
The height in dialog units of the area of the UserDialog you wish to define
An inner margin within the DlgArea in Dialog Units to be left blank. The default is 5
u = .dlgArea~new(0, 0, self~SizeX,Self~SizeY) /* u is whole of UserDialog */ b = .dlgArea~new(u~x("70%"), u~y , u~w("R"), u~h("R")) /* sub area for buttons */
Returns the y coordinate of the bottom margin in dialog units relative to UserDialog.
>>--ADlgArea~B--------------------------------------------------------><
Returns the y coordinate of the bottom edge in dialog units relative to UserDialog.
>>--ADlgArea~Bottom---------------------------------------------------><
Synonym for the W method.
>>--ADlgArea~cx(--+-------+--)---------------------------------------->< +--n%---+ +--"R"--+
Synonym for the H method.
>>--ADlgArea~cy(--+-------+--)---------------------------------------->< +--n%---+ +--"R"--+
Returns a height in dialog units relative to the dialog area.
If no argument is passed returns the inter-margin height.
>>--ADlgArea~h(--+-------+--)----------------------------------------->< +--n%---+ +--"R"--+
The arguments you pass to the H method are:
If n is a percentage returns n% of the inter-margin height.
If "R" is passed returns Remaining height between last ~y and bottom margin.
Returns the remaining height between last ~Y and bottom margin in dialog units. This is equivalent to ~H("R").
>>--ADlgArea~hr-------------------------------------------------------><
Returns the x coordinate of the left margin in dialog units relative to UserDialog.
>>--ADlgArea~L--------------------------------------------------------><
Returns the x coordinate of the left edge in dialog units relative to UserDialog.
>>--ADlgArea~Left-----------------------------------------------------><
Size in dialog units of DlgArea margin.
>>--ADlgArea~Margin---------------------------------------------------><
Returns the x coordinate of the right margin in dialog units relative to UserDialog.
>>--ADlgArea~R--------------------------------------------------------><
Returns the x coordinate of the right edge in dialog units relative to UserDialog.
>>--ADlgArea~Right----------------------------------------------------><
Returns the y coordinate of the top margin in dialog units relative to UserDialog.
>>--ADlgArea~T--------------------------------------------------------><
Returns the y coordinate of the top edge in dialog units relative to UserDialog.
>>--ADlgArea~Top------------------------------------------------------><
Returns a width in dialog units relative to the dialog area.
If no argument is passed returns the inter-margin width.
>>--ADlgArea~w(--+-------+--)----------------------------------------->< +--n%---+ +--"R"--+
The arguments you pass to the Y method are:
If n is a percentage returns n% of the inter-margin width.
If "R" is passed returns Remaining width between last ~x and right margin.
Returns the remaining width between last ~X and right margin in dialog units. This is equivalent to ~W("R").
>>--ADlgArea~wr-------------------------------------------------------><
Returns an X Coordinate in dialog units relative to the dialog area.
If no n is passed returns the x coordinate of the left margin.
>>--ADlgArea~x(--+------+--)------------------------------------------>< +--n---+ +--n%--+
The arguments you pass to the X method are:
If n is passed and is positive, then returns the x coordinate n dialog units to the right of the left margin. If n is passed and is negative, then returns the x coordinate n dialog units to the left of the right margin..
If n is passed and is a percentage, then returns the x coordinate n% of the way between the left and right margins.
Returns an Y Coordinate in dialog units relative to the dialog area.
If no n is passed returns the x coordinate of the top margin.
>>--ADlgArea~y(--+------+--)------------------------------------------>< +--n---+ +--n%--+
The arguments you pass to the Y method are:
If n is passed and is positive, then returns the y coordinate n dialog units below the topmargin. If n is passed and is negative, then returns the y coordinate n dialog units above the bottom margin..
If n is passed and is a percentage, then returns the y coordinate n% of the way between the top and bottom margins.
On a UserDialog we want the top left to be an entry area, with an area for buttons on the right and a status area below.
We decide to give 70% of the width and 90% of the height to the entry area. We leave the margin as the default. We want all the areas to resize themselves if we change the UserDialog size except the OK button should remain 15 units high.
Here is what our DefineDialog method might look like:
/* ------------------------------------------------------------------------- */ ::method DefineDialog /* ------------------------------------------------------------------------- */ /* define DlgArea named u as whole of user dialog */ u=.dlgArea~new( 0 , 0,self~SizeX,Self~SizeY) /* whole dlg */ /* define DlgArea named e within DlgArea u for entry line */ e=.dlgArea~new(u~x ,u~y ,u~w("70%"),u~h("90%")) /* define DlgArea named s within DlgArea u for Status Area in remaining height*/ s=.dlgArea~new(u~x ,u~y("90%"),u~w("70%"),u~hr ) /* define DlgArea named b within DlgArea u for Button area */ b=.dlgArea~new(u~x("70%"),u~y ,u~wr ,u~hr ) /* entry line coterminous with area e margins */ self~AddEntryLine(12,"text",e~x,e~y,e~w,e~h,"multiline") /* Status Area Coterminous with area s margins */ self~AddText(s~x,s~y,s~w,s~h,"Status info appears here",11) /* Seven buttons evenly spaced at 10% intervals, 9% high */ do i = 0 to 6 self~addButton(12+i,b~x,b~y((i * 10)||"%"),b~w,b~h("9%"),"Button" i,"Button"||i) end /* DO */ /* ok button 15 dialog units high at bottom of area b */ self~AddButton(1,b~x,b~y(-15),b~w,15,"OK","OK","Default")
Here is the resultant dialog.