dwight@geohub.enet.dec.com (Dwight D. Moore) (01/15/91)
Lets try this problem out for size...
I am trying to create a widget hierarchy (acutally, I already have), but
I want to associate a private colormap with some of the widgets such that
when I change the corresponding pixel entry in the colormap, the background
color of the widget changes accordingly.
I have a widget heirarchy such as
main_window
form
button1
button2
button3
...etc
the resources on the buttons are set as follows
Arg ColBtnArgv [] = {
{ XmNlabelString, XmStringCreate (" ",
XmSTRING_DEFAULT_CHARSET)},
{ XmNborderWidth, 1},
{ XmNborderColor, 1},
{ XmNforeground, 1},
{ XmNshadowThickness, 0},
{ XmNtopShadowColor, 1},
{ XmNbottomShadowColor, 0},
{ XmNcolormap, current_cmap},
{ XmNbackground, 0},
};
XmArgc = XtNumber (ColBtnArgv);
for (i=0; i < n_buttons; i++)
{
ColBtnArgv[XmArgc-1].value = i;
ColBtn[i] = XmCreateDrawnButton (ColBtnRowColumn, "ColBtn",
ColBtnArgv, XmArgc);
XtAddCallback (ColBtn[i], XmNactivateCallback, CButtonCB, (caddr_t) i);
}
XtManageChildren (ColBtn, XtNumber (ColBtn));
where current_cmap is of type Colormap and at the type, just a copy of
the colormap obtained from DefaultColormap().
...
later I set the WM_COLORMAP_WINDOWS property as follows
for (i=0; i < n_buttons ; i++)
{
CmapColBtn[i] = XtWindow (ColBtn[i]);
}
fprintf (stderr, "set colormap windows\n");
if (!XSetWMColormapWindows (dpy, XtWindow (TopLevel),
CmapColBtn, n_colors ))
{
WarningMsg ("MxCedit: cannot intern WM_COLORMAP_WINDOWS property");
}
....
The main problem seems to be that the colormap is either not installed, or
the changes don't seem to affect the widgets background color. Other than
that there are no errors reported.
Any ideas?
I am using MOTIF 1.0 (yeah,yeah, I know...we are working on getting MOTIF 1.1).
The operating system is VMS 5.4 running mwm window manager on a VAXstation
3100.
------------------------------------------------------------------------
---------
Dwight D. Moore
Geosciences Computing Network
University of Oklahoma
dwight@geohub.gcn.uoknor.edu (129.15.40.10)
------------------------------------------------------------------------
---------
Usual discliamer WRT Univ of OK.
Polite and useful opinions are welcome.