DAVISM@kcgl1.eng.ohio-state.edu (Michael T. Davis) (09/15/89)
I am experiencing a problrm with the callback data structure passed to my callback function for a DECwindows Toolkit (Dwt) List Box widget. I am running DECwindows under VMS 5.1-B on a VAXstation 3100. Here's the List Box set up code: list_box = DwtListBox ( main_window, "Verb List", 18, 38, NULL, 0, 4, NULL, NULL, True, False ); XtAddCallback ( list_box, DwtNsingleCallback, list_callback, NULL ); XtSetArg ( settings [ 0 ], DwtNsingleSelection, True ); XtSetValues ( list_box, settings, 1 ); And here's the callback: void list_callback ( widget, user_data, callback_data ) Widget * widget; caddr_t user_data; DwtListBoxCallbackStruct callback_data; { #ifdef DEBUG printf ( "Item number = %d\nItem Length = %d\n", callback_data. item_number, callback_data. item_length ); #endif if ( callback_data. reason != DwtCRSingle ) return; else { DwtListBoxSelectItem ( widget, callback_data. item, False ); parse_verb ( & callback_data. item_number ); } } The reason member and item_length of the callback data structure always have bogus values in them and the item_number member is always 0. All the structure members stay constant, no matter which item I select with the pointer. Is there something really obvious I am forgetting, or what? Thanks, Mike ________________________________________________________________________ | InterNet> davism@{kcgl1.eng|rcgl1.eng|osu-20.ircc}.ohio-state.edu | | -or- | | davis-m@eng.ohio-state.edu | | CompuServe> 73667,541 | |************************************************************************| | These thoughts, they be mine | ------------------------------------------------------------------------
DAVISM@kcgl1.eng.ohio-state.edu (Michael T. Davis) (09/16/89)
In article <3035@quanta.eng.ohio-state.edu>, I wrote: > > I am experiencing a problrm with the callback data structure passed >to my callback function for a DECwindows Toolkit (Dwt) List Box widget. I >am running DECwindows under VMS 5.1-B on a VAXstation 3100. Here's the >List Box set up code: > >[list box setup deleted] > >And here's the callback: > >void list_callback ( widget, user_data, callback_data ) > Widget * widget; > caddr_t user_data; > DwtListBoxCallbackStruct callback_data; >[body of callback deleted] > >The reason member and item_length of the callback data structure always have >bogus values in them and the item_number member is always 0. All the structure >members stay constant, no matter which item I select with the pointer. Is >there something really obvious I am forgetting, or what? As it turns out, the copy of the DECwindows docs we have lays out the parameters to the callback exactly as I have them above. In fact, the widget should be passed by value and the callback_data should be passed by reference. All is well with the List Box now. But here's another problem... Within the same application, I want to create a Push Button which the user can "press" and activate a callback. Here's the setup code: push_button = DwtPushButton ( main_window, "Cancel Button", 30, 175, DwtLatin1String ( "Cancel" ), NULL, NULL ); XtAddCallback ( push_button, DwtNactivateCallback, cancel_callback, NULL ); XtSetArg ( settings [ 0 ], DwtNconformToText, True ); XtSetValues ( push_button, settings, 1 ); XtManageChild ( push_button ); And here's the callback: static void cancel_callback ( widget, user_data, callback_data ) Widget widget; caddr_t user_data, callback_data; { parse_verb ( & 0 ); /* parse_verb is FORTRAN code, so need to pass integer value by reference */ } The main_window (parent) is a Dialog Box. I have two other children in the Dialog Box, the aforementioned List Box and a Label. The problem is that the push button never appears. I don't get any errors, but I don't see a Push Button either. Any ideas? Thanks, Mike ________________________________________________________________________ | InterNet> davism@{kcgl1.eng|rcgl1.eng|osu-20.ircc}.ohio-state.edu | | -or- | | davis-m@eng.ohio-state.edu | | CompuServe> 73667,541 | |************************************************************************| | These thoughts, they be mine | ------------------------------------------------------------------------