[comp.windows.x] viewport widget

MSACKS@IBM.COM (Michael Sacks) (08/08/89)

Greetings.  Could you please point me toward which of the R3 clients
make the "best" use of the Viewport Widget?  We are having some problems
with it and are looking for some successful sample code. - Michael

vojta@skippy.berkeley.edu (Paul Vojta) (08/14/89)

In article <080889.101805.msacks@ibm.com> msacks@ibm.com writes:
>Greetings.  Could you please point me toward which of the R3 clients
>make the "best" use of the Viewport Widget?  We are having some problems
>with it and are looking for some successful sample code. - Michael

A good instructional use of the viewport widget can be found on the
machine scam.berkeley.edu, in the directory ~ftp/src/local/xtdemo/multiwidget.

Hope this helps.

--Paul Vojta, vojta@math.berkeley.edu

harish@csl.ncsu.edu (Harish Hiriyannaiah) (08/18/89)

I am trying to use a viewport widget to display images. This widget has one
child - a box widget to which I spit the image data. While writing a call
back proc for the viewport widget, I need to access the child. I tried the
naive
	Childwidget = vpwidget->viewport.child;

It bombed of course. Am I missing something here ? 

Also, I am confused about the *.h and the *P.h header files. How does the
compiler figure out all the declarations and #defines in the *P.h files without
#includes ? Am I missing something obvious here ?

Please reply by e-mail if the answers are too trivial.

harish pu. hi.				harish@ecelet.ncsu.edu
					harish@ecebucolix.ncsu.edu




 ______________________________________  ____________________________________
|       |         ___    __    _  ___/ \/                                    |
| -=====' _____  /   \  '  \  / \ | /\ || I am not. Therefore I think not?   |
| /     \/     \ \----| |   | \_/\/ \/ ||                                    |

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (08/18/89)

> I am trying to use a viewport widget to display images. This widget has one
> child - a box widget to which I spit the image data. While writing a call
> back proc for the viewport widget, I need to access the child. I tried the
> naive
>	Childwidget = vpwidget->viewport.child;

> It bombed of course. Am I missing something here ? 

The ONLY accepted method of accessing widget data is through the resource 
list.  Going directly into the widget structure is ugly, and you get what
you deserve when the next release comes out and things have been restructured
internally.

> Also, I am confused about the *.h and the *P.h header files. How does the
> compiler figure out all the declarations and #defines in the *P.h files without
> #includes ? Am I missing something obvious here ?

the *P.h are private header files and should only be used by the widget itself
and its subclasses.  If you as an application writer have to include it
the you are doing something wrong.

Now to solve your problem...

I am a bit confused as to what you are trying to do, if you want to draw into
a widget why use a Box widget?  You would be better served by just using
a core widget (class widgetClass).  The Box has a bunch of geometry manager
stuff that you don't need.

I assume that the only reason to use a viewport is to scroll your image?  If so
then why do you need access to the child?  And since you created the child
why can't you just use the widget id of your Box (or Core) widget.

As you can see I am not really sure enough of what you are doing to be of
much help, but I hope that there is something in here that you can use.

						Chris D. Peterson     
						MIT X Consortium 

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

thelen@SRC.Honeywell.COM (Karen Thelen) (02/22/90)

I have such an elementary problem.  I hope it has an elementary solution.
I am running R4 on a Sun4.  I have a list widget whose parent is a 
viewport widget.  The vertical scrollbar takes up the whole height of the 
widget and will not scroll the list.  I will not list all the things I 
have tried but ...  Oh by the way this code did run on a Sun3 R3.  

Here is the code:

    argcount = 0; 
    XtSetArg(arglist[argcount], XtNwidth, labelWidth); argcount++; 
    XtSetArg(arglist[argcount], XtNheight, halfWindowHeight); argcount++; 
    XtSetArg(arglist[argcount], XtNforceBars, True); argcount++;
    XtSetArg(arglist[argcount], XtNallowVert, True); argcount++;

    subview5 = XtCreateManagedWidget("subview5", viewportWidgetClass, vPaned1, 
                 arglist, argcount); 

    argcount = 0;
    XtSetArg(arglist[argcount], XtNwidth, windowWidth); argcount++;
    XtSetArg(arglist[argcount], XtNheight, halfWindowHeight); argcount++;
    XtSetArg(arglist[argcount], XtNdefaultColumns, 1); argcount++;
    XtSetArg(arglist[argcount], XtNlist, propertyList); argcount++;
    XtSetArg(arglist[argcount], XtNforceColumns, True); argcount++;
    properties = XtCreateManagedWidget("properties", listWidgetClass, subview5, 
                                   arglist, argcount);

Any ideas???


Thanks

KarenThelen

kit@EXPO.LCS.MIT.EDU (Chris D. Peterson) (02/23/90)

[ snorkelwacker!usc!zaphod.mps.ohio-state.edu!uwm.edu!srcsip!terminus!thelen@bloom-beacon.mit.edu (Karen Thelen) writes: ]

Sorry to post this, but the above mail adress bounced (what a shock :-) 

****************************************************************

When posting questions to xpert please include a real return adress in your
signature, I don't want to have to parse adresses like the one above.  If I
can't get mail to you, your request may end up in the bit bucket.

****************************************************************

> I have such an elementary problem.  I hope it has an elementary solution.
> I am running R4 on a Sun4.  I have a list widget whose parent is a 
> viewport widget.  The vertical scrollbar takes up the whole height of the 
> widget and will not scroll the list.  I will not list all the things I 
> have tried but ...  Oh by the way this code did run on a Sun3 R3.  

> Here is the code:

[ code deleted ]

That code fragment looks fine at first glance.  Send me a working SMALL demo
program, and I will see what I can do...

						Chris D. Peterson     
						MIT X Consortium 

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