home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / windows / x / motif / 8515 < prev    next >
Encoding:
Text File  |  1993-01-12  |  2.3 KB  |  55 lines

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