Project

General

Profile

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

Classes

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

Functions

 _ADDcheckList (cl, iLevel, isRadio, isLeft, szTitle, iflags)
 Add a check box object in a CheckList object to a given level.
 _APPENDcheckList (cl, isRadio, isLeft, szTitle, iflags)
 Append a check box object in a CheckList object.
 _CBcheckListChanged (cl, cbfun)
 Define the callback to the state changed event.
 _CBcheckListDestroy (cl, cbfun, uparam)
 Define the callback to the destroy event.
 _CBcheckListMove (cl, cbfun, uparam)
 Define the callback to the move event.
 _CBcheckListPaint (cl, cbfun, uparam)
 Define the callback to the paint event.
 _CBcheckListSize (cl, cbfun, uparam)
 Define the callback to the resize event.
 _CBcheckListSubSize (cl, cbfun)
 Define the callback to the resize event.
 _CHECKcheckListId (cl, iCoId)
 Return if an indetifier of a check box controls in a CheckList object exists or not.
 _CRcheckList (chn, parent, width, height, withScroll)
 Create an empty CheckList object.
 _DScheckList (cl)
 Destroy a CheckList object.
 _EXCHANGEcheckList (cl, iCoId1, iCoId2)
 Exchange the positions of two check box controls in a CheckList object.
 _GETcheckListCheckedList (cl)
 Get a list of all checked subcontrols in a CheckList object.
 _GETcheckListCount (cl)
 Get the number check box controls in a CheckList object.
 _GETcheckListFont (cl)
 Get the current font object used in a CheckList object.
 _GETcheckListHeight (cl, iHeight)
 Get the current subcontrol height in a CheckList object.
 _GETcheckListIdFromLevel (cl, iCoId)
 From a level, get the ID of a check box subcontrol in a CheckList object.
 _GETcheckListIds (cl)
 Get the list of indentifers of all check box controls in a CheckList object.
 _GETcheckListLevel (cl, iCoId)
 Get the current level of a subcontrol in a CheckList object.
 _GETcheckListShow (cl, iCoId)
 Get the visibility of a check box control in a CheckList object.
 _GETcheckListSpacing (cl)
 Get the current spacing between subcontrols in a CheckList object.
 _GETcheckListState (cl, iCoId)
 Get the current state of a check box control in a CheckList object.
 _GETcheckListTitle (cl, iCoId)
 Get the title of a check box control in a CheckList object.
 _GETcheckListUncheckedList (cl)
 Get a list of all unchecked subcontrols in a CheckList object.
 _GETcheckListWidth (cl, iHeight)
 Get the current subcontrol width in a CheckList object.
 _MOVEcheckList (cl, newx, newy)
 Move a CheckList object from its parent window or the desktop.
 _REMOVEcheckList (cl, iCoId)
 Remove a check box subcontrol in a CheckList object.
 _SETcheckList (cl, iCoId, iState, szTitle, iShown)
 Set a check box control settings.
 _SETcheckListFont (cl, oFont)
 Set the font object used in a CheckList object.
 _SETcheckListHeight (cl, iHeight)
 Set the height of the check box controls in a CheckList object.
 _SETcheckListShow (cl, iCoId, iShown)
 Set the visibility of a check box control in a CheckList object.
 _SETcheckListSpacing (cl, iSpacing)
 Set the spacing between check box controls in a CheckList object.
 _SETcheckListState (cl, iCoId, iState)
 Set the state of a check box control in a CheckList object.
 _SETcheckListTitle (cl, iCoId, szTitle)
 Set the title of a check box control in a CheckList object.
 _SETcheckListWidth (cl, iWidth)
 Set the width of the check box controls in a CheckList object.
 _SIZEcheckList (cl, neww, newh)
 Resize a CheckList object from its parent window or the desktop.
 CL_CHECK ()
 Constante to create a check box control.
 CL_DOWN ()
 Constante to display a 3d border around the control.
 CL_HIDE ()
 Constante to hide the control.
 CL_NOSCROLL ()
 Constante to create a control without scroll bar.
 CL_RADIO ()
 Constante to create a radio box control.
 CL_SCROLL ()
 Constante to add a vertical scroll bar.
 CL_SHOW ()
 Constante to show the contol.

Detailed Description

A checkList is a serie of check and/or radio boxes in an unique Scol object.

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

checklist.png

Function Documentation

CL_RADIO ( )

Constante to create a radio box control.

All such sub controls in a CheckList object are dependants : if one is checked, all others are unchecked.

CL_CHECK ( )

Constante to create a check box control.

Several subcontrol can be checked/unchecked in the same time.

_CRcheckList ( chn  ,
parent  ,
width  ,
height  ,
withScroll   
)

Create an empty CheckList object.

A checkList allows to add, remove and modify a list of check boxes.

To (re)define the position from the parent window or the desktop, use _MOVEcheckList.

Prototype : fun [Chn ObjWin I I I] CheckList

Parameters
Chn: the channel where the checkList is created
ObjWin: the parent window (can be nil)
I: the width
I: the height
I: define if this object has a vertical scroll bar (CL_SCROLL) or not (CL_NOSCROLL). This parameter can not be modified after.
Returns
CheckList : The new CheckList object or nil if an error occurs (null channel or bad settings)
See Also
_MOVEcheckList
_ADDcheckList to add a check control
_DScheckList ( cl  )

Destroy a CheckList object.

All included check controls will be also destroyed.

Prototype : fun [CheckList] I

Parameters
CheckList: a CheckList object
Returns
I : always 0
_MOVEcheckList ( cl  ,
newx  ,
newy   
)

Move a CheckList object from its parent window or the desktop.

Prototype : fun [CheckList I I] CheckList

Parameters
CheckList: a CheckList object
I: the new x coordinate. Can not be nil.
I: the new y coordinate. Can not be nil.
Returns
CheckList : the same CheckList object or nil if an error occurs.
_SIZEcheckList ( cl  ,
neww  ,
newh   
)

Resize a CheckList object from its parent window or the desktop.

Exactly, it resizes the visible part of the CheckList control (if the control has a vertical scroll bar, for example. If not, the function resizes the control itself).

All the subcontrols (included check controls) are also resized (in their width only).

Prototype : fun [CheckList I I] CheckList

Parameters
CheckList: a CheckList object
I: the new width >= 1. Can not be nil.
I: the new height >= 1. Can not be nil.
Returns
CheckList : the same CheckList object or nil if an error occurs.
See Also
_SETcheckListHeight to define the height of each included subcontrol.
_APPENDcheckList ( cl  ,
isRadio  ,
isLeft  ,
szTitle  ,
iflags   
)

Append a check box object in a CheckList object.

The subcontrol is unchecked by default.

If the CheckList has not a scroll bar, the new subcontrol could be outside. If the CheckList has a scroll bar, its height is automatically updated.

Prototype : fun [CheckList I I S I] I

Parameters
CheckList: a CheckList object
I: subcontrol style : CL_RADIO or CL_CHECK
I: 1 to display the title a the left side of the box else 0 (default)
S: the title
I: a flag : 0 (nothing) or CL_DOWN
Returns
I : the subcontrol identifier or nil if an error occurs. This ID allows to manage this subcontrol from this API.
See Also
CL_DOWN
CL_RADIO
CL_CHECK
_SETcheckListState
_GETcheckListIdFromLevel
_ADDcheckList ( cl  ,
iLevel  ,
isRadio  ,
isLeft  ,
szTitle  ,
iflags   
)

Add a check box object in a CheckList object to a given level.

The subcontrol is unchecked by default.

If the CheckList has not a scroll bar, the new subcontrol could be outside. If the CheckList has a scroll bar, its height is automatically updated.

Prototype : fun [CheckList I I S I] I

Parameters
CheckList: a CheckList object
I: the level (the position) in the CheckList control (first = 0)
I: subcontrol style : CL_RADIO or CL_CHECK
I: 1 to display the title a the left side of the box else 0 (default)
S: the title
I: a flag : 0 (nothing) or CL_DOWN
Returns
I : the identifier of the new subcontrol or nil if an error occurs. This ID allows to manage this subcontrol from this API.
See Also
CL_DOWN
CL_RADIO
CL_CHECK
_SETcheckListState
_GETcheckListIdFromLevel
_REMOVEcheckList ( cl  ,
iCoId   
)

Remove a check box subcontrol in a CheckList object.

Other following subcontrols are automatically moved to replace the empty space.

If the CheckList has a scroll bar, its height is automatically updated.

Prototype : fun [CheckList I] CheckList

Parameters
CheckList: a CheckList object
I: the subcontrol ID to remove
Returns
CheckList : the same CheckList object or nil if an error occurs.
_GETcheckListIdFromLevel ( cl  ,
iCoId   
)

From a level, get the ID of a check box subcontrol in a CheckList object.

Prototype : fun [CheckList I] I

Parameters
CheckList: a CheckList object
I: the subcontrol level. A level is the position in the vertical list. The first level is 0 (so the first subcontrol (at the top of the list) is 0).
Returns
I : the ID or nil if an error occurs (typically, a bad level).
See Also
_GETcheckListLevel to get the level from the ID.
_SETcheckList ( cl  ,
iCoId  ,
iState  ,
szTitle  ,
iShown   
)

Set a check box control settings.

Prototype : fun [CheckList I I S I] CheckList

Parameters
CheckList: a CheckList object
I: the subcontrol ID to set
I: 1 to check the subcontrol, 0 to uncheck it (other values are ignored)
S: the title
I: the visibility : CL_SHOW or CL_HIDE (other values are ignored)
Returns
CheckList : the same CheckList object or nil if an error occurs (typically, a bad identifier).
See Also
CL_SHOW
CL_HIDE
_SETcheckListTitle ( cl  ,
iCoId  ,
szTitle   
)

Set the title of a check box control in a CheckList object.

Prototype : fun [CheckList I S] CheckList

Parameters
CheckList: a CheckList object
I: the subcontrol ID to set
S: the title
Returns
CheckList : the same CheckList object or nil if an error occurs (typically, a bad identifier).
_SETcheckListState ( cl  ,
iCoId  ,
iState   
)

Set the state of a check box control in a CheckList object.

Prototype : fun [CheckList I I] CheckList

Parameters
CheckList: a CheckList object
I: the subcontrol ID to set
I: the new state : 1 to check the subcontrol, 0 to uncheck it (other values are ignored)
Returns
CheckList : the same CheckList object or nil if an error occurs (typically, a bad identifier).
_SETcheckListShow ( cl  ,
iCoId  ,
iShown   
)

Set the visibility of a check box control in a CheckList object.

Prototype : fun [CheckList I I] CheckList

Parameters
CheckList: a CheckList object
I: the subcontrol ID to set
I: the visibility : CL_SHOW or CL_HIDE (other values are ignored)
Returns
CheckList : the same CheckList object or nil if an error occurs (typically, a bad identifier).
See Also
CL_SHOW
CL_HIDE
_GETcheckListTitle ( cl  ,
iCoId   
)

Get the title of a check box control in a CheckList object.

Prototype : fun [CheckList I] S

Parameters
CheckList: a CheckList object
I: the subcontrol ID
Returns
S : the current title or nil if an error occurs (typically, a bad identifier).
_GETcheckListShow ( cl  ,
iCoId   
)

Get the visibility of a check box control in a CheckList object.

Prototype : fun [CheckList I] I

Parameters
CheckList: a CheckList object
I: the subcontrol ID
Returns
I : the current visibility (CL_SHOW or CL_HIDE) or nil if an error occurs (typically, a bad identifier).
_GETcheckListState ( cl  ,
iCoId   
)

Get the current state of a check box control in a CheckList object.

Prototype : fun [CheckList I] I

Parameters
CheckList: a CheckList object
I: the subcontrol ID
Returns
I : the current state (1 checked, 0 unchecked) or nil if an error occurs (typically, a bad identifier).
_EXCHANGEcheckList ( cl  ,
iCoId1  ,
iCoId2   
)

Exchange the positions of two check box controls in a CheckList object.

Prototype : fun [CheckList I I] CheckList

Parameters
CheckList: a CheckList object
I: the first subcontrol ID
I: the second subcontrol ID
Returns
CheckList : the same CheckList object or nil if an error occurs (typically, a bad identifier).
_GETcheckListIds ( cl  )

Get the list of indentifers of all check box controls in a CheckList object.

Prototype : fun [CheckList] [I r1]

Parameters
CheckList: a CheckList object
Returns
[I r1] : the list of identifiers
_CHECKcheckListId ( cl  ,
iCoId   
)

Return if an indetifier of a check box controls in a CheckList object exists or not.

Prototype : fun [CheckList I] I

Parameters
CheckList: a CheckList object
I: an ID
Returns
I : 1 if exists else 0
_GETcheckListCount ( cl  )

Get the number check box controls in a CheckList object.

Prototype : fun [CheckList] I

Parameters
CheckList: a CheckList object
Returns
I : the number of subcontrols
_SETcheckListSpacing ( cl  ,
iSpacing   
)

Set the spacing between check box controls in a CheckList object.

If the CheckList control has a scroll bar, its height is automatically updated.

Prototype : fun [CheckList I] CheckList

Parameters
CheckList: a CheckList object
I: the spacing, in pixel
Returns
CheckList : the same CheckList object or nil if an error occurs
_GETcheckListSpacing ( cl  )

Get the current spacing between subcontrols in a CheckList object.

Prototype : fun [CheckList] I

Parameters
CheckList: a CheckList object
Returns
I : the current spacing
_SETcheckListHeight ( cl  ,
iHeight   
)

Set the height of the check box controls in a CheckList object.

If the CheckList control has a scroll bar, its total height is automatically updated.

Prototype : fun [CheckList I] CheckList

Parameters
CheckList: a CheckList object
I: the new height, in pixel
Returns
CheckList : the same CheckList object or nil if an error occurs
See Also
_SIZEcheckList to resize the CheckList control itself
_GETcheckListHeight ( cl  ,
iHeight   
)

Get the current subcontrol height in a CheckList object.

Prototype : fun [CheckList] I

Parameters
CheckList: a CheckList object
Returns
I : the current height of each subcontrol
_SETcheckListWidth ( cl  ,
iWidth   
)

Set the width of the check box controls in a CheckList object.

The CheckList control is NOT resized if the new width is lesser. It is greater than the current CheckList control width, the CheckList control is resized. In this case, the new CheckList control width is the new subcontrol width + two spacing (at the left and the right).

Prototype : fun [CheckList I] CheckList

Parameters
CheckList: a CheckList object
I: the new width, in pixel
Returns
CheckList : the same CheckList object or nil if an error occurs
See Also
_SIZEcheckList to resize the CheckList control itself
_GETcheckListWidth ( cl  ,
iHeight   
)

Get the current subcontrol width in a CheckList object.

Prototype : fun [CheckList] I

Parameters
CheckList: a CheckList object
Returns
I : the current width of each subcontrol
_SETcheckListFont ( cl  ,
oFont   
)

Set the font object used in a CheckList object.

Prototype : fun [CheckList ObjFont] CheckList

Parameters
CheckList: a CheckList object
ObjFont: the new font object
Returns
CheckList : the same CheckList object or nil if an error occurs
_GETcheckListFont ( cl  )

Get the current font object used in a CheckList object.

Prototype : fun [CheckList] ObjFont

Parameters
CheckList: a CheckList object
Returns
ObjFont : the current font if _SETcheckListFont has been set or the default font if _SETdefaultFont has been previously set or nil if the default system font is used.
_GETcheckListLevel ( cl  ,
iCoId   
)

Get the current level of a subcontrol in a CheckList object.

A level gives the position of the subcontrol in the CheckList.

Prototype : fun [CheckList I] ObjFont

Parameters
CheckList: a CheckList object
I: an ID subcontrol
Returns
I : the current position of the subcontrol (0 is the first subcontrol) or nil if an error occurs.
See Also
_EXCHANGEcheckList to move this position
_GETcheckListCheckedList ( cl  )

Get a list of all checked subcontrols in a CheckList object.

Prototype : fun [CheckList] [[I I] r1]

Parameters
CheckList: a CheckList object
Returns
[[I I] r1] : a list of tuples. For each tuple : first is the ID subcontrol, second is the level subcontrol. Or nil if an error occurs.

A level gives the position of the subcontrol in the CheckList.

_GETcheckListUncheckedList ( cl  )

Get a list of all unchecked subcontrols in a CheckList object.

Prototype : fun [CheckList] [[I I] r1]

Parameters
CheckList: a CheckList object
Returns
[[I I] r1] : a list of tuples. For each tuple : first is the ID subcontrol, second is the level subcontrol. Or nil if an error occurs.

A level gives the position of the subcontrol in the CheckList.

_CBcheckListSize ( cl  ,
cbfun  ,
uparam   
)

Define the callback to the resize event.

When the CheckList control is resized, the defined reflex will be called.

Prototype : fun [CheckList fun [CheckList u0 I I] I u0] CheckList

Parameters
CheckList: a CheckList object
fun[CheckList u0 I I] I : the callback. Additional argument are the new width and the new height
u0: an user parameter, at your convenience
Returns
CheckList : the same CheckList object or nil if an error occurs
_CBcheckListSubSize ( cl  ,
cbfun   
)

Define the callback to the resize event.

When the check box subcontrols are resized, the defined reflex will be called.

Prototype : fun [CheckList fun [CheckList I I] I] CheckList

Parameters
CheckList: a CheckList object
fun[CheckList I I] I : the callback. Additional argument are the new width and the new height

To set an 'use parameter', you should add a mkfun3 function ...

Returns
CheckList : the same CheckList object or nil if an error occurs
_CBcheckListMove ( cl  ,
cbfun  ,
uparam   
)

Define the callback to the move event.

When the CheckList control moves, the defined reflex will be called.

Prototype : fun [CheckList fun [CheckList u0 I I] I u0] CheckList

Parameters
CheckList: a CheckList object
fun[CheckList u0 I I] I : the callback. Additional argument are the new x and y coordinates
u0: an user parameter, at your convenience
Returns
CheckList : the same CheckList object or nil if an error occurs
_CBcheckListDestroy ( cl  ,
cbfun  ,
uparam   
)

Define the callback to the destroy event.

When the CheckList control is destroyed, the defined reflex will be called.

Prototype : fun [CheckList fun [CheckList u0] I u0] CheckList

Parameters
CheckList: a CheckList object
fun[CheckList u0] I : the callback.
u0: an user parameter, at your convenience
Returns
CheckList : the same CheckList object or nil if an error occurs
_CBcheckListPaint ( cl  ,
cbfun  ,
uparam   
)

Define the callback to the paint event.

When the CheckList control is painted, the defined reflex will be called.

Prototype : fun [CheckList fun [CheckList u0] I u0] CheckList

Parameters
CheckList: a CheckList object
fun[CheckList u0] I : the callback.
u0: an user parameter, at your convenience
Returns
CheckList : the same CheckList object or nil if an error occurs
_CBcheckListChanged ( cl  ,
cbfun   
)

Define the callback to the state changed event.

When the state of a check box subcontrols changes, the defined reflex will be called.

Prototype : fun [CheckList fun [CheckList I I] I] CheckList

Parameters
CheckList: a CheckList object
fun[CheckList I I] I : the callback. Additional argument are the ID of subcontrol and its new state

To set an 'use parameter', you should add a mkfun3 function ...

Returns
CheckList : the same CheckList object or nil if an error occurs