| Title: | DECWINDOWS 26-JAN-89 to 29-NOV-90 | 
| Notice: | See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit | 
| Moderator: | STAR::VATNE | 
| Created: | Mon Oct 30 1989 | 
| Last Modified: | Mon Dec 31 1990 | 
| Last Successful Update: | Fri Jun 06 1997 | 
| Number of topics: | 3726 | 
| Total number of notes: | 19516 | 
    
    Is there a simple way to change background or foreground color
    of a wiget in C using SetArg?  I have not seen this anywhere..
    
    
    Thanks
    Chris
| T.R | Title | User | Personal Name | Date | Lines | 
|---|---|---|---|---|---|
| 2247.1 | PSW::WINALSKI | Careful with that VAX, Eugene | Fri Feb 09 1990 17:58 | 3 | |
| Try the DECWINDOWS_PROGRAMMING conference. --PSW | |||||
| 2247.2 | Motif/Xt Code segment... | FUEL::graham | Send in the Clones! | Fri Feb 09 1990 19:36 | 50 | 
| 
Here are some ideas stolen from Doug Young.
-------
..
...
Widget create_color_bar(parent)
  Widget parent;
{
  Widget      panel;
  WidgetList  colors;
  int         i, n;
  char        name[10];
  Arg         wargs[10];
 colors = (WidgetList) XtMalloc( ncolors * sizeof(Widget));
  
  /*
   * Create the row column manager to hold all 
   * color buttons.
   */
  n = 0;
  panel = XtCreateManagedWidget("colorpanel",
                                xmRowColumnWidgetClass,
                                parent, wargs, n);
  /* 
   * Create ncolors widgets. Use the relative color 
   * cell number as the name of each color. Add a 
   * XmNactivateCallback for each cell with the color 
   * index as client_data.
   */
  for(i=0;i<ncolors;i++){
   n = 0;
   XtSetArg(wargs[n], XtNbackground, i); n++; 
   sprintf(name,"%d",i);
   colors[i] = XtCreateWidget(name, xmLabelWidgetClass, 
                              panel, wargs, n);
   XtAddEventHandler(colors[i], ButtonPressMask, False,
                     set_current_color, i);
   }
   XtManageChildren(colors, ncolors);
  
   return panel;
}
..
..
--------
Kris..
 | |||||
| 2247.3 | CALL::SWEENEY | Patrick Sweeney in New York | Fri Feb 09 1990 21:55 | 2 | |
|     see my example "xqt" note 187 in ELKTRA::DW_EXAMPLES, complete source
    provided there
 | |||||