Project

General

Profile

Scol standard library package  0.3.1
Common and usefull functions for all Scol applications

Classes

struct  L2D_BUTTON
 Opaque internal structure. You should not call it directly, use API instead ! More...

Functions

 lib2d_butBuild (strBut)
 Build the button.
 lib2d_butClose (strBut)
 Close a button.
 lib2d_butDestroy (strBut)
 Destroy a button.
 lib2d_butDisable (strBut)
 Disable (hide) a button.
 lib2d_butEnable (strBut)
 Enable (show) a button.
 lib2d_butGetBgColor (strBut)
 Retreive the background color.
 lib2d_butGetBgParams (strBut)
 Get the background parameters of the button.
 lib2d_butGetBitmap (strBut)
 Return the bitmap object to a button object.
 lib2d_butGetBitmapPos (strBut)
 Get the bitmap position of a button object.
 lib2d_butGetBitmapSize (strBut)
 Get the bitmap size of a button object.
 lib2d_butGetCbClick (strBut)
 Get the "Click" event callback to a button object.
 lib2d_butGetCbClose (strBut)
 Get the "Close" event callback to a button object.
 lib2d_butGetCbDestroy (strBut)
 Get the "Destroy" event callback to a button object.
 lib2d_butGetCbDrop (strBut)
 Get the "drop files" callback to a button object.
 lib2d_butGetCbDropfiles (strBut)
 Get the "Drop files" event callback to a button object.
 lib2d_butGetFoColor (strBut)
 Retreive the foreground (title) color.
 lib2d_butGetFont (strBut)
 Return the useed font of a button object.
 lib2d_butGetMother (strBut)
 Get the mother window.
 lib2d_butGetPos (strBut)
 Get the position of a button object.
 lib2d_butGetSize (strBut)
 Get the size of a button object.
 lib2d_butGetTitle (strBut)
 Return the title to a button object.
 lib2d_butGetType (strBut)
 Return the type of a button object.
 lib2d_butGetWinFlag (strBut)
 Get the flags of the window button.
 lib2d_butIsEnabled (strBut)
 Return if a button is shown or hidden (enabled / disabled).
 lib2d_butNew (iType, oMother, cbClick)
 Create a new object.
 lib2d_butSetBgColor (strBut, color)
 Set the background color.
 lib2d_butSetBgParams (strBut, b, fullbg, border, sizeborder)
 Set the background parameters of the button.
 lib2d_butSetBitmap (strBut, bmp)
 Set a bitmap object to a button object.
 lib2d_butSetBitmapPos (strBut, x, y)
 Set the bitmap position of a button object.
 lib2d_butSetBitmapSize (strBut, width, height)
 Set the bitmap size of a button object.
 lib2d_butSetCbClick (strBut, cb)
 Set the callback when a 'Click' event occurs.
 lib2d_butSetCbClose (strBut, cb)
 Set the callback when a 'Close' event occurs.
 lib2d_butSetCbDestroy (strBut, cb)
 Set the callback when a 'Destroy' event occurs.
 lib2d_butSetCbDrop (strBut, cb)
 Define the "drop files" callback to a button object.
 lib2d_butSetCbDropfiles (strBut, cb)
 Set the callback when a 'Drop files' event occurs.
 lib2d_butSetFile (strBut, szPath)
 Set a bitmap file to a button object.
 lib2d_butSetFoColor (strBut, color)
 Set the foreground color, i.e. the title color.
 lib2d_butSetFont (strBut, oFont)
 Set the used font to a button object.
 lib2d_butSetMother (strBut, mother)
 Set the mother window to a button object.
 lib2d_butSetPos (strBut, x, y)
 Set the position of a button object.
 lib2d_butSetSize (strBut, width, height)
 Set the size of a button object.
 lib2d_butSetTitle (strBut, szTitle)
 Set a title to a button object.
 lib2d_butSetType (strBut, iType)
 Set the type to a button object.
 lib2d_butSetWinFlag (strBut, flags)
 Set the flags of the window button.
 lib2d_buttonNewCopy (strBut)
 Create a new object from another one.
 lib2s_butGetSpacing (strBut)
 Get the spacing between the graphical elements.
 lib2s_butGetTextPos (strBut)
 Get the text position of a button object.
 lib2s_butSetSpacing (strBut, spacing)
 Set the spacing between the graphical elements.
 lib2s_butSetTextPos (strBut, pos, ref)
 From the bitmap, set the text position of a button object. If it is no bitmap, the position is from the edge of the window.

Variables

var L2D_BUTTON_BUTTON = 1
 button is a button
var L2D_BUTTON_SPACING = 10
 default spacing value between the graphical elements
var L2D_BUTTON_WINDOW = 0
 button is a window

Detailed Description

To create and manage customized buttons.

Package to load : lib/2dos/button.pkg

Dependancies :

Function Documentation

lib2d_butNew ( iType  ,
oMother  ,
cbClick   
)

Create a new object.

Some parameters take default values (they can be modified with tthis API) :

  • a default font ("Arial", size = 14).
  • a global size (50, 20)
  • a position (0, 0)
  • the text is put to right, relative of the bitmap
  • a spacing (10)
  • a background color (white)
  • a foreground color (black)
  • the background is fully drawn
  • no window flags defined
  • is enabled

Prototype : fun [I ObjWin fun [L2D_BUTTON I I I I] I] L2D_BUTTON

Parameters
I: the type of the button, one of these following values :
  • L2D_BUTTON_WINDOW : the button will be built in a child window. It can be used and customized after
  • L2D_BUTTON_BUTTON : the built button is a classical button
ObjWin: the mother window. It can be nil.
fun[L2D_BUTTON I I I I] I : the callback when a click event occurs. The suplemental arguments are (they are always nil if the type is L2D_BUTTON_BUTTON except 'mask') :
  • I : the x click coordinate,
  • I : the y click coordinate,
  • I : the mouse button number,
  • I : the key mask (1 = shift, 2 = control, 4 = alt).
Returns
L2D_BUTTON : the new object if success or nil if an error occurs (typically, the given type is incorrect).
lib2d_buttonNewCopy ( strBut  )

Create a new object from another one.

All parameters are copied EXCEPT all callbacks. Callbacks are all at nil. This API can set that.

Prototype : fun [L2D_BUTTON] L2D_BUTTON

Parameters
L2D_BUTTON: the model to copy
Returns
L2D_BUTTON : the new object if success or nil if an error occurs (typically, the given button is nil).
lib2d_butSetFile ( strBut  ,
szPath   
)

Set a bitmap file to a button object.

Prototype : fun [L2D_BUTTON S] I

Parameters
L2D_BUTTON: a button object
S: a bitmap filename. Can be nil, in this case, the old bitmap is destroyed).
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
  • 2 : the given filename is bad : file not found, format unsupported, ...
Remarks
If a bitmap can be created from the given read reference file, its size will be set automatically. The developper can be modified it by using 'lib2d_butSetBitmapSize'.
See Also
lib2d_butSetBitmapSize
lib2d_butSetBitmap ( strBut  ,
bmp   
)

Set a bitmap object to a button object.

Prototype : fun [L2D_BUTTON ObjBitmap] I

Parameters
L2D_BUTTON: a button object
ObjBitmap: a bitmap object. Can be nil, in this case, the old bitmap is destroyed).
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
Remarks
If a bitmap can be created from the given read reference file, its size will be set automatically. The developper can be modified it by using 'lib2d_butSetBitmapSize'.
See Also
lib2d_butSetBitmapSize
lib2d_butGetBitmap ( strBut  )

Return the bitmap object to a button object.

Prototype : fun [L2D_BUTTON] ObjBitmap

Parameters
L2D_BUTTON: a button object
Returns
ObjBitmap : the bitmap object if success or nil if an error occurs
Remarks
The return will be nil if no bitmap defined to this button object.
lib2d_butSetTitle ( strBut  ,
szTitle   
)

Set a title to a button object.

Prototype : fun [L2D_BUTTON S] I

Parameters
L2D_BUTTON: a button object
S: a title. Can be nil, if no title needed.
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
lib2d_butGetTitle ( strBut  )

Return the title to a button object.

Prototype : fun [L2D_BUTTON] S

Parameters
L2D_BUTTON: a button object
Returns
S : the title if success or nil if an error occurs
Remarks
The return will be nil if no title defined to this button object.
lib2d_butSetMother ( strBut  ,
mother   
)

Set the mother window to a button object.

If the mother is not nil, the button will be built inside it. If the mother is nil, the type of button must be L2D_BUTTON_WINDOW.

Prototype : fun [L2D_BUTTON ObjWin] I

Parameters
L2D_BUTTON: a button object
ObjWin: a mother window object. Can be nil, if you know really what you do.
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
  • 2 : the mother is nil and the type of the button is not L2D_BUTTON_WINDOW
lib2d_butSetType ( strBut  ,
iType   
)

Set the type to a button object.

Prototype : fun [L2D_BUTTON I] I

Parameters
L2D_BUTTON: a button object
I: a type, one of these values :
  • L2D_BUTTON_WINDOW : the button will be built in a child window. It can be used and customized after
  • L2D_BUTTON_BUTTON : the built button is a classical button
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
  • 2 : the given type is incorrect
lib2d_butGetType ( strBut  )

Return the type of a button object.

Prototype : fun [L2D_BUTTON] I

Parameters
L2D_BUTTON: a button object
Returns
I : the type if success or nil if an error occurs
lib2d_butSetFont ( strBut  ,
oFont   
)

Set the used font to a button object.

Prototype : fun [L2D_BUTTON ObjFont] I

Parameters
L2D_BUTTON: a button object
ObjFont: a font. If nil, a default font will be set.
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
  • 2 : no font to set (even the default font)
lib2d_butGetFont ( strBut  )

Return the useed font of a button object.

Prototype : fun [L2D_BUTTON] ObjFont

Parameters
L2D_BUTTON: a button object
Returns
ObjFont : the font if success or nil if an error occurs
Remarks
The return will be nil if no font defined to this button object.
lib2d_butSetCbDrop ( strBut  ,
cb   
)

Define the "drop files" callback to a button object.

Prototype : fun [L2D_BUTTON fun [L2D_BUTTON [P r1]] I] I

Parameters
L2D_BUTTON: a button object
fun[L2D_BUTTON [P r1]] I : callback. Can be nil (in this case, the event will be ignored).
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
lib2d_butGetCbDrop ( strBut  )

Get the "drop files" callback to a button object.

Prototype : fun [L2D_BUTTON] fun [L2D_BUTTON [P r1] I

Parameters
L2D_BUTTON: a button object
Returns
fun [L2D_BUTTON [P r1]] I : the callback if success or nil if an error occurs
Remarks
The return will be nil if no callback defined to this button object.
lib2d_butSetSize ( strBut  ,
width  ,
height   
)

Set the size of a button object.

Prototype : fun [L2D_BUTTON I I] I

Parameters
L2D_BUTTON: a button object
I: the width. Can be nil, in this case, the old value is kept.
I: the height. Can be nil, in this case, the old value is kept.
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
  • 2 : the given values are nil
  • (-1) : the width is nil, it is kept, the height is set
  • (-2) : the height is nil, it is kept, the width is set
lib2d_butGetSize ( strBut  )

Get the size of a button object.

Prototype : fun [L2D_BUTTON] [I I]

Parameters
L2D_BUTTON: a button object
Returns
[I I] : the size if success or nil if an error occurs.
lib2d_butSetPos ( strBut  ,
,
 
)

Set the position of a button object.

Prototype : fun [L2D_BUTTON I I] I

Parameters
L2D_BUTTON: a button object
I: the x coordinate. Can be nil, in this case, the old value is kept.
I: the y coordinate. Can be nil, in this case, the old value is kept.
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
  • 2 : the given values are nil
  • (-1) : the x coordinate is nil, it is kept, the y coordinate is set
  • (-2) : the y coordinate is nil, it is kept, the x coordinate is set
lib2d_butGetPos ( strBut  )

Get the position of a button object.

Prototype : fun [L2D_BUTTON] [I I]

Parameters
L2D_BUTTON: a button object
Returns
[I I] : the position if success or nil if an error occurs.
lib2d_butSetBitmapSize ( strBut  ,
width  ,
height   
)

Set the bitmap size of a button object.

Prototype : fun [L2D_BUTTON I I] I

Parameters
L2D_BUTTON: a button object
I: the width. Can be nil, in this case, the old value is kept.
I: the height. Can be nil, in this case, the old value is kept.
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
  • 2 : the given values are nil
  • (-1) : the width is nil, it is kept, the height is set
  • (-2) : the height is nil, it is kept, the width is set
lib2d_butGetBitmapSize ( strBut  )

Get the bitmap size of a button object.

Prototype : fun [L2D_BUTTON] [I I]

Parameters
L2D_BUTTON: a button object
Returns
[I I] : the size if success or nil if an error occurs (this size can be nil itself).
lib2d_butSetBitmapPos ( strBut  ,
,
 
)

Set the bitmap position of a button object.

Prototype : fun [L2D_BUTTON I I] I

Parameters
L2D_BUTTON: a button object
I: the x coordinate. Can be nil, in this case, the old value is kept.
I: the y coordinate. Can be nil, in this case, the old value is kept.
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
  • 2 : the given values are nil
  • (-1) : the x coordinate is nil, it is kept, the y coordinate is set
  • (-2) : the y coordinate is nil, it is kept, the x coordinate is set
lib2d_butGetBitmapPos ( strBut  )

Get the bitmap position of a button object.

Prototype : fun [L2D_BUTTON] [I I]

Parameters
L2D_BUTTON: a button object
Returns
[I I] : the position if success or nil if an error occurs.
lib2s_butSetTextPos ( strBut  ,
pos  ,
ref   
)

From the bitmap, set the text position of a button object. If it is no bitmap, the position is from the edge of the window.

Prototype : fun [L2D_BUTTON I I] I

Parameters
L2D_BUTTON: a button object
I: the position :
  • L2D_BUTTON_TEXTTOP : centered, above the bitmap if a bitmap is, near the top of the widow else.
  • L2D_BUTTON_TEXTRIGHT : vertically centered, at right of the bitmap if a bitmap is, near the right of the window, else.
  • L2D_BUTTON_TEXTBOTTTOM : centered, below the bitmap if a bitmap is, near the bottom of the widow else.
  • L2D_BUTTON_TEXTLEFT : vertically centered, at left of the bitmap if a bitmap is, near the left of the window, else.
I: the position from the bitmap, if any :
  • L2D_BUTTON_POSABSOLUTE : the given position (below) is relative at the button
  • L2D_BUTTON_POSRELATIVE : the given position (below) is relative at the bitmap
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
  • 2 : the given position is incorrect
lib2s_butGetTextPos ( strBut  )

Get the text position of a button object.

Prototype : fun [L2D_BUTTON] [I I]

Parameters
L2D_BUTTON: a button object
Returns
[I I] : the position if success or nil if an error occurs.
See Also
lib2s_butSetTextPos for more informations about this tuple.
lib2s_butSetSpacing ( strBut  ,
spacing   
)

Set the spacing between the graphical elements.

Prototype : fun [L2D_BUTTON I] I

Parameters
L2D_BUTTON: a button object
I: the spacing to set, in pixels.
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
  • 2 : the given spacing is incorrect
lib2s_butGetSpacing ( strBut  )

Get the spacing between the graphical elements.

Prototype : fun [L2D_BUTTON] I

Parameters
L2D_BUTTON: a button object
Returns
I : the spacing if success or nil if an error occurs.
lib2d_butSetCbClick ( strBut  ,
cb   
)

Set the callback when a 'Click' event occurs.

Prototype : fun [L2D_BUTTON fun [L2D_BUTTON I I I I] I] I

Parameters
L2D_BUTTON: a button object
fun[L2D_BUTTON I I I I] I : the callback. Supplemental arguments are :
  • I : x click coordinate (always nil if type = L2D_BUTTON_BUTTON),
  • I : y click coordinate (always nil if type = L2D_BUTTON_BUTTON),
  • I : mouse buton number (always nil if type = L2D_BUTTON_BUTTON),
  • I : key mask (1 = shift, 2 = control, 4 = alt)
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
lib2d_butSetCbDropfiles ( strBut  ,
cb   
)

Set the callback when a 'Drop files' event occurs.

Prototype : fun [L2D_BUTTON fun [L2D_BUTTON [P r1] I I] I] I

Parameters
L2D_BUTTON: a button object
fun[L2D_BUTTON [P r1] I I] I : the callback. Supplemental arguments are :
  • [P r1] : a list of read-reference files,
  • I : x click coordinate,
  • I : y click coordinate
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
lib2d_butSetCbClose ( strBut  ,
cb   
)

Set the callback when a 'Close' event occurs.

Prototype : fun [L2D_BUTTON fun [L2D_BUTTON I] I] I

Parameters
L2D_BUTTON: a button object
fun[L2D_BUTTON I] I : the callback. Supplemental argument is :
  • I : the result : 0, button closed with success or a positive value if error (see lib2d_butClose to get more informations).
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
lib2d_butSetCbDestroy ( strBut  ,
cb   
)

Set the callback when a 'Destroy' event occurs.

Prototype : fun [L2D_BUTTON fun [I] I] I

Parameters
L2D_BUTTON: a button object
fun[I] I : the callback. The argument is :
  • I : the result : 0, button destroyed with success or a positive value if error (see lib2d_butDestroy to get more informations).
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
lib2d_butGetCbClick ( strBut  )

Get the "Click" event callback to a button object.

Prototype : fun [L2D_BUTTON] fun [L2D_BUTTON I I I I] I

Parameters
L2D_BUTTON: a button object
Returns
fun [L2D_BUTTON I I I I] I : the callback if success or nil if an error occurs
Remarks
The return will be nil if no callback defined to this button object.
lib2d_butGetCbDropfiles ( strBut  )

Get the "Drop files" event callback to a button object.

Prototype : fun [L2D_BUTTON] fun [L2D_BUTTON [P r1] I I] I

Parameters
L2D_BUTTON: a button object
Returns
fun [L2D_BUTTON [P r1] I I] I : the callback if success or nil if an error occurs
Remarks
The return will be nil if no callback defined to this button object.
lib2d_butGetCbClose ( strBut  )

Get the "Close" event callback to a button object.

Prototype : fun [L2D_BUTTON] fun [L2D_BUTTON I] I

Parameters
L2D_BUTTON: a button object
Returns
fun [L2D_BUTTON I] I : the callback if success or nil if an error occurs
Remarks
The return will be nil if no callback defined to this button object.
lib2d_butGetCbDestroy ( strBut  )

Get the "Destroy" event callback to a button object.

Prototype : fun [L2D_BUTTON] fun [I] I

Parameters
L2D_BUTTON: a button object
Returns
fun [I] I : the callback if success or nil if an error occurs
Remarks
The return will be nil if no callback defined to this button object.
lib2d_butGetMother ( strBut  )

Get the mother window.

Prototype : fun [L2D_BUTTON] ObjWin

Parameters
L2D_BUTTON: a button object
Returns
ObjWin : the mother window if success or nil if an error occurs
Remarks
The return will be nil if no mother defined !
lib2d_butSetBgColor ( strBut  ,
color   
)

Set the background color.

Prototype : fun [L2D_BUTTON I] I

Parameters
L2D_BUTTON: a button object
I: the 24-bits color (0 (black) -> 0xFFFFFF (white))
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
lib2d_butGetBgColor ( strBut  )

Retreive the background color.

Prototype : fun [L2D_BUTTON] I

Parameters
L2D_BUTTON: a button object
Returns
I : this color if success or nil if error
lib2d_butSetFoColor ( strBut  ,
color   
)

Set the foreground color, i.e. the title color.

Prototype : fun [L2D_BUTTON I] I

Parameters
L2D_BUTTON: a button object
I: the 24-bits color (0 (black) -> 0xFFFFFF (white))
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
lib2d_butGetFoColor ( strBut  )

Retreive the foreground (title) color.

Prototype : fun [L2D_BUTTON] I

Parameters
L2D_BUTTON: a button object
Returns
I : this color if success or nil if error
lib2d_butSetBgParams ( strBut  ,
,
fullbg  ,
border  ,
sizeborder   
)

Set the background parameters of the button.

Prototype : fun [L2D_BUTTON I I I I] I

Parameters
L2D_BUTTON: a button object
I: define if the background must be drawn :
  • L2D_BUTTON_ENABLE : yes (default),
  • L2D_BUTTON_DISABLE : no.
I: define if the background (except the border) must be drawn :
  • L2D_BUTTON_ENABLE : yes (default),
  • L2D_BUTTON_DISABLE : no.
I: define if the border must be drawn :
  • L2D_BUTTON_ENABLE : yes (default),
  • L2D_BUTTON_DISABLE : no.
I: define the size of the border, in pixels (>= 0, 1 is the default value)
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
lib2d_butGetBgParams ( strBut  )

Get the background parameters of the button.

Prototype : fun [L2D_BUTTON] [I I I I]

Parameters
L2D_BUTTON: a button object
Returns
[I I I I] : these parameters if success or nil if error
See Also
lib2d_butSetBgParams
lib2d_butSetWinFlag ( strBut  ,
flags   
)

Set the flags of the window button.

Prototype : fun [L2D_BUTTON I] I

This has an effect with L2D_BUTTON_WINDOW type only (see 'lib2d_butSetType'). For another type, these flags are ignored.

When the build step is, if a mother window is defined (this case is the mostly current), the flag 'WN_CHILDINSIDE' is automatically added. If no mother window set, the flags 'WN_NOCAPTION|WN_MENU' are automatically added.

Parameters
L2D_BUTTON: a button object
I: a flag or a combination of flags. The available values are the same than _CRwindow ( http://www.scolring.org/files/doc_html/_crwindow.html ). Example : WN_DOWN
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
lib2d_butGetWinFlag ( strBut  )

Get the flags of the window button.

Prototype : fun [L2D_BUTTON] I

Parameters
L2D_BUTTON: a button object
Returns
I : these parameters if success or nil if error or not defined
See Also
lib2d_butSetWinFlag
lib2d_butEnable ( strBut  )

Enable (show) a button.

Prototype : fun [L2D_BUTTON] I

Parameters
L2D_BUTTON: a button object
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
  • 2 : the button has a bad type
lib2d_butDisable ( strBut  )

Disable (hide) a button.

Prototype : fun [L2D_BUTTON] I

Parameters
L2D_BUTTON: a button object
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
  • 2 : the button has a bad type
lib2d_butIsEnabled ( strBut  )

Return if a button is shown or hidden (enabled / disabled).

Prototype : fun [L2D_BUTTON] I

Parameters
L2D_BUTTON: a button object
Returns
I : this state (L2D_BUTTON_ENABLE or L2D_BUTTON_DISABLE) if success or nil if error or not defined
See Also
lib2d_butSetWinFlag
lib2d_butBuild ( strBut  )

Build the button.

Prototype : fun [L2D_BUTTON] I

Parameters
L2D_BUTTON: a button object. It should be set before use this function.
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
  • 2 : no bitmap nor title is set. Thus, nothing to build !
  • 3 : one or more needed parameters are nil (all set* functions are not needed, according to what you want)
  • 4 : if L2D_BUTTON_WINDOW is set, unable to create the window
  • 5 : if L2D_BUTTON_BUTTON is set, the mother window object is set to nil
  • 6 : if L2D_BUTTON_BUTTON is set, unable to create the button
  • 7 : a bad type is set
lib2d_butClose ( strBut  )

Close a button.

Prototype : fun [L2D_BUTTON] I

When this function is called, the button (window or button) is destroyed itself but the structure is kept. The structure can be reused to build the same object or it can be modified to build another object. If a full destruction is needed, see lib2d_butDestroy.

The 'Close' callback will be ran.

Parameters
L2D_BUTTON: a button object.
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
  • 2 : internal error (this case should n't occur)
lib2d_butDestroy ( strBut  )

Destroy a button.

Prototype : fun [L2D_BUTTON] I

When this function is called, the button is destroyed and and its structure is at nil (all parameters are nil). To close the button only, see lib2d_butClose.

The 'Destroy' callback will be ran.

Parameters
L2D_BUTTON: a button object.
Returns
I : 0 if success or a positive value if an error occurs :
  • 1 : the button object is nil
  • 2 : internal error (this case should n't occur)