Path: utzoo!attcan!uunet!cs.utexas.edu!rutgers!apple!bloom-beacon!EXPO.LCS.MIT.EDU!converse From: converse@EXPO.LCS.MIT.EDU (Donna Converse) Newsgroups: comp.windows.x Subject: Re: Having trouble using XtAugmentTranslations() Message-ID: <8906142008.AA03956@expo.lcs.mit.edu> Date: 14 Jun 89 20:08:53 GMT References: <5206@pt.cs.cmu.edu> Sender: daemon@bloom-beacon.MIT.EDU Organization: X Consortium, MIT Laboratory for Computer Science Lines: 107 > I have a translation: > > static String my_translations = "Ctrl : ResEdit(foo, 9x15)"; > [description of organization of the interface code, and the order of Xt calls] > ... to no avail, as the > Ctrl/Button2Down sequence does not even call have the desired effect > (ResEdit never even gets called). I cannot duplicate this problem. Try this sample code: it works here. Donna Converse converse@expo.lcs.mit.edu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #include #include #include #include #include #include Syntax(call) char *call; { fprintf(stderr, "Usage: %s\n", call); fprintf(stderr, "press mouse button 1 in the first button.\n"); fprintf(stderr, "press control-mouse button 2 in the second button.\n"); exit(1); } /*ARGSUSED*/ void ActionProc(w, event, vector, count) Widget w; /* unused */ XEvent *event; /* unused */ String *vector; Cardinal *count; { int i; printf("Hello World!\n"); for (i=0; i < *count; i++) /* demonstrate parameters */ printf("%s\t", vector[i]); printf("\n"); } XtActionsRec actionTable[] = { {"ActionProc", ActionProc}, }; /*ARGSUSED*/ void CallbackProc(w, client_data, call_data) Widget w; /* unused */ caddr_t client_data; caddr_t call_data; /* unused */ { Widget ws = (Widget) client_data; XtPopup(ws, XtGrabNonexclusive); } void main(argc, argv) unsigned int argc; char **argv; { Widget toplevel, shell, box, button1, button2; Arg args[3]; Cardinal i; static XtCallbackRec callbacks[] = { {CallbackProc, NULL}, {NULL, NULL}, }; toplevel = XtInitialize("main", "Demo", NULL, 0, &argc, argv); if (argc != 1) Syntax(argv[0]); XtAppAddActions(XtWidgetToApplicationContext(toplevel), actionTable, XtNumber(actionTable)); shell = XtCreatePopupShell("popup", applicationShellWidgetClass, toplevel, NULL, (Cardinal)0); i = 0; XtSetArg(args[i], XtNwidth, 100); i++; XtSetArg(args[i], XtNheight, 100); i++; callbacks[0].closure = (caddr_t) shell; XtSetArg(args[i], XtNcallback, callbacks); i++; button1 = XtCreateManagedWidget("button1", commandWidgetClass, toplevel, args, i); box = XtCreateManagedWidget("box", boxWidgetClass, shell, NULL, (Cardinal) 0); i = 0; XtSetArg(args[i], XtNwidth, 100); i++; XtSetArg(args[i], XtNheight, 100); i++; button2 = XtCreateManagedWidget("button2", commandWidgetClass, box, args, i); XtAugmentTranslations(button2, XtParseTranslationTable ("Ctrl:ActionProc(foo, 9x15)\n")); XtRealizeWidget(toplevel); XtMainLoop(); }