[comp.windows.x] how to change the name of a widget

bonnett@seismo.CSS.GOV (H. David Bonnett) (12/13/90)

This is partly a UIL question and partly an Xt (I think) question.

I have a motif app that uses UIL to specify a bunch of widgets, including
menu buttons, and a whole lot of forms with TextFields in them. I have 
been using c-identifier-like names eg: select_db_b1 for the object names.
This name is then passed by uil to the XtCreateWidget call. Unfortunately
this is not good for matching resources to the widgets.  What my question
comes down to is the following:

   1.)  Is there a way to tell UIL to use a different name for the 
	XtCreateWidget call. The MrmCreateCallback happens after the
	Create call.

   2.)  Is there a (semi-elegant) way to change the name (widget->core->name)
	of a widget that has been created. I could possibly do the change
	by brute force and set the field myself, but I wonder what the
	side effects would be..... 

Have others run into this or do you just generally choose better names for
your widgets?

Thanks in advance for any and all answers.

-dave bonnett; Center for Seismic Studies
      bonnett@seismo.css.gov -

converse@EXPO.LCS.MIT.EDU (12/14/90)

>    2.)  Is there a (semi-elegant) way to change the name (widget->core->name)
> 	of a widget that has been created. I could possibly do the change
> 	by brute force and set the field myself, but I wonder what the
> 	side effects would be..... 

As a rule, application programmers should not access fields of the widget 
data structure.  Changing this field will not be effective in changing 
the name of the widget.  The widget's name is given at the time that it
is created and cannot be changed after that time.  The name of a widget
is not a resource.

marbru@attc.UUCP (Martin Brunecky) (12/15/90)

In article <9012131714.AA12875@excess.lcs.mit.edu> converse@EXPO.LCS.MIT.EDU writes:
>
>
>>    2.)  Is there a (semi-elegant) way to change the name (widget->core->name)
>> 	of a widget that has been created. I could possibly do the change
>
>As a rule, application programmers should not access fields of the widget 
>data structure.  Changing this field will not be effective in changing 
>.....

    Well, he can also change the xrm_name .....

    But first of all, WHY anybody wants to do that ?  May be there
    is some (better or easier) way to accomplish THAT than changing
    the instance *name*.

    The widget *name* (or better xrm_name as objects do NOT store the
    name string) is used at widget creation time to retrieve resources
    from Xrm database. Then it is used by XtNameToWidget. 
    It may be used in some other instances as well ... for example,
    Label widgets tend to use this name as a default string.
    I think that changing the name goes into the same bag as reparenting
    widgets. Technically, it can be done, but it feels too close to
    a kluge to justify doing it.


-- 
=*= Opinions presented here are solely of my own and not those of Auto-trol =*=
Martin Brunecky                           {...}sunpeaks!auto-trol!marbru
(303) 252-2499                        (sometimes also:  marbru@auto-trol.COM )
Auto-trol Technology Corp. 12500 North Washington St., Denver, CO 80241-2404