Path: utzoo!attcan!uunet!aplcen!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!usc!snorkelwacker!bloom-beacon!eru!luth!sunic!mcsun!unido!laura!heike.informatik.uni-dortmund.de!muenx From: muenx@heike.informatik.uni-dortmund.de (Holger Muenx) Newsgroups: comp.windows.x Subject: XmText - Questions Message-ID: <2280@laura.UUCP> Date: 26 Jun 90 14:15:13 GMT Sender: news@laura.UUCP Reply-To: muenx@heike.informatik.uni-dortmund.de (Holger Muenx) Organization: Universitaet Dortmund Lines: 126 Hi! I'm starting programming with X-Windows and Motif. I have two problems: 1. Is it possible to activate a XmText-Widget without clicking with the mouse into it? I imagine the following: I have an application with different Text-Widgets. If I press the key in one widget the next text widget should automatically be activated so that the user can continue typing in it without moving the mouse. I think it is a good idea to minimize the user's mouse-movement operations. To do this I need a procedure to activate a widget. Is such thing avaible? 2. I have written an application which uses different windows. I create a new window using the XmBulletinBoard-class. Text-Widgets in my main-window call their callback without any problem. Text-Widget in BulletinBoards refuse to call their callback. What's my mistake? See the sample code below my signature. It created two text-widgets, one in the main-window and one in the new BulletinBoard. Thanks in advance, -Holger =========================================================================== || Holger Muenx, IRB, Universitaet Dortmund, 4600 Dortmund, West-Germany || || Internet: muenx@heike.informatik.uni-dortmund.de || =========================================================================== Sample code (sorry for missing documentation): #include #include #include #include #include #include #include #include Widget MakeRowCol(); Widget MakeText(); void Callback(); Arg Args[10]; int n; main(argc, argv) int argc; char **argv; { Display *Disp; Widget Shell, MainWindow, BB; XtToolkitInitialize(); Disp = XtOpenDisplay(NULL, NULL, argv[0], "XUADM", NULL, 0, &argc, argv); Shell = XtAppCreateShell(argv[0], "XUADM", applicationShellWidgetClass, Disp, NULL, 0); n = 0; MainWindow = XmCreateMainWindow(Shell, "main", Args, n); XtManageChild(MainWindow); MakeText(MainWindow, "Test #1:", Callback); n = 0; XtSetArg(Args[n], XmNdialogTitle, XmStringCreateLtoR("Window", XmSTRING_DEFAULT_CHARSET)); n++; BB = XmCreateBulletinBoardDialog(MainWindow, "Window", Args, n); MakeText(BB, "Test #2:", Callback); XtManageChild(BB); XtRealizeWidget(Shell); XtMainLoop(); } void Callback(w, client_data, call_data) Widget w; caddr_t client_data; caddr_t call_data; { printf("Entered: %s\n", XmTextGetString(w)); } Widget MakeRowCol(Parent, Orientation) Widget Parent; unsigned char Orientation; { Widget RowCol; n = 0; XtSetArg(Args[n], XmNorientation, Orientation); n++; RowCol = XmCreateRowColumn(Parent, "RowCol", Args, n); XtManageChild(RowCol); return RowCol; } Widget MakeText(Parent, Question, Callback) Widget Parent; char *Question; void (*Callback)(); { Widget RowCol, Label, Text; RowCol = MakeRowCol(Parent, XmHORIZONTAL); n = 0; Label = XmCreateLabel(RowCol, Question, Args, n); XtManageChild(Label); n = 0; XtSetArg(Args[n], XmNcolumns, 8); n++; XtSetArg(Args[n], XmNmaxLength, 8); n++; Text = XmCreateText(RowCol, "Text", Args, n); XtAddCallback(Text, XmNactivateCallback, Callback, NULL); XtManageChild(Text); return Text; }