Ticket UUID: | d5480d1da2ec9898400f218af80b336e8399747d | |||
Title: | ScrollableFrame: show scrollbars only when mouse in widget | |||
Type: | RFE | Version: | 1.9.10 | |
Submitter: | oehhar | Created on: | 2017-01-12 14:33:36 | |
Subsystem: | bwidget 1.x | Assigned To: | oehhar | |
Priority: | 5 Medium | Severity: | Minor | |
Status: | Open | Last Modified: | 2017-01-23 12:57:05 | |
Resolution: | None | Closed By: | nobody | |
Closed on: | ||||
Description: |
Alexandru provided a patch by E-Mail to only show the Scrollbars within a ScrollableFrame when the mouse is within the widget. The option is "-onlyhover". Tag: [rfe-d5480d1da2] First commit: [246eaca515] | |||
User Comments: |
oehhar added on 2017-01-23 12:57:05:
Alexandru gave the following comment on c.l.t.: I have an workarround for the flickering problem (and also an explanation why the flickering did not happen in my Tcl/Tk application). Just see next text code. It has comments on the issues: package require BWidget # This frame is a necessary container for the ScrolledWindow. # Do not pack the ScrolledWindow directly into the toplevel, since this would cause flickering when the mouse enters the window and move to the edge of the scroll bar. pack [ttk::frame .f] -side top -expand 1 -fill both pack [ScrolledWindow .f.sw -autohidescrollbar 1] -side top -expand 1 -fill both text .f.sw.text -wrap none -relief sunken -bd 2 -fg #3F3F3F -setgrid 1 -width 70 -height 5 -undo 1 -autosep 1 -cursor arrow .f.sw setwidget .f.sw.text # Turn geometry propagation off. # This will avoid window size change when scrollbars are shown or hidden. pack propagate . 0 I also tried to replace the way scrollbars are manged: "place" instead of "grid". But I was very unhappy with the result. The scroll bars disappear when I click on them. Weird... Nevertheless, I regard the new option as "working" provided one considers the two best practices when using "-autohidescrollbar 1":
oehhar added on 2017-01-16 11:46:57:
Test for ScrollingWindowText widgetHere is a test for ScrolledWindow with the text widget:pack [ScrolledWindow .sw -autohidescrollbar 1] -side top -expand 1 -fill both text .sw.text .sw setwidget .sw.text .sw.text insert end [string repeat [string repeat A 1000]\n 200]Issues I see: - when the window is in normal state, the window size flickers. When the mouse pointer is within the scrollbars while dragging, they are unmapped. One may drag the mouse-bars without seeing them ;-) - When the window is maximized, the size does not change. When the mouse pointer is on the scrollbar, it flickers. ScrollableFrameset fInScrolledWindow 1 pack [ScrolledWindow .sw -autohidescrollbar $fInScrolledWindow] -side top -expand 1 -fill both ScrollableFrame .sw.f -autohidescrollbar [expr {!$fInScrolledWindow}] .sw setwidget .sw.f set fc [.sw.f getframe] pack [frame $fc.f -width 1000 -height 1000 -background yellow]Within this test script, there are the same issues as with the text widget. In addition, if the mouse is over space not covered by ScrollableFrame within the ScrolledWindow, the scrollbars are errorneously hidden. Test for ScrollableFramePlease use the upper test with: set fInScrolledWindow 0Then, the upper drawbacks are solved. Nevertheless, the required size flickers with the mouse. The required size of the ScrolledWindow is not constant. <Dynamic configuration> None of the patches support: $f configure -autohidescrollbar 0 IMHO the drawbacks should be solved first. oehhar added on 2017-01-16 08:38:00:
Option NameKevin Waltzer and myself found:-autohidescrollbar 0/1 UsageAlexandru wrote:The option is present in ScrolledWindow and ScrollableFrame to cover different applications: ScrolledWindow and a scrolling-capable widgetOne may use ScrolledWindow and a Widget which supports scrolling itself like TreeCtrl or TableList. An additional ScrolledWindow would cause issues.ScrolledWindow and ScrollableFrameOnly ScrollableFrame requires '-onlyhover 1'.oehhar added on 2017-01-14 13:16:34: How is the usage ? Why is there an option for ScrollableFrame and ScrolledWindow ? Thanks, Harald oehhar added on 2017-01-14 12:43:10:
TestTo test, one may use the bwidget demo by modifying the following line in demo/manager.tcl:--- bwidget-rfe-d5480d1da2/demo/manager.tcl +++ bwidget-rfe-d5480d1da2/demo/manager_ori.tcl @@ -76,15 +76,15 @@ $lb insert end "Value $i" } $sw setwidget $lb pack $sw -fill both -expand yes } set sw [ScrolledWindow $pane3.sw -relief sunken -borderwidth 2] + set sf [ScrollableFrame $sw.f -onlyhover 1] - set sf [ScrollableFrame $sw.f] $sw setwidget $sf set subf [$sf getframe] set lab [label $subf.lab -text "This is a ScrollableFrame"] set chk [checkbutton $subf.chk -text "Constrained width" \ -variable DemoManager::_constw \ -command "$sf configure -constrainedwidth \$DemoManager::_constw"] pack $lab Active by defaultIt is proposed that this option is active by default if themed. I don't think this is a good idea.Documentation
I suppose, I will correct all this in a follow-up commit. |