laymon@nepal.crd.ge.com (03/22/90)
I am having trouble setting certain resources. In a previous posting, I mentioned the labels on push buttons widgets were not visible in reverse video mode. I set up two resource files to work with two applications, ROWTEST and FORMEDIT. The files are listed below: ------------------------------------------------------------------ /* .ROWTEST - RESOURCE FILE FOR ROWTEST EXAMPLE */ *Rowtest*ReverseVideo: off *Rowtest*rowcol*singleRow: TRUE *Rowtest*rowcol*layoutType: maximum_columns *Rowtest**RowCol*mode: one_of_many *Rowtest*PushButton*translations: <Btn1Down>: select () *Rowtest*button1*label: Button One *Rowtest*button2*label: Button Two *Rowtest*button3*label: Button Three *Rowtest*button4*label: Button Four *Rowtest*button5*label: Button Five *Rowtest*button6*label: Button Six ----------------------------------------------------------------- /* .FORMEDIT - RESOURCE FILE FOR FORMEDIT EXAMPLE */ *Formedit*ReverseVideo: off *Formedit*button1*label: Name: *Formedit*button2*label: Phone: *Formedit*button3*label: Address: *Formedit*TextEdit*x: 100 *Formedit*field1*y: 10 *Formedit*field2*y: 40 *Formedit*field3*y: 70 *Formedit*PushButton*x: 10 *Formedit*button1*y: 10 *Formedit*button2*y: 40 *Formedit*button3*y: 70 ----------------------------------------------------------------------- If I load .ROWTEST using xrdb with the '-m' option, then run ROWTEST, the buttons do not show up. If I check the resource values using XtGetApplicationResources, the values are foreground= 1, background= 1, and reverse video = 1. If I then load .FORMEDIT, then run ROWTEST, the buttons show up in normal video (black on white) and the values are foreground= 1, background= 1, and reverse video = 0. If I run xrdb -query after loading .ROWTEST, I get *ReverseVideo: on, *Rowtest*ReverseVideo:off. After loading .FORMTEST, the reverse video resources are the same, except the value *Formedit*ReverseVideo:off has been added. It appears as if the program ROWTEST is getting the value for the reverse video resource from the FORMEDIT hierarchy rather than the ROWEDIT resource hierarchy. This also happens with other resources, like the button labels. I have compiled this program on both a Sun 3 running X11/R3 and a Sun 4 running X11/R4 with the same results. If I add the lines: *foreground: White *background: Black to .ROWTEST, I can get the buttons to show up in reverse video (white on black). As I mentioned in my previous posting, I do not have to change any resources for command widgets to show their labels properly in reverse video. Can any one explain what I am doing wrong or point me to a reference on resources. I read the explanation in Young's book, but they are not working they way I would have expected. Marc Laymon E-MAIL: laymon@nepal.crd.ge.com GE R&D Schenectady, NY
kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (03/23/90)
> If I check the resource > values using XtGetApplicationResources, the values are > foreground= 1, background= 1, and reverse video = 1. if foreground_pixel == backgroun_pixel then you will be getting black on black (or green on green or whatever) so it is not surprising that you cannot see the button label. > If I then > load .FORMEDIT, then run ROWTEST, the buttons show up in normal > video (black on white) and the values are foreground= 1, > background= 1, and reverse video = 0. Either your widget isn't using foreground and background to paint its button or you have read the values in these variables wrong. If these colors are pointing to the same cell in the colormap there is no way to get foreground and background to be different colors. ReverseVideo in Xt just replaces XtDefaultForeground with WhitePixel and XtDefaultBackground with Black Pixel. If you application has set its forground default color to "black" rather than to "XtDefaultForeground" then you will get black on black when you turn on ReverseVideo. ReverseVideo in the toolkit always means White on Black it does not mean to swap the foreground and background colors. Chris D. Peterson MIT X Consortium Net: kit@expo.lcs.mit.edu Phone: (617) 253 - 9608 Address: MIT - Room NE43-213