ems@socrates.JPL.NASA.gov (Eric Slimko) (09/07/90)
Recently, I posted a question concerning the activate
callback of a Text widget in a Popup Dialog. I tried
the suggestions that were...suggested, and had no luck.
The problem is that I can't get the activate callback to
work. So, here is the test program I am working with. If
any X/Motif guru could take a look at this, I would be most
appreciative...
-----Cut Here--------------
#include <X11/Intrinsic.h>
#include <Xm/Xm.h>
#include <Xm/BulletinB.h>
#include <Xm/PushB.h>
#include <Xm/Text.h>
Widget popup;
void doit(w, client_data, call_data)
Widget w;
int client_data;
caddr_t call_data;
{
printf("\nHi!");
if (client_data==1)
XtManageChild(popup);
}
void main(argc, argv)
unsigned int argc;
char **argv;
{
Widget toplevel;
Widget form, btn, text;
static String trans = { "<Key>Return: Activate()" };
/*I tried all kinds of translations here*/
Arg args[2];
toplevel=XtInitialize (argv[0], "Xtest", NULL, 0, &argc, argv);
form=XmCreateBulletinBoard(toplevel, "form", NULL, 0);
XtManageChild(form);
btn=XmCreatePushButton(form, "btn", NULL, 0);
XtManageChild(btn);
/* I've tried it also with this argument, to no avail
XtSetArg(args[0], XmNtextTranslations, XtParseTranslationTable(trans));*/
popup=XmCreateBulletinBoardDialog(form, "popup", NULL, 0);
text=XmCreateText(popup, "text", NULL, 0);
XtOverrideTranslations(text, XtParseTranslationTable(trans)); /*This doesn't
help either*/
XtManageChild(text);
XtAddCallback(text, XmNactivateCallback, doit, 0);
XtAddCallback(btn, XmNactivateCallback, doit, 1);
XtRealizeWidget(toplevel);
XtMainLoop();
}
Oh, I tried putting the text widget in another composite widget (a row/column),
but no luck.
Thanks in advance,
--
Eric Slimko | Jet Propulsion Laboratories
ems@socrates.jpl.nasa.gov | NASA/CalTechmikey@eukanuba.wpd.sgi.com (Mike Yang) (09/07/90)
In article <1990Sep6.185706.26352@elroy.jpl.nasa.gov>, ems@socrates.JPL.NASA.gov (Eric Slimko) writes: |> static String trans = { "<Key>Return: Activate()" }; This should be: static String trans = { "<Key>Return: activate()" }; Making this change makes your posted program work. ----------------------------------------------------------------------- Mike Yang Silicon Graphics, Inc. mikey@sgi.com 415/335-1786
roger@zuken.co.jp (Roger Meunier) (09/07/90)
In your sample program you have:
> static String trans = { "<Key>Return: Activate()" };
but the correct action routine name is "activate()" (lower-case 'a').
Why "Activate()" doesn't generate
X Toolkit Warning: Actions not found: Activate
is because it is defined for XmBulletinBoard. Having two [Aa]ctivate()s
keeps the Intrinsics from catching this for you. Who's coordinating
the assignment of these action names, anyway?
--
Roger Meunier @ Zuken, Inc. Yokohama, Japan (roger@zuken.co.jp)