Bwidget Source Code
Check-in [26b1b9804b]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Rename option '-onlyhover' to 'autohidescrollbars'
Timelines: family | ancestors | rfe-d5480d1da2
Files: files | file ages | folders
SHA1: 26b1b9804ba1ebc3baa7943fe04a212845db2e36
User & Date: oehhar 2017-01-16 08:45:18
Context
2017-01-16
08:45
Rename option '-onlyhover' to 'autohidescrollbars' Leaf check-in: 26b1b9804b user: oehhar tags: rfe-d5480d1da2
2017-01-14
13:22
Revert demo test modification check-in: cad07b0345 user: oehhar tags: rfe-d5480d1da2
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to scrollframe.tcl.

25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
..
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
..
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
...
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
        Widget::declare ScrollableFrame {
            {-width             Int        0  0 {}}
            {-height            Int        0  0 {}}
            {-areawidth         Int        0  0 {}}
            {-areaheight        Int        0  0 {}}
            {-constrainedwidth  Boolean    0 0}
            {-constrainedheight Boolean    0 0}
            {-onlyhover         Boolean    0 0}
            {-xscrollcommand    TkResource "" 0 canvas}
            {-yscrollcommand    TkResource "" 0 canvas}
            {-xscrollincrement  TkResource "" 0 canvas}
            {-yscrollincrement  TkResource "" 0 canvas}
        }
    } else {
        Widget::declare ScrollableFrame {
................................................................................
            {-background        TkResource "" 0 frame}
            {-width             Int        0  0 {}}
            {-height            Int        0  0 {}}
            {-areawidth         Int        0  0 {}}
            {-areaheight        Int        0  0 {}}
            {-constrainedwidth  Boolean    0 0}
            {-constrainedheight Boolean    0 0}
            {-onlyhover         Boolean    0 0}
            {-xscrollcommand    TkResource "" 0 canvas}
            {-yscrollcommand    TkResource "" 0 canvas}
            {-xscrollincrement  TkResource "" 0 canvas}
            {-yscrollincrement  TkResource "" 0 canvas}
            {-bg                Synonym    -background}
        }
    }
................................................................................
    # Actually $canvas is the same as $path
    set canvas [eval [list canvas $path] [Widget::subcget $path :cmd] \
                    -highlightthickness 0 -borderwidth 0 -relief flat]

    # Initialization: mouse is within frame
    set mouseover($canvas) 1

    set onlyhover [Widget::cget $path -onlyhover]

    if {[Widget::theme]} {
	set frame [eval [list ttk::frame $path.frame] \
		       [Widget::subcget $path .frame]]
	set bg [ttk::style lookup TFrame -background]
    } else {
	set frame [eval [list frame $path.frame] \
................................................................................
    bind $frame <Map> \
        [list ScrollableFrame::_frameConfigure $canvas]
    bind $frame <Unmap> \
        [list ScrollableFrame::_frameConfigure $canvas 1]

    bindtags $path [list $path BwScrollableFrame [winfo toplevel $path] all]

    if {$onlyhover} {
        # Show scrollbar if mouse within frame
        bind [winfo parent $path] <Enter> [list ScrollableFrame::enter $canvas]
        # Hide scrollbar if mouse leaves frame
        bind [winfo parent $path] <Leave> [list ScrollableFrame::leave $canvas]
    }

    return [Widget::create ScrollableFrame $path]






|







 







|







 







|







 







|







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
..
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
..
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
...
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
        Widget::declare ScrollableFrame {
            {-width             Int        0  0 {}}
            {-height            Int        0  0 {}}
            {-areawidth         Int        0  0 {}}
            {-areaheight        Int        0  0 {}}
            {-constrainedwidth  Boolean    0 0}
            {-constrainedheight Boolean    0 0}
            {-autohidescrollbar         Boolean    0 0}
            {-xscrollcommand    TkResource "" 0 canvas}
            {-yscrollcommand    TkResource "" 0 canvas}
            {-xscrollincrement  TkResource "" 0 canvas}
            {-yscrollincrement  TkResource "" 0 canvas}
        }
    } else {
        Widget::declare ScrollableFrame {
................................................................................
            {-background        TkResource "" 0 frame}
            {-width             Int        0  0 {}}
            {-height            Int        0  0 {}}
            {-areawidth         Int        0  0 {}}
            {-areaheight        Int        0  0 {}}
            {-constrainedwidth  Boolean    0 0}
            {-constrainedheight Boolean    0 0}
            {-autohidescrollbar         Boolean    0 0}
            {-xscrollcommand    TkResource "" 0 canvas}
            {-yscrollcommand    TkResource "" 0 canvas}
            {-xscrollincrement  TkResource "" 0 canvas}
            {-yscrollincrement  TkResource "" 0 canvas}
            {-bg                Synonym    -background}
        }
    }
................................................................................
    # Actually $canvas is the same as $path
    set canvas [eval [list canvas $path] [Widget::subcget $path :cmd] \
                    -highlightthickness 0 -borderwidth 0 -relief flat]

    # Initialization: mouse is within frame
    set mouseover($canvas) 1

    set autohidescrollbar [Widget::cget $path -autohidescrollbar]

    if {[Widget::theme]} {
	set frame [eval [list ttk::frame $path.frame] \
		       [Widget::subcget $path .frame]]
	set bg [ttk::style lookup TFrame -background]
    } else {
	set frame [eval [list frame $path.frame] \
................................................................................
    bind $frame <Map> \
        [list ScrollableFrame::_frameConfigure $canvas]
    bind $frame <Unmap> \
        [list ScrollableFrame::_frameConfigure $canvas 1]

    bindtags $path [list $path BwScrollableFrame [winfo toplevel $path] all]

    if {$autohidescrollbar} {
        # Show scrollbar if mouse within frame
        bind [winfo parent $path] <Enter> [list ScrollableFrame::enter $canvas]
        # Hide scrollbar if mouse leaves frame
        bind [winfo parent $path] <Leave> [list ScrollableFrame::leave $canvas]
    }

    return [Widget::create ScrollableFrame $path]

Changes to scrollw.tcl.

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
..
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
...
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
	{-background  TkResource ""   0 button}
	{-scrollbar   Enum	 both 0 {none both vertical horizontal}}
	{-auto	      Enum	 both 0 {none both vertical horizontal}}
	{-sides	      Enum	 se   0 {ne en nw wn se es sw ws}}
	{-size	      Int	 0    1 "%d >= 0"}
	{-ipad	      Int	 1    1 "%d >= 0"}
    {-managed     Boolean    1    1}
	{-onlyhover   Boolean	 0    0}
	{-relief      TkResource flat 0 frame}
	{-borderwidth TkResource 0    0 frame}
	{-bg	      Synonym	 -background}
	{-bd	      Synonym	 -borderwidth}
    }

    Widget::addmap ScrolledWindow "" :cmd {-relief {} -borderwidth {}}
................................................................................

    Widget::init ScrolledWindow $path $args

    Widget::getVariable $path data

    set bg     [Widget::cget $path -background]
    set sbsize [Widget::cget $path -size]
    set onlyhover [Widget::cget $path -onlyhover]

    if { $::Widget::_theme } {
        set sw     [eval [list ttk::frame $path \
                      -relief flat -borderwidth 0 -takefocus 0] \
                        [Widget::subcget $path :cmd]]
        ttk::scrollbar $path.hscroll \
            -takefocus 0 -orient horiz
................................................................................

    grid columnconfigure $path 1 -weight 1
    grid rowconfigure	 $path 1 -weight 1

    bind $path <Configure> [list ScrolledWindow::_realize $path]
    bind $path <Destroy>   [list ScrolledWindow::_destroy $path]

    if {$onlyhover} {
        # Show scrollbar if mouse within frame
        bind [winfo parent $path] <Enter> [list ScrolledWindow::enter $path]
        # Hide scrollbar if mouse leaves frame
        bind [winfo parent $path] <Leave> [list ScrolledWindow::leave $path]
    }

    return [Widget::create ScrolledWindow $path]






|







 







|







 







|







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
..
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
...
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
	{-background  TkResource ""   0 button}
	{-scrollbar   Enum	 both 0 {none both vertical horizontal}}
	{-auto	      Enum	 both 0 {none both vertical horizontal}}
	{-sides	      Enum	 se   0 {ne en nw wn se es sw ws}}
	{-size	      Int	 0    1 "%d >= 0"}
	{-ipad	      Int	 1    1 "%d >= 0"}
    {-managed     Boolean    1    1}
	{-autohidescrollbar   Boolean	 0    0}
	{-relief      TkResource flat 0 frame}
	{-borderwidth TkResource 0    0 frame}
	{-bg	      Synonym	 -background}
	{-bd	      Synonym	 -borderwidth}
    }

    Widget::addmap ScrolledWindow "" :cmd {-relief {} -borderwidth {}}
................................................................................

    Widget::init ScrolledWindow $path $args

    Widget::getVariable $path data

    set bg     [Widget::cget $path -background]
    set sbsize [Widget::cget $path -size]
    set autohidescrollbar [Widget::cget $path -autohidescrollbar]

    if { $::Widget::_theme } {
        set sw     [eval [list ttk::frame $path \
                      -relief flat -borderwidth 0 -takefocus 0] \
                        [Widget::subcget $path :cmd]]
        ttk::scrollbar $path.hscroll \
            -takefocus 0 -orient horiz
................................................................................

    grid columnconfigure $path 1 -weight 1
    grid rowconfigure	 $path 1 -weight 1

    bind $path <Configure> [list ScrolledWindow::_realize $path]
    bind $path <Destroy>   [list ScrolledWindow::_destroy $path]

    if {$autohidescrollbar} {
        # Show scrollbar if mouse within frame
        bind [winfo parent $path] <Enter> [list ScrolledWindow::enter $path]
        # Hide scrollbar if mouse leaves frame
        bind [winfo parent $path] <Leave> [list ScrolledWindow::leave $path]
    }

    return [Widget::create ScrolledWindow $path]