
It is important for the contents of a widget to reflect the visual characteristics that are to be displayed in the cell before the cell that contains the widget is drawn. EditTable will automatically set the cell resources listed below on the widget if the constraint resource XmNcellWidgetSetResources is set to True. This occurs before the XmNcellWidgetDisplayCallback callback is called.
| Resource Name | Automatic Setting |
|---|---|
| XmNlabelString | Current cell content, as a string. |
| XmNfontList | Current cell font. |
| XmNbackground | Current cell background. |
| XmNforeground | Current cell foreground. |
| XmNalignment | Current cell alignment. |
| XmNsensitive | Current cell sensitivity. |
The values of these resources are available in the callback structure XintEditTableCellWidgetCallbackStruct. If XmNcellWidgetSetResources is False, or it is necessary to change one or more values, this can be done in the callback. The callback also permits other widget resources, which are not in the list above, to be set.
If XmNcellWidgetSetResources is False and XmNcellWidgetDisplayCallback is not called, the visual characteristics of the cells will be undefined!
In most applications it will be sufficient to set XmNcellWidgetSetResources to True and omit the XmNcellWidgetDisplayCallback. The ToggleButton widget is an example of an instance where XmNcellWidgetDisplayCallback is necessary in order to get information about the cell state to use in setting the XmNset resource.
Due to the power and speed of the Widget in a Cell mechanism, The XmString data type (to enable internationalization of the interface application) is easily supported. This is accomplished by specifying a Motif Label widget across a range of cells.
Constraint resource XmNcellWidgetOverrideTranslations allows the programmer to determine the focus for navigation events when the widget is mapped to the table. If set to True, arrows and tab keys take you back to the table process rather than remaining in the mapped widget. The XintEditTableGetCellWidget convenience function may be used to get the widget associated with a particular cell location.
Because the Widget in a Cell mechanism associates a range of cells with a single widget, a callback that is attached to the widget will be called as long as the current location is within that range. It is usually important to know the specific table location associated with any user event. For this purpose, the XintEditTableGetCellPointerPosition function should be used to return the table location of the cell pointer.