I need to enhance or find an alternative to BWidget ScrolledWindow 
Author Message
 I need to enhance or find an alternative to BWidget ScrolledWindow

The BWidget ScrolledWindow and ScrollableFrame widgets allow you put
view a large widget in a small space ( http://www.*-*-*.com/ ).  Of
course, that "large widget" can be a frame containing a complex form of
gridded labels and entries or whatever.

However, I've run into a limitation when the viewed widget is
inherently resizable (e.g., a TkTable with stretchable columns).  I'd
like the scrollable aspect to kick in beyond a minimum or natural size
but I'd like the underlying widget to grow to fill the space available
if the ScrolledWindow grows larger than that.

I've looked into the way ScrolledWindow is built and I think I see how
to do that (keep track of minimum size, bind to configure events on the
Canvas in the ScrolledWindow, and resize the viewed widget when the
ScrolledWindow is larger than the minimum) but I'm kind of hoping that
there's another widget out there that does what I need so I can avoid
that work.  So...

1) Is there an altenative which scrolls contents only below a certain
size and allows contents to expand above that size?

2) If not, does the change I'm proposing sound worthwhile?
.

                                       Chris



Mon, 28 May 2007 21:55:26 GMT  
 I need to enhance or find an alternative to BWidget ScrolledWindow
Perhaps I haven't understood your problem, but I really don't
find an error on how the ScrolledWindow widget works.

If you want your widget to not get smaller than a specific
size, then specify this size when creating the widget. If I
create a text widget of 24linesX60chars and I resize
a SW containing the text widget, scrollbars appear.
If I enlarge the SW above the dimensions requested
by the text widget, the text widget expands to fill the empty
space. I think this is also the behaviour you are searching for, isn't
it?

Do you observe a specific behaviour with the TkTable widget
that is different than another widget (i.e. the text widget)?

George


Quote:
> The BWidget ScrolledWindow and ScrollableFrame widgets allow you put
> view a large widget in a small space (http://wiki.tcl.tk/1091).  Of
> course, that "large widget" can be a frame containing a complex form of
> gridded labels and entries or whatever.

> However, I've run into a limitation when the viewed widget is
> inherently resizable (e.g., a TkTable with stretchable columns).  I'd
> like the scrollable aspect to kick in beyond a minimum or natural size
> but I'd like the underlying widget to grow to fill the space available
> if the ScrolledWindow grows larger than that.

> I've looked into the way ScrolledWindow is built and I think I see how
> to do that (keep track of minimum size, bind to configure events on the
> Canvas in the ScrolledWindow, and resize the viewed widget when the
> ScrolledWindow is larger than the minimum) but I'm kind of hoping that
> there's another widget out there that does what I need so I can avoid
> that work.  So...

> 1) Is there an altenative which scrolls contents only below a certain
> size and allows contents to expand above that size?

> 2) If not, does the change I'm proposing sound worthwhile?
> .

>                                       Chris



Tue, 29 May 2007 02:49:05 GMT  
 I need to enhance or find an alternative to BWidget ScrolledWindow

Quote:

> Perhaps I haven't understood your problem, but I really don't
> find an error on how the ScrolledWindow widget works.

> If you want your widget to not get smaller than a specific
> size, then specify this size when creating the widget. If I
> create a text widget of 24linesX60chars and I resize
> a SW containing the text widget, scrollbars appear.
> If I enlarge the SW above the dimensions requested
> by the text widget, the text widget expands to fill the empty
> space. I think this is also the behaviour you are searching for,
> isn't it?

> Do you observe a specific behaviour with the TkTable widget
> that is different than another widget (i.e. the text widget)?

Thanks for the feedback.  I definitely see the problem with TkTable.  I
haven't tried it with a Text widget.  Do you have a little script that
shows a Text widget working right that I could play with?  (Oh, and
what version of Tk and BWidgets are you using?)
Chris


Tue, 29 May 2007 04:16:21 GMT  
 I need to enhance or find an alternative to BWidget ScrolledWindow

Quote:


> > Perhaps I haven't understood your problem, but I really don't
> > find an error on how the ScrolledWindow widget works.
> > ...
> > Do you observe a specific behaviour with the TkTable widget
> > that is different than another widget (i.e. the text widget)?

> Thanks for the feedback.  I definitely see the problem with TkTable.  I
> haven't tried it with a Text widget.  Do you have a little script that
> shows a Text widget working right that I could play with?  (Oh, and
> what version of Tk and BWidgets are you using?)

OK.  I can make a TkTable half work and I apologize for a vague
description of the problem before.  This works:

  package require BWidget
  package require TkTable

  set sw  [ScrolledWindow .sw -relief sunken -borderwidth 2]
  set t [table $sw.table -colstretchmode unset]
  $sw setwidget $t

  pack $sw -expand 1 -fill both

BUT (and this is a *big* "but" for me), I need to be able to constrain
the size of the table.  ScrolledWindow has no -height or -width option
(...checking to make sure I'm not wrong...nope, no size options).  My
goal is to show a large TkTable in an area of specified height, say,
75-100 pixels for a table of many, many rows.  My attempt to do that
interjected a ScrollableFrame into the hierarchy:

   package require BWidget
   package require Tktable

   set sw  [ScrolledWindow .sw -relief sunken -borderwidth 2]
   set sff [ScrollableFrame .sw.f -height 50]
   $sw setwidget $sff

   pack $sw -expand 1 -fill both

   set sf  [$sff getframe]
   table $sf.table -colstretchmode unset

   grid $sf.table -sticky news
   grid rowconfigure $sf 0 -weight 1
   grid columnconfigure $sf 0 -weight 1

and then the table _doesn't_ fill the frame when the scrollable window
is enlarged.  Is ScrollView the solution?  I just found that widget,
I'll go try it...



Tue, 29 May 2007 08:22:29 GMT  
 I need to enhance or find an alternative to BWidget ScrolledWindow

Quote:

> ....  Is ScrollView the solution?  I just found that widget, I'll go try it...

Nope, ScrollView doesn't seem to do anything useful.  (I'm sure I
completely misunderstand it.)


Tue, 29 May 2007 08:32:53 GMT  
 I need to enhance or find an alternative to BWidget ScrolledWindow
You are right, minimun size does not seem
to work (even with the text widget).
If your table widget is the only widget in your toplevel,
you can try to set a minimum size in the toplevel
(through wm minsize). If its not, perhaps
a good idea is to place your table inside a panedwindow.
Thus you can specify a minimum size for the widget & let the
user change the area occupied by the table widget.

Of course there is always the solution to modify the
BWidget ScrolledWidget & submit your changes as
a patch to the tcllib project on the sourceforge...

George


Quote:

>> ....  Is ScrollView the solution?  I just found that widget, I'll go try
>> it...

> Nope, ScrollView doesn't seem to do anything useful.  (I'm sure I
> completely misunderstand it.)



Tue, 29 May 2007 17:11:57 GMT  
 I need to enhance or find an alternative to BWidget ScrolledWindow

Thanks again for the feedback.

Quote:
> You are right, minimun size does not seem
> to work (even with the text widget).

Oh, well.  I so wanted to be wrong. ;-)

Quote:
> If your table widget is the only widget in your toplevel,

Far from it.

Quote:
> ... perhaps
> a good idea is to place your table inside a panedwindow.
> Thus you can specify a minimum size for the widget & let the
> user change the area occupied by the table widget.

I can't scroll it then, can I?

Quote:
> Of course there is always the solution to modify the
> BWidget ScrolledWidget & submit your changes as
> a patch to the tcllib project on the sourceforge...

That's looking like my only option.  <sigh>  I'm wondering, though, if
it isn't the ScrollableFrame which needs work to be more transparent. A
Table or Text in a ScrolledWindow is OK but adding the ScrollableFrame
screws things up.

                                           Chris



Tue, 29 May 2007 20:49:17 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. error with BWidget::ScrolledWindow and -relief?

2. BWidget 1.6: ScrolledWindow fails when widget is destroyed

3. BWidget ScrolledWindow width

4. BWidget 1.6 ScrolledWindow / ScrollableFrame problem

5. Bwidget ScrolledWindow can hold What?

6. BWidgets:ScrolledWindow Scrolling Error

7. Bwidget 1.4.1 and PanedWindow/ScrolledWindow

8. Slightly enhanced BWidgets notebook

9. Drag-and-drop between BWidget tree and BWidget listbox--need help

10. Need Enhanced Widgets for VisualWorks

11. BWidget ScrolledWindow and canvas--how's it supposed to work?

12. Need help with bug in BWidget′s tree widget

 

 
Powered by phpBB® Forum Software