Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

Motif FAQ (Part 9 of 9)
Section - 295) Can I specify a widget in a resource file?

( Part1 - Part2 - Part3 - Part4 - Part5 - Part6 - Part7 - Part8 - Part9 - Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Sex offenders ]


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
See reader questions & answers on this topic! - Help others by sharing your knowledge

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));
}


User Contributions:

Comment about this article, ask questions, or add new information about this topic:




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 | Web FAQs | Documents | RFC Index ]

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





Last Update March 27 2014 @ 02:11 PM