How to create your own motif-resources (not the predefined.)

This forum is read only. No new submissions are accepted.

Questions about motif? Contact us

5 posts / 0 new
Last post
How to create your own motif-resources (not the predefined.)

Submitted by Anonymous (not verified) on Fri, 06/15/2012 - 12:07

I can`t seem to find help anywhere on this matter... How would you go about creating your own motif resources and setting them
I`m not talking about application resources... or manipulation of the pre-defined motif resources... I`m talking about user-defined motif resources.. is this possible?
‹ Segmentation Fault XmProcessTraversal and Events. ›

ICS_support

Mon, 10/27/2003 - 21:20#1

How to create your own motif-resources (not the predefined.)

I don`t know what you mean. You can subclass the widgets and add extra resources, if you want.

Anonymous

Tue, 10/28/2003 - 17:12#2

How to create your own motif-resources (not the predefined.)

I`ve had about a week to do some research so I can ask my question better )

I found out that Motif will silently ignore any requests to XtVaSetValues(...) if the resource name is not properly registered with the widget class.

I`ve actually gotten around my problem by using the XmNlabelString.... but now I have a wierd problem of garbage ending up in my string. Here`s my code snippet

====================
assert(XtIsSubclass(myWidget, xmToggleButtonWidgetClass));
XtVaSetValues(myWidget, XmNlabelString, XmStringCreateLocalized(char *), NULL);

.......
.......

/* The following snippet will print out garbage */
XmString pete;
XtVaGetValues(myWidget, XmNlabelString, &pete, NULL);
printf(XmCvtXmStringToCT(pete));

/*This snippet gets string but there`s garbage characters in front and back */
char g*;
XtVaGetValues(myWidget, XmNlabelString, &g, 0);

=====================

Have any advice? I can`t seem to get a nicely formatted string pulled out of the XmNlabelString... and I`m running out of ideas

Anonymous

Tue, 10/28/2003 - 17:51#3

How to create your own motif-resources (not the predefined.)

You get garbage because XmNlabelString is of type XmString (Motif compound string) not char. You need to do this

XmString xstr;
char *str;

XtVaGetValues(w,
XmNlabelString, &xstr,
NULL);

XmStringGetLtoR(xstr, XmFONTLIST_DEFAULT_TAG, &str);

Bob

Anonymous

Tue, 10/28/2003 - 20:35#4

How to create your own motif-resources (not the predefined.)

Thanks a bunch guys... I really appreciate all the help. I`m a n00b at the moment though ( maybe soon I`ll be able to answer some questions. I got it working smooth now... just had to change the type I was grabbing from XtVaGetValues.