Callbacks
Actions the user performs on the table widget may need to be communicated back to the application utilizing the table. Callbacks allow for this communication. This section lists the names of the callbacks and the type of call data passed.
XmNactivateCallback
Callback reason: XmCRACTIVATE
Calldata structure: CwTableItemCallbackData
Description:
This is called when the table is activated.
 
XmNcolumnClickCallback
Callback reason: XmCRACTIVATE
Calldata structure: CwTableItemCallbackData
Description:
This is called when an column in the table is clicked .
 
XmNdrawCallback
Callback reason: XmCRAPPLY
Calldata structure: CwTableItemDrawCallbackData
Description:
This is called the table is exposed or or any cells are redrawing..
 
XmNdrawHeaderCallback
Callback reason: XmCRAPPLY
Calldata structure: CwTableItemDrawCallbackData
Description:
This is called when a header in the table or any cells are redrawn.
 
XmNeditCallback
Callback reason: XmCRARM, XmCRDISARM
Calldata structure: CwTableItemCallbackData
Description:
This is called when cell is edited. Reason for arming and disarming are beginEdit and endEdit respectively.
 
XmNfindCallback
Callback reason: XmCRNOMATCH
Calldata structure: CwTableItemCallbackData
Description:
This is called when in response to a CwTable>>#findItem:text or CwTable>>#findItem:text:partial: request.
 
XmNmodifyVerifyCallback
Callback reason: XmCRVALUECHANGED, XmCRMODIFYINGTEXTVALUE
Calldata structure: CwTableItemCallbackData, CwTextVerifyCallbackData
Description:
This is called before text is deleted from or inserted into the entry field. The object passed to this callback is CwTextVerifyCallbackData. The reason sent by the callback is XmCRMODIFYINGTEXTVALUE.
 
XmNmultipleSelectionCallback
Callback reason: XmCRMULTISELECT
Calldata structure: CwAnyCallbackData, CwTableItemCallbackData
For range items call:
callData item - index of start item.
callData subItem - index of end item.
callData data = #()
Description:
This is called when an item is selected and the table’s selection policy is set to XmEXTENDEDSELECT.
 
XmNsingleSelectionCallback
Callback reason: XmCRSINGLESELECT, XmCRCELLSINGLESELECT
Calldata structure: CwAnyCallbackData, CwTableItemCallbackData
callData data at: 1 - point of action.
Description:
This is called when an item is selected and the table’s selection policy is set to XmSINGLESELECT or XmEXTENDEDSELECT.
 
XmNvirtualCallback
Callback reason: XmCRICONIFY, XmCRCASCADING
Calldata structure: CwTableItemCallbackData
callData item - index of start item.
callData subItem - index of end item.
Description:
This is called when the receiver has virtualItems set to true and an item is comes into view.
 
Example
 
| shell form widget |
shell := CwTopLevelShell
createApplicationShell: 'CwTableExample'
argBlock: nil.
shell realizeWidget.
form := CwForm createWidget: 'form'
parent: shell
argBlock: [:w | w yourself].
form manageChild.
widget := self form
createScrolledCwTable: 'data_table'
argBlock: [:w | w
selectionPolicy: XmSINGLESELECT. ].
widget manageChild.
 
widget
columns: (OrderedCollection
with: (CwTableColumn new
labelString: 'Column0';
width: 120)
with: (CwTableColumn new
labelString: 'Column1';
width: 120)
);
items: (OrderedCollection new
add: (CwTableItem new labelString: 'Item1') ;
add: (CwTableItem new labelString: 'Item2'; cells: #('sub2-1') );
yourself).
 
widget setValuesBlock: [:w |
w
leftAttachment: XmATTACHFORM;
rightAttachment: XmATTACHFORM;
rightOffset: 10;
topAttachment: XmATTACHFORM;
bottomAttachment: XmATTACHFORM;
bottomOffset: 10;
yourself].
 
 
Last modified date: 12/29/2023