[ABU] 26-jan-2005 - created [ABU] 23-feb-2005 - Updated 2.0.1 ... see below '''Scrodget''' is a generic scrolled widget implemented with [snit]. It is very similar to the Bwidget's '''ScrolledWindow''' (with the added capability to place (automatic) scrollbars on top/bottom left/right. Here is a sample: [http://web.tiscali.it/irrational/tcl/scrodget2.0.1/demo/demo.gif] Start page and download links at [http://web.tiscali.it/irrational/tcl/scrodget2.0.1/index.html] ---- Remember that Tcl/Tk source script widgets can be submitted to [tklib] for more general distribution. ---- [PWQ] What if I want scroll bars on left and right? ---- [ABU] ??? It is a relly unusual demand ... '''1-feb-2005 Done.''' ---- [Peter Newman] 27 January 2005: Scrodget looks great. I use BWidgets ScrolledWindow a lot - but one thing that annoys me about it is that you can't turn auto-hiding off (and have either or both scrollbars fixed). Scrodget fixes that. But it would be better if one could enable/disable autohiding, for the horizontal and vertical scrollbars, separately. Any chance of this? Also [PWQ]'s request for left AND/or right (and top AND/or bottom) is a bit unusual I agree. But a single Scrollbar Manager widget, that can be configured for every conceivable arrangement, would be very useful. And if you were able to do this, being able to enable/disable auto-hiding for the left, right, top and bottom scrollbars, individually, would IMHO be the best way to go. ---- [ABU] 1-feb-2005 Scrodget has been updated. First of all, you can download version '''1.0.1''' which solves some ''little'' BUGS. Second, version '''1.1''' is available: it allows you to enable/disable autohiding, for the horizontal and vertical scrollbars, separately. Third, version '''2.0''' allows you to enable 4 scrollbars (east/west/north/south). * Version 1.0.1 [http://web.tiscali.it/irrational/tcl/scrodget1.0.1/index.html] * Version 1.1 [http://web.tiscali.it/irrational/tcl/scrodget1.1/index.html] * Version 2.0 [http://web.tiscali.it/irrational/tcl/scrodget2.0/index.html] ---- [Peter Newman] 4 February 2005: Version 2 looks good. But I think you've got west and east mixed up. West is left and east is right; you have them the other way round. Specifying the scrollbar sides with news is an excellent idea. But why not specify the auto-hiding the same way? ---- [ABU] .. really a stupid error of mine. Here is an On-fly patch : file "scrodget.tcl" replace typevariable GridIdx -array { n { 0 1 } s { 2 1 } e { 1 0 } w { 1 2 } } with typevariable GridIdx -array { n { 0 1 } s { 2 1 } w { 1 0 } e { 1 2 } } ---- [Peter Newman] 5 February 2005: Thanks! I'd already found that. Your code is really excellent - and simple to follow/debug. And so far (after a few days testing,) seems totally bug-free (after the above fix). This is unlike the '''BWidget ScrolledWindow''' where the code is more obscure - and appears to have the following bugs:- * ''BWidget ScrolledWindow Auto-hiding Bug'' Sometimes you get a scrollbar - either with no slider at all - or with a say 95% slider that doesn't actually slide anything - even though the window contents DON'T seem to require a scrollbar. * The BWidgets ScrolledWindow supports the ''-borderwidth'', ''-relief'' and ''-background'' options - but they rarely seem to work. The values of those same options that you specify for the widget you've wrapped the scrollbars around seem to be used instead. (I say ''rarely'', because there's some strange interaction with the related options of the widget being managed - but I've never been able to figure out exactly what the rules are.) These things are annoying. But the ScrolledWindow code is so obscure, that so far I've found it easier to live with them and/or work-around them, than to fix them. The good thing with [scrodget] is that; not only is it more powerful, but it doesn't appear to have these (or any other) bugs. And even if some bugs are found, the code is quite straightforward, and easy to debug. So if anyone's wondering; '''ScrolledWindow''' or [scrodget]? The answer is definitely [scrodget]. '''Access To The Internal Widgets''' Another excellent thing about scrodget is that you get access to the internal widgets - which makes it very easy to configure those widgets exactly as you want them. Essentially, a scrodget is a 3x3 grid, like this: # 3 x 3 grid ; # the central cell (1,1) is for the internal widget. # +-----+-----+----+ # | | n | | # +-----+-----+----+ # | w |inter| e | # +-----+-----+----+ # | | s | | # +-----+-----+----+ # Cells e or w are for horizontal scrollbar # Cells n or s are for vertical scrollbar # Note that scrollbars may be hidden. And you can ''configure''/''cget'' the internal widgets with:- pathName _component_ configure ... pathName _component_ cget ... where _component_ is one of the following: frame northScroll southScroll eastScroll westScroll Simply heaven for picky people who want total control of every pixel. '''(Getting Rid Of) The Residual Single Line Grid''' The only change I've made to [ABU]'s code, is that he grids the internal widget and scrollbars with:- grid $internalW -in $win -padx 1 -pady 1 -row 1 -column 1 -sticky news grid $sb -padx 1 -pady 1 -row $r -column $c -sticky $sticky which results in a 1 pixel line all around the grid - even if you set the internal and scrollbar widget ``-borderwidth'' and ''-padx/y'' etc options to zero . I've changed that ''-padx/y'' to 0, ie:- grid $internalW -in $win -padx 0 -pady 0 -row 1 -column 1 -sticky news grid $sb -padx 0 -pady 0 -row $r -column $c -sticky $sticky so that you don't get that 1 pixel line. ---- [ABU] 23-feb-2005 Scrodget has been updated (2.0.1). Many thanks to Peter for his precious comments. ---- [Peter Newman] 23 February 2005: Actually, another very useful enhancement to ''scrodget'', would be to make the frame and scrollbar pathnames available - so that one can bind to them, or modify their bindings. From inspection (of ''Scrodget'' version 2.0), the following applies:- # ------------------------------------------------------ # For a `scrodget', the internal pathnames are:- # # -- The scrodget widget itself - which is actually a # frame that contains the scrollbars and the internal # widget - where the frame's pathname is the same as # that you assigned to the `scrodget'... # # -- The scrollbars are then:- # ${scrodgetPathname}.northScroll # ${scrodgetPathname}.southScroll # ${scrodgetPathname}.westScroll # ${scrodgetPathname}.eastScroll # # -- And the internal (managed) widget has whatever name # you gave to the widget you `associated' with the # scrodget. # # So for example, if you go:- # # scrodget .myScrodget ; # ... # canvas .myCanvas ; # ... # .myScrodget associate .myCanvas ; # # you end up with (potentially,) the following widgets:- # # .myScrodget (`scrodget'/frame) # .myScrodget.northScroll (scrollbar) # .myScrodget.southScroll (scrollbar) # .myScrodget.westScroll (scrollbar) # .myScrodget.eastScroll (scrollbar) # .myCanvas (canvas) # # ------------------------------------------------------ ---- See also: * [scroll] ---- [[ [Category Widget] | [Category Snit Widgets] ]]