How to check for valid resources

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

Questions about motif? Contact us

4 posts / 0 new
Last post
How to check for valid resources

Submitted by Anonymous on Tue, 01/28/2003 - 16:04.

Hello!

Is there a way to check if a certain resource is valid for a particular widget class? Is it possible to list the valid resources of a widget?

Thank You in advance for Your help!

Best regards Sampsa

 

 

Wed, 01/29/2003 - 22:06#1

ICS_support

How to check for valid resources

Good question! Generally, to do this absolutely right, you`d need the source code for the widget. In its absence, you usually just rely on the documentation. I`m assuming that you want to find out whether a widget supports a particular resource.

For particular kinds of resources, such as Callbacks, Xt provides an error if the widget doesn`t support the resource.

In addition, if you set a value in a resource file, Xt can issue an error for a bad conversion -- you have a string value when the resource needs an integer.

What may be best is to set the value and then immediately do an XtGetValues. For most resources, if you get what you started with, then the widget has storage space for the resource.

In any case, whether the widget uses the resource value is an entirely different question. There are plenty of stubs and obsolete values out there.

 

Fri, 01/31/2003 - 11:12#2

Fri, 01/31/2003 - 11:12#2

Anonymous

How to check for valid resources

Some tools boast object type checking. Hmm...

In general, nothing not MS DCOM, XDCOM, Java does that in the *general* sense. You have to typecheck per item - and have knowledge of the items. There is no "superstandard" for grouping and classifying inheirited sets of properites and resulting multi-modal capabilities. You can`t write a DCOM for Office and have it decide runtime perfectly how to act in any container it might get tossed into by Office what you needs is the source and MS is only letting certain parties in on that. Also, there is no "superstandard" for determining whether "objects" are really compatible. Objects are code. Code changes. You`d need a code matcher in every object, and the code in every object.

SOO... Shared library attachement is more the supersolution that is made and available that really does those things.

Anyway, usually such things aren`t a goal the goal is timely and reliable interface tools which don`t require such a mess of support. For instance, with Motif all apps get great font support - even little widgets - without any such interface polling - even though this is an X gc that is complicated. And you don`t have to rely on an inteface item which might disappear or become "versionized".

If you want a list of all widgets and resources, why not get O`Reill`s Motif Reference Manual and use grep to build the kind of list your looking for ? All the widget resources and none of the talk ?

-------------------------------

Often, I`ve lately resorted to quips I put in the code that show runtime info like this so I log / filter them without learning xdebugger and a new language )

-------------------------------------------

void show_widget( Widget w, char * str)
{
#ifdef DEBUG
Widget tmp ; int once ;
once=0;
tmp = w ;
while(1)
{
int j ;
if( ! once )
fprintf( stderr, "%p %s (var) %s
", tmp, XtName(tmp), s
else
fprintf( stderr, " %p %s
", tmp, XtName(tmp) );
tmp = XtParent(tmp);
once = 1 ;
if( tmp == NULL ) break ;
}
fprintf( stderr, "
" );
#else
;
#endif
}

Fri, 01/31/2003 - 11:25#3

Fri, 01/31/2003 - 11:25#3

Anonymous

WAIT WAIT WAIT

I assume you`ve seen and used those nifty widget layout programs that show the widgets in any running app on the X desktop...

Also, I bet some integrated environments have a type of autocompletion? I never used that anyway. Ayuda might even have that - can`t remember.

Remember, vi and emacs has a key for pulling up a manpage of the word the cursor is on ;)