Changing Fonts Dynamically?

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

Questions about motif? Contact us

3 posts / 0 new
Last post
Changing Fonts Dynamically?

Submitted by Anonymous on Wed, 12/20/2000 - 22:22. Developers
Hi,
We have an application with windows that created
using uimx. I need to be able to dynamically change the fonts of all the menus. Is there a way of altering the resource database, so that if i destroy a window and re-create it, it will have the new font?

ICS_support

That`s an awfully expensive operation to do to change a resource value; changing the resource would be better than re-creating the widget tree. Is there some peculiarity of UIMX that keeps you from changing the resources directly? I don`t know whether it hides widgets from you via accessor functions.

In any case, you can iterate through your widget tree to change the resource values for the widgets. Some code that you can use is in the article at http//www.motifzone.com/tmd/articles/Recursive/traversal.html , which shows how to traverse the tree recursively. Then, use the saved font-id that you are using when you create new menus.

In addition, if you really want to stuff a value back into the database and blow away the widgets, see the function XtDatabase() at
http//www.motifzone.com/resources/man/XtDisplayInitialize.html and XrmPutLineResource() at http//www.motifzone.com/resources/man/XrmPutResource.html . I believe that you can write back to this database.

Anonymous

I tried to query on the children of the menu
by using
XtVaGetValues(widget,
XtNchildren, &wl,
XtNnumChildren, &x, NULL);
I wrote a recursive routine to set the
font of each child and it seemed to work
but it skipped all the menubar and option menu
children. I`m guessing that those aren`t composite
widgets and hence won`t return children with the
call above. Any idea how to access those widget ids?