quinn@maxlin.dartmouth.edu (Jerry Quinn) (11/12/88)
I have been trying to get my own colormaps to work with X11R3. This is the section of code that is doing this : Display *dpy; /* X server connection */ Window win; /* Window ID */ GC gc; /* GC to draw with */ Colormap colors; XColor color; /************** Colormap Section ******************************/ colors = XCreateColormap(dpy,win,vs,AllocAll); for (i=0; i < 256; i++) { color.pixel = i; color.red = color.green = color.blue = i<<8; color.flags = (DoRed | DoGreen | DoBlue); XStoreColor(dpy,colors,&color); } XInstallColormap(dpy,colors); gcv.foreground = 128; gcv.background = 200; gc = XCreateGC(dpy, win, (GCForeground | GCBackground), &gcv); XMapWindow(dpy,win); /******** draw a colorbar ***********/ for (ij=0; ij < 256; ij++) { gcv.foreground = ij; XChangeGC(dpy, gc, (GCForeground), &gcv); XFillRectangle(dpy,win,gc,83+ij*2,43,2,10); } XFlush(dpy); This creates a grayscale map on my color SUN-3. The last part puts up a colorbar of the whole colormap. Or rather it should. This is the problem: If I run the program, it puts up my window, the associated widgets and such, but doesn't draw the colorbar. If I step through a few lines at a time in the debugger, the colorbar gets drawn. I have no ideas on how to fix this. (The whole program window consists of widgets and one normal drawing window). please reply either to this group or e-mail me. thanks in advance, jerry quinn quinn@sunapee.dartmouth.edu
janssen@titan.sw.mcc.com (Bill Janssen) (11/12/88)
This looks like another case of drawing on the window before it's really mapped. Try waiting for a map event before drawing. Bill
ta_k@maths.su.oz.au (Katya Ta) (04/15/91)
Hi,
Can anyone tell me what is the best way to change the
interface in X. What I want to do is to have a menu bar and when
the user chooses an option the main interface (not menu bar)
should change correspondingly. For example the user chooses
letter format so the main area should display the fields for this
options and when the user chooses fax format this should be
displayed.
Should I unmap/ map the relevant widgets? Or is there
another way?
Thanks in advance
Katya
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=
/ .__. | Katya Ta
---- |__| __|__ University of Sydney
-- |__| | Australia
-- |__| \| (ta_k@maths.su.oz.au)
.__. /| |
|__| _/ | | <-- Chay(Cantonese) == Ta.(Vietnamese) :)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=
ta_k@maths.su.oz.au (Katya Ta) (04/16/91)
Hi,
I'm not sure if my question got through earlier, I think I typed in the
wrong distribution. If it did get through ...
Can anyone tell me what is the best way to change the
interface in X. What I want to do is to have a menu bar and when
the user chooses an option the main interface (not menu bar)
should change correspondingly. For example the user chooses
letter format so the main area should display the fields for this
options and when the user chooses fax format this should be
displayed.
Should I unmap/ map the relevant widgets? Or is there
another way?
Thanks in advance
Katya
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-
/ .__. | Katya Ta
---- |__| __|__ University of Sydney
-- |__| | Australia
-- |__| \| (ta_k@maths.su.oz.au)
.__. /| |
|__| _/ | | <-- Chay(Cantonese) == Ta.(Vietnamese) :)
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-
converse@expo.lcs.mit.EDU (Donna Converse) (04/16/91)
> What I want to do is to have a menu bar and when > the user chooses an option the main interface (not menu bar) > should change correspondingly. For example the user chooses > letter format so the main area should display the fields for this > options and when the user chooses fax format this should be > displayed. If you want widgets to disappear but still take up the same space within the parent widget, use XtSetMappedWhenManaged to set mapped_when_managed to False, and use XtMapWidget and XtUnmapWidget to control which widgets can be seen. If you want other widgets to shift positions within the parent as their siblings disappear, use XtManageChild(ren) and XtUnmanageChild(ren). This can lead to the parent making changes in its own geometry, as well as recomputation of the layout of children, depending on values of various constraint resources, and that could be distracting to the user, or expensive to compute. Some composite widgets allow you to effectively "batch" these requests, by temporarily turning off the recomputation of the layout until all the changes in resources and managed children have been made. There is a discussion of these issues in Asente & Swick, in the Programmer's Guide section 4.3. Donna Converse
aw@jello.bae.bellcore.com (Andrew Wason) (04/17/91)
In article <1991Apr15.215153.23046@metro.ucc.su.OZ.AU>, ta_k@maths.su.oz.au (Katya Ta) writes: > > What I want to do is to have a menu bar and when > the user chooses an option the main interface (not menu bar) > should change correspondingly. For example the user chooses > letter format so the main area should display the fields for this > options and when the user chooses fax format this should be > displayed. > Should I unmap/ map the relevant widgets? Or is there > another way? Try using the XcuDeck widget from the Xcu widget set (available on the contrib tape, I think). The Deck widget manages a set of children like a deck of cards - only one child is on top of the deck at a time. In your case, you could give the Deck two children - "letter" and "fax". These would each be Composites laying out their children in the layout you need for that format. Then when the "fax" menu item is selected, you tell the Deck to raise its "fax" child to the top, when "letter" is selected, tell it to raise "letter". Deck makes itself as big as its biggest child, so there is no nasty flashing or resizing when you pop children to the top. I have used XcuDeck with Motif widgets, it should work fine with Athena too. Andrew _______________________________________________________________________________ Andrew Wason Bell Communications Research aw@bae.bellcore.com Piscataway, NJ bellcore!bae!aw