[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

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

2247.0. "changing colors" by TOWNS::RUFFIEUX () Fri Feb 09 1990 16:16

    
    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.RTitleUserPersonal
Name
DateLines
2247.1PSW::WINALSKICareful with that VAX, EugeneFri Feb 09 1990 17:583
Try the DECWINDOWS_PROGRAMMING conference.

--PSW
2247.2Motif/Xt Code segment...FUEL::grahamSend in the Clones!Fri Feb 09 1990 19:3650
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.3CALL::SWEENEYPatrick Sweeney in New YorkFri Feb 09 1990 21:552
    see my example "xqt" note 187 in ELKTRA::DW_EXAMPLES, complete source
    provided there