Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page

Top Document: Motif FAQ (Part 9 of 9)
Previous Document: 294)* How can I implement "bubble help" or "tool tips" with Motif?
Next Document: 296) Why are only some of my translations are being installed? I


[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]

295) Can I specify a widget in a resource file?



Answer: This answer, which uses the Xmu library, is due to David Elliott.  If
the converter is added, then the name of a widget (a string) can be used in
resource files, and will be converted to the appropriate widget.

This code, which was basically stolen from the Athena Form widget, adds a
String to Widget converter.  I wrote it as a general routine that I call at
the beginning of all of my programs, and made it so I could add other
converters as needed (like String to Unit Type ;-).

#include <X11/Intrinsic.h>
#include <X11/StringDefs.h>
#include <Xm/Xm.h>
#include <X11/Xmu/Converters.h>
#include <X11/IntrinsicP.h>
#include <X11/CoreP.h>

void
setupConverters()
{
        static XtConvertArgRec parentCvtArgs[] = {
                {XtBaseOffset, (caddr_t)XtOffset(Widget, core.parent),
                        sizeof(Widget)}
        };
        XtAddConverter(XmRString, XmRWindow, XmuCvtStringToWidget,
                parentCvtArgs, XtNumber(parentCvtArgs));
}




Top Document: Motif FAQ (Part 9 of 9)
Previous Document: 294)* How can I implement "bubble help" or "tool tips" with Motif?
Next Document: 296) Why are only some of my translations are being installed? I

Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page


[ Usenet FAQs | Search | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
kenton@rahul.net (Ken Lee)

Last Update May 13 2007 @ 00:23 AM