Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Implement a few features that were already described in the man page: - The "current" pane identifier. - The insert method moves a pane if it was already managed by the accordion. Bugfix: inserting a pane before the active pane resulted in wrong display. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: | 421fab79846a65a2475b405c51cb5f9b4486aec8 |
User & Date: | schelte 2014-07-12 21:52:50 |
Context
2014-07-13
| ||
12:47 | Switched to the (undocumented) megawidget framework that comes with Tk. To reflect the notebook tab subcommand, the accordion pane subcommand has been changed to return a single string or a dict, rather than a list (of lists). Bumped the version to 1.1 Leaf check-in: 52c179f31b user: schelte tags: trunk | |
2014-07-12
| ||
21:52 | Implement a few features that were already described in the man page: - The "current" pane identifier. - The insert method moves a pane if it was already managed by the accordion. Bugfix: inserting a pane before the active pane resulted in wrong display. check-in: 421fab7984 user: schelte tags: trunk | |
18:53 | Initial checkin check-in: d7514b9eda user: sbron tags: trunk | |
Changes
Changes to accordion-1.0.tm.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 ... 141 142 143 144 145 146 147 148 149 150 151 152 153 154 ... 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
} method cget {option} { return [lindex [my configure $option] 4] } method index {paneid} { my variable panes # Integer paneid's are straight-forward if {[string is integer -strict $paneid]} { # No conversion needed set pos $paneid } elseif {$paneid in {end last}} { set pos [llength $panes] } else { # Position of the named pane set pos [lsearch -exact $panes $paneid] } if {$pos < 0 || $pos > [llength $panes]} { return -code error -errorcode {TK BAD_VALUE} \ [format {invalid pane "%s"} $paneid] ................................................................................ if {[llength $args] % 2 == 1} { set msg [format {value for "%s" missing} [lindex $args end]] return -code error -errorcode {TK VALUE_MISSING} $msg } # We can't handle adding panes while an animation is playing if {$coro ne ""} {rename $coro ""} # Add a new pane (containing a button and a frame) at the end set num [llength $panes] set f [frame [my frame $num]] set callback [list [namespace which my] select $num] set b [ttk::button $f.button -command $callback] set a [frame $f.frame] ................................................................................ for {set i $num} {$i > $pos} {} { set w [lindex $panes $i] set f1 [my frame $i] set f2 [my frame [incr i -1]] $f1.button configure -text [$f2.button cget -text] raise $w $f1 } if {$num == 0} { # This is the first pane, open it grid $a place $win -in $a -relwidth 1 -relheight 1 } elseif {$row >= $pos} { # Shift down the opened pane my open $row [expr {$row + 1}] } # Make sure the helper frames don't obscure their contents raise $win [my frame $pos] # Apply any additional configuration settings if {[llength $args] > 0} { tailcall my pane $pos {*}$args } |
| > > > > > > > > > > | |
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 ... 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 ... 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
} method cget {option} { return [lindex [my configure $option] 4] } method index {paneid} { my variable panes row # Integer paneid's are straight-forward if {[string is integer -strict $paneid]} { # No conversion needed set pos $paneid } elseif {$paneid in {end last}} { set pos [llength $panes] } elseif {$paneid eq "current"} { set pos $row } else { # Position of the named pane set pos [lsearch -exact $panes $paneid] } if {$pos < 0 || $pos > [llength $panes]} { return -code error -errorcode {TK BAD_VALUE} \ [format {invalid pane "%s"} $paneid] ................................................................................ if {[llength $args] % 2 == 1} { set msg [format {value for "%s" missing} [lindex $args end]] return -code error -errorcode {TK VALUE_MISSING} $msg } # We can't handle adding panes while an animation is playing if {$coro ne ""} {rename $coro ""} # If win is already managed by the accordion, delete the old pane set old [lsearch -exact $panes $win] if {$old >= 0} { my forget $old if {$old < $pos} {incr pos -1} } # Add a new pane (containing a button and a frame) at the end set num [llength $panes] set f [frame [my frame $num]] set callback [list [namespace which my] select $num] set b [ttk::button $f.button -command $callback] set a [frame $f.frame] ................................................................................ for {set i $num} {$i > $pos} {} { set w [lindex $panes $i] set f1 [my frame $i] set f2 [my frame [incr i -1]] $f1.button configure -text [$f2.button cget -text] raise $w $f1 } puts "row=$row, pos=$pos, num=$num" if {$num == 0} { # This is the first pane, open it grid $a place $win -in $a -relwidth 1 -relheight 1 } elseif {$row >= $pos} { # Shift down the opened pane my open [expr {$row + 1}] } # Make sure the helper frames don't obscure their contents raise $win [my frame $pos] # Apply any additional configuration settings if {[llength $args] > 0} { tailcall my pane $pos {*}$args } |