[comp.windows.x] 'hiding' a widget AND constraining a widget.

spencer@heinlein.osc.edu (Stephen Spencer) (09/02/89)

I have two questions concerning widgets.  I am running X V11 R3 on a Sun 3/60
with the HP widget set (from expo.lcs.mit.edu).  I am a relative newcomer to
writing user-interface code using X, having done lots of it in SunView.

My questions are these:

1.  Is there a way that I can 'turn a widget off'; set some flag so that it
    does not get drawn?  In SunView, one can set the PANEL_SHOW_ITEM field
    of a button, etc. to FALSE and that will do what I want.  I have not 
    found anything similar (yet) in X.

2.  I have a popup window, a dialog box really, which I do not want the user
    to be able to move while it is popped up.  Any ideas out there as to how
    that might be accomplished?  I tried adding an event handler for 
    MotionNotify events to the popup widget (a transientShellWidget) to no
    success.  I know it can be done, the popups in FrameMaker under X do this.

Any help is greatly appreciated.


-=-
Stephen N. Spencer      |"For a successful technology, reality must take
ACCAD, 1224 Kinnear Rd. | precedence over public relations, for Nature
Columbus OH 43212       | cannot be fooled."     - Richard P. Feynman
spencer@heinlein.cgrg.ohio-state.edu OR spencer@cis.ohio-state.edu

swick@ATHENA.MIT.EDU (Ralph R. Swick) (09/02/89)

> Is there a way that I can 'turn a widget off'; set some flag so that it
>    does not get drawn?

Look at the mappedWhenManaged resource, and the XtSetMappedWhenManaged
function.  This is probably what you want.

> I have a popup window, a dialog box really, which I do not want the user
>    to be able to move while it is popped up.

This depends entirely upon the window manager.  Your best bet
is to make your popup a transient (using TransientShell, or a
variant), and hope that the window manager will conspire with you
to give the user less control over the window.  However, there's
no way to absolutely guarantee that no window manager will
ever allow the user to reposition the window (the user signed
the check, after all :-).

If the popup is always drawn entirely in the confines of one of your
application windows, then you could consider making the popup window
a subwindow of the application window rather than a separate
top-level window.

klee@gilroy.pa.dec.com (Ken Lee) (09/02/89)

In article <297@oscsuna.osc.edu>, spencer@heinlein.osc.edu (Stephen Spencer) writes:
> 1.  Is there a way that I can 'turn a widget off'; set some flag so that it
>     does not get drawn? 

XtUnmapWidget does what you want directly.  There are also indirect
methods such as the "mapped when managed" resource.
> 
> 2.  I have a popup window, a dialog box really, which I do not want the user
>     to be able to move while it is popped up. 

I take it you mean moving the window with a window manager.  There are
2 ways to do this.  The easy way is to create your popup in an override
shell.  An alternative, which may be more appropriate to some
applications, is to create the popup in a transient shell, then give
your window manager special instructions (this is window manager
dependent) for handling transient windows.

Ken Lee
DEC Western Software Laboratory, Palo Alto, Calif.
Internet: klee@decwrl.dec.com
uucp: uunet!decwrl!klee