[comp.windows.x] Widget with more than one window

doleh@kent.EDU (06/24/89)

	I am trying to create a widget with more than one window.
I create subwindows of the XtWindow(w). Everything was fine except
when I used XtDispatch(event), where event->window is one of the subwindows
the event is not seen by the widget. 

	After RTFM, and UTSL I found that it is necessary to add the windows
I have created to a hashtable. I found an internal routine  _XtRegisterWindow
which does this for me. I had no choice except using that routine.
My questions are:

1 - Will the toolkit have more support for multi window widgets.
2 - Is there another way of handling this ?

Thanks for all your help.

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (06/27/89)

> 	I am trying to create a widget with more than one window.
> I create subwindows of the XtWindow(w). Everything was fine except
> when I used XtDispatch(event), where event->window is one of the subwindows
> the event is not seen by the widget. 

> 1 - Will the toolkit have more support for multi window widgets.

Nope.

> 2 - Is there another way of handling this ?

Read on MacDuff :-)

The correct way to accomplish what you desire is not to have a widget with
more than one window, but to have a widget that automatically creates, manages
and realizes one or more children.  If you handle all of these things in
the widget code itself, it is not necessary for this widget to be a composite
widget, athough there is no reason not the make it a composite widget. 
If you are looking for children that do not have any semantics of their
own then you can just have the children be core widgets (Class
widgetClass).  The text widget
does a very similiar thing with its optional scrollbar.


						Chris D. Peterson     
						MIT X Consortium 

Net:	 kit@expo.lcs.mit.edu
Phone:   (617) 253 - 9608	
Address: MIT - Room NE43-213

swick@ATHENA.MIT.EDU (Ralph R. Swick) (06/29/89)

     Date:  Fri, 23 Jun 89 16:04:13 EDT
     From:  doleh%kent.edu@relay.cs.net

     
     	I am trying to create a widget with more than one window.
     I create subwindows of the XtWindow(w). Everything was fine except
     when I used XtDispatch(event), where event->window is one of the subwindows
     the event is not seen by the widget. 

Xt only knows how to dispatch input from one window per widget.
If you want Xt to dispatch input from multiple windows then each of
them must be made into a widget.  You can still create a compound
or composite widget to transparently instantiate the subwidgets
for the application, keeping the internal implementation opaque.

Alternatively, if you're only interested in "user input" from the
sub-windows, you could add the event handler to the parent, and
not do SelectInput on the subwindows, thereby allowing the server
to propogate the events to a window known to Xt.  Once the handler
gets the event, you can use the child field of the event to
distinguish the particular subwindow.