home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.windows.x.motif
- Path: sparky!uunet!gecko!lanzo
- From: lanzo@tekelec.com (Mark Lanzo)
- Subject: Changing background color of objects & associated labelPixmaps
- Message-ID: <1993Jan12.165857.5610@gecko.uucp>
- Sender: news@gecko.uucp (Mr. News Man)
- Organization: Tekelec Inc., Raleigh NC
- Date: Tue, 12 Jan 1993 16:58:57 GMT
- Lines: 44
-
- A quick question for you: is there a way to change the XmNbackground
- color for a label widget or derived class and have it automatically
- remake the labelPixmap for the widget using the new background color?
-
- I have an application where I create "icons" in a drawing area;
- these "icons" are actually XmDrawnButton widgets. Each button
- has a XmNlabelType = XmPIXMAP, and the actual XmNlabelPixmap is
- specified (by name) in the application resource file.
-
- This works fine when the widget is first created - the widget
- constructor builds an appropriate labelPixmap for the widget
- by fetching a bitmap and constructing a pixmap for the widget
- using the widget's foreground and background colors.
-
- This works fine until I want to change the color of an "icon"
- at run time - I can do an SetValues call on the widget with a
- new XmNbackground value, but this does not cause a new pixmap
- to be generated for the widget. The background color changes;
- but the old pixmap remains, so all I usually see is a colored
- border around the pixmap where the margin area of the widget
- is visible.
-
- My solution to this problem has been to simply destroy the old
- widget and create a new one in its place with the new desired
- background color, and other resources taken from the original
- widget. This strikes me as inelegant - is there a better solution?
-
- I am curious also as to what you think the appropriate behavior
- for a widget should be in this case. If a widget created its own
- labelPixmap from a *bitmap* in the image cache, should changing
- the background color regenerate the pixmap? [Obviously regenerating
- the pixmap in other cases, such as when you explicitly provide
- a XmNlabelPixmap in code, would NOT make sense.] Should there
- be a separate function available to do this?
-
- For reference, this is under X11R4 with Motif 1.1 (1.1.4 I think).
-
- Thanks in advance.
-
- -- Mark Lanzo KD4QLZ lanzo@tekelec.com
-
- Replies please to "lanzo@tekelec.com". Our newsfeed is flaky at best;
- I may never see a posted response.
-
-