Scol standard library package  0.3
Common and usefull functions for all Scol applications
 All Data Structures Files Functions Variables Groups Pages
Functions
Dialog Box API
The OS 2D supplemental API

Functions

 lib2d_dlgSetSize (strDlg, width, height)
 Set the size of the dialog box.
 lib2d_dlgGetSize (strDlg)
 Get the size of the dialog box.
 lib2d_dlgSetPos (strDlg, pos)
 Set the initial position of the dialog box.
 lib2d_dlgGetPos (strDlg)
 Get the initial position of the dialog box.
 lib2d_dlgSetWin (strDlg, win)
 Set the window object of the dialog box. This is optional but the developer can customized the window himself/herself.
 lib2d_dlgGetWin (strDlg)
 Get the window object of the dialog box.
 lib2d_dlgSetMother (strDlg, win)
 Set the window mother object of the dialog box.
 lib2d_dlgSetWinFlags (strDlg, lFlags)
 Set the window flags of the dialog box.
 lib2d_dlgSetFontDefault (strDlg, size)
 Create the font as the default font. It is the Arial.
 lib2d_dlgSetFont (strDlg, font)
 Set the font of the dialog box.
 lib2d_dlgGetFont (strDlg)
 Get the font object used by the dialog box.
 lib2d_dlgSetChannel (strDlg, ch)
 Set the proprietary channel of the dialog box.
 lib2d_dlgGetChannel (strDlg)
 Get the proprietary channel object of the dialog box.
 lib2d_dlgSetSpacing (strDlg, iSp)
 Set the spacing between each graphical element of the dialog box.
 lib2d_dlgGetSpacing (strDlg)
 Get the spacing of the dialog box.
 lib2d_dlgGetSpacingDefault ()
 Get the default spacing value.
 lib2d_dlgNew ()
 Create a new dialog box object.

Detailed Description

2

Function Documentation

lib2d_dlgSetSize ( strDlg  ,
width  ,
height   
)

Set the size of the dialog box.

2 Prototype : fun [L2D_DIALOG I I] I

Parameters
L2D_DIALOG: a dialog object
I: the new width (in piexel, mini 10 px). Can be nil.
I: the new height (in piexel, mini 10 px). Can be nil.
Returns
I : 0 if success or 1 if an error occurs :
  • 1 : the dialog object is nil
Remarks
If a value is nil, a value will be set from the size of the first defined text if a such text is already defined. Otherwise, an arbitrary value will be set.
lib2d_dlgGetSize ( strDlg  )

Get the size of the dialog box.

2 Prototype : fun [L2D_DIALOG] [I I]

Parameters
L2D_DIALOG: a dialog object
Returns
[I I] : the width and the height if success or nil if an error occurs.
lib2d_dlgSetPos ( strDlg  ,
pos   
)

Set the initial position of the dialog box.

2 Prototype : fun [L2D_DIALOG I] I

Parameters
L2D_DIALOG: a dialog object
I: the position to set :
  • L2D_DIALOG_POSCENTER (centered on the screen),
  • L2D_DIALOG_POSMOUSE (centered of the mouse pointer position).
Returns
I : 0 if success or 1 if an error occurs :
  • 1 : the dialog object is nil
lib2d_dlgGetPos ( strDlg  )

Get the initial position of the dialog box.

2 Prototype : fun [L2D_DIALOG] I

Parameters
L2D_DIALOG: a dialog object
Returns
I : the position if success or nil if an error occurs :
  • L2D_DIALOG_POSCENTER (centered on the screen),
  • L2D_DIALOG_POSMOUSE (centered of the mouse pointer position).
lib2d_dlgSetWin ( strDlg  ,
win   
)

Set the window object of the dialog box. This is optional but the developer can customized the window himself/herself.

2 Prototype : fun [L2D_DIALOG ObjWin] I

Parameters
L2D_DIALOG: a dialog object
ObjWin: the window object to set.
Returns
I : 0 if success or 1 if an error occurs :
  • 1 : the dialog object is nil
  • 2 : the window object is nil
lib2d_dlgGetWin ( strDlg  )

Get the window object of the dialog box.

2 Prototype : fun [L2D_DIALOG] ObjWin

Parameters
L2D_DIALOG: a dialog object
Returns
ObjWin : the window object if success or nil if an error occurs.
lib2d_dlgSetMother ( strDlg  ,
win   
)

Set the window mother object of the dialog box.

2 Prototype : fun [L2D_DIALOG ObjWin] I

Parameters
L2D_DIALOG: a dialog object
ObjWin: the mother object to set. Can be nil if no parent to set.
Returns
I : 0 if success or 1 if an error occurs :
  • 1 : the dialog object is nil
lib2d_dlgSetWinFlags ( strDlg  ,
lFlags   
)

Set the window flags of the dialog box.

2 Prototype : fun [L2D_DIALOG [I r1]] I

Parameters
L2D_DIALOG: a dialog object
[Ir1] : a list of flags to set. Each flag can be one of these following values :
  • L2D_DIALOG_FLAGTOP : always on top,
  • L2D_DIALOG_FLAGDOWN : display a 3d border,
  • L2D_DIALOG_FLAGDND : allow drag and drop inside the dialog,
  • L2D_DIALOG_FLAGMENU : add a menu bar to the dialog,
  • L2D_DIALOG_FLAGNOBORDER : window has no border,
  • L2D_DIALOG_FLAGNOSCOL : removes the "(Scol)" word in dialog title.
Returns
I : 0 if success or 1 if an error occurs :
  • 1 : the dialog object is nil
Remarks
If the list is nil, the flag L2D_DIALOG_FLAGMENU is set by default.
If a element of the list is another value, it is ignored.
lib2d_dlgSetFontDefault ( strDlg  ,
size   
)

Create the font as the default font. It is the Arial.

2 Prototype : fun [L2D_DIALOG I] I

Parameters
L2D_DIALOG: a dialog object
I: the size (should be > 6, otherwise the size will be set to 6).
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the dialog object is nil
  • 2 : unable to create the font
lib2d_dlgSetFont ( strDlg  ,
font   
)

Set the font of the dialog box.

2 Prototype : fun [L2D_DIALOG ObjFont] I

Parameters
L2D_DIALOG: a dialog object
ObjFont: a scol font object (_CRfont ...).
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the dialog object is nil
  • 2 : the given font was nil but it is replaced by the default font, with success
  • 3 : unable to create the default font if the given font was nil
lib2d_dlgGetFont ( strDlg  )

Get the font object used by the dialog box.

2 Prototype : fun [L2D_DIALOG] ObjFont

Parameters
L2D_DIALOG: a dialog object
Returns
ObjFont : the scol font object if success or nil if an error occurs.
lib2d_dlgSetChannel ( strDlg  ,
ch   
)

Set the proprietary channel of the dialog box.

2 Prototype : fun [L2D_DIALOG Chn] I

Parameters
L2D_DIALOG: a dialog object
Chn: a scol channel object.
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the dialog object is nil
  • 2 : the given channel is nil
lib2d_dlgGetChannel ( strDlg  )

Get the proprietary channel object of the dialog box.

2 Prototype : fun [L2D_DIALOG] Chn

Parameters
L2D_DIALOG: a dialog object
Returns
Chn : the scol channel object if success or nil if an error occurs.
lib2d_dlgSetSpacing ( strDlg  ,
iSp   
)

Set the spacing between each graphical element of the dialog box.

2 Prototype : fun [L2D_DIALOG I] I

Parameters
L2D_DIALOG: a dialog object
I: a spacing to set.
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the dialog object is nil
  • 2 : the given channel is nil
lib2d_dlgGetSpacing ( strDlg  )

Get the spacing of the dialog box.

2 Prototype : fun [L2D_DIALOG] I

Parameters
L2D_DIALOG: a dialog object
Returns
I : the spacing if success or nil if an error occurs.
lib2d_dlgGetSpacingDefault ( )

Get the default spacing value.

2 Prototype : fun [] I

Returns
I : the default spacing value.
lib2d_dlgNew ( )

Create a new dialog box object.

2 Prototype : fun [] L2D_DIALOG

The dialog box is created with the mostly current parameters. The present API can set other values for them. Theses default values are :

  • the channel is the current channel,
  • the dialog box flag is L2D_DIALOG_FLAGMENU to add a menu bar,
  • the initial position is L2D_DIALOG_POSCENTER, center of the scrren,
  • the spacing between each graphical element is 10 pixel.
    Remarks
    Parameters are not set as the used font and other things. See lib2d_dlgSet* to set them.