home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x
- Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!yale!mintaka.lcs.mit.edu!bloom-beacon!INTERNET!dont-send-mail-to-path-lines
- From: J.K.Wight@newcastle.ac.UK (Jim Wight)
- Subject: Re: athena widgets, problem with toggle.
- Message-ID: <AA22399.9207251835.blagdon@uk.ac.newcastle>
- Sender: daemon@athena.mit.edu (Mr Background)
- Organization: The Internet
- Date: Sat, 25 Jul 1992 18:35:31 GMT
- Lines: 57
-
- > I have a little problem with an application I'm developing, here goes.
- > I have a radio group containing two toggles. I want to set one of the
- > toggles to be the current one, and then switch back to the original
- > position. I'm using XawToggleSetCurrent(radio_goup,radio_data) and it
- > doesn't do anything. Is this function supposed to be equivalent to
- > clicking on the toggle itself or not?
-
- Yes, but I don't understand what you mean by 'and then switch back to the
- original position'. Nevertheless, here is a little program that demonstrates
- that XawToggleSetCurrent can be made to do something. You can either set the
- toggles by clicking on them, or you can click the 'set 2' button to set toggle
- 2. The button's callback calls XawToggleSetCurrent.
-
- Jim
- ---
- J.K.Wight@newcastle.ac.uk
- Department of Computing Science, The University, Tel: +44 91 222 8238
- Newcastle upon Tyne, NE1 7RU, United Kingdom. Fax: +44 91 222 8232
-
- #include <X11/Intrinsic.h>
- #include <X11/StringDefs.h>
- #include <X11/Xaw/Box.h>
- #include <X11/Xaw/Command.h>
- #include <X11/Xaw/Toggle.h>
-
- void Set(widget, client_data, call_data)
- Widget widget;
- XtPointer client_data;
- XtPointer call_data;
- {
- XawToggleSetCurrent((Widget) client_data, client_data);
- }
-
- main (argc, argv)
- int argc;
- char **argv;
- {
- XtAppContext app;
- Widget top, box, tog1, tog2, set;
-
- top = XtVaAppInitialize(&app, "Test", NULL, 0, &argc, argv, NULL, NULL);
- box = XtVaCreateManagedWidget("box", boxWidgetClass, top, NULL);
-
- tog1 = XtVaCreateManagedWidget("toggle 1", toggleWidgetClass, box, NULL);
- XtVaSetValues(tog1, XtNradioData, (XtPointer) tog1, NULL);
-
- tog2 = XtVaCreateManagedWidget("toggle 2", toggleWidgetClass, box,
- XtNradioGroup, tog1,
- NULL);
- XtVaSetValues(tog2, XtNradioData, (XtPointer) tog2, NULL);
-
- set = XtVaCreateManagedWidget("set 2", commandWidgetClass, box, NULL);
- XtAddCallback(set, XtNcallback, Set, (XtPointer) tog2);
-
- XtRealizeWidget(top);
- XtAppMainLoop(app);
- }
-