home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!jvnc.net!nuscc!iscooibc
- From: iscooibc@nuscc.nus.sg (Beng Chin)
- Subject: Actions not found error!
- Message-ID: <1992Aug21.101547.24362@nuscc.nus.sg>
- Organization: National University of Singapore
- Date: Fri, 21 Aug 1992 10:15:47 GMT
- Lines: 54
-
-
- Hi,
-
- I would like to add a translation (actually to overide) which
- would cause a widget to activate a callback when selected.
-
- However, when I run the program, it always give me a run-time
- error of
-
- Warning: Actions not found: selectCallback.
-
- This is how I use the WidgetAction:
-
- action = new WidgetAction();
- action->addTranslate( <a widget> );
-
- I am using C++ with Motif. Appreciate help
- of any kind. Thanks!
-
- KC Phua
- National U. of Singapore
-
- ---------------------- cut here ------------------------
-
- WidgetAction Class
- ------------------
- :
- :
- :
- void WidgetAction::selectCallback( Widget w, XEvent *event,
- XtPointer clientData ) {
- WidgetAction *obj = (WidgetAction *) clientData;
- obj->select( w, event );
- }
-
- void WidgetAction::select( Widget w, XEvent *event ) {
- ...................
- }
-
- void WidgetAction::addTranslate( Widget w ) {
- static char defaultTranslations[] =
- "None<Btn1Down>: selectCallback()";
- static XtActionsRec actionsTable[] = {
- { "select", (XtActionProc) &WidgetAction::selectCallback },
- };
- XtTranslations trans_table;
- XtAddActions(actionsTable, XtNumber(actionsTable));
- trans_table = XtParseTranslationTable(defaultTranslations);
- XtVaSetValues( w,
- XmNtranslations, trans_table,
- NULL );
- XtOverrideTranslations(w, trans_table);
- }
-
-