Next | Prev | Up | Top | Contents | Index

Callback Substitution

When Motif executes a callback in reaction to some event, it provides some parameters (such as the current widget) or additional data relevant to a given class. Tm follows Tk in providing the powerful mechanism of callback substitution. Before execution, the Tcl command list is scanned to look for the % character. Each time this character is found, the word that follows is extracted, analyzed, and if recognized, replaced with the corresponding data.

For example, %item in an xmList callback is replaced by the item selected, whereas %item_position is replaced by its position in the list. This is an example of callback substitution in a list:

.list singleSelectionCallback
    { print_info %item %item_position }
proc print_info item position
    { puts stdout "item was $item, at position $position" }
The following list shows the recognized tags. Their meaning is detailed below in the context of the corresponding callbacks.

%click_count%endPos%newinsert%selection_type
%closure%item_length%pattern_Length%set
%currInsert%item_position%pattern_length%startPos
%currinsert%item%Pattern%type
%dir_length%length%pattern%value_length
%dir%mask_length%ptr%value
%doit%mask%reason%w
%dragContext%newInsert%selected_items 

The following list contains the possible callback reasons, as defined in <Xm/Xm.h> (but with the leading XmCR_ removed):

activateapplyarm
browse_selectcancelcascading
clipboard_data_deleteclipboard_data_requestcommand_changed
command_enteredcreatedecrement
default_actiondisarmdrag
executeexposeextended_select
focusgain_primaryhelp
incrementinputlose_primary
losing_focusmapmodifying_text_value
moving_insert_cursormultiple_selectno_match
noneobscured_traversalok
page_decrementpage_incrementprotocols
resizesingle_selecttear_off_activate
tear_off_deactivateto_bottomto_top
unmapvalue_changed 


Next | Prev | Up | Top | Contents | Index