Advanced Search
Mail us
Home    Manuel    Links    Faq    Submit a tcl/tk Reference    Contact Us

    Some examples tcl/tk codes     Man of Bwidget     Man of blt     mkwidget screenshots     TkOgl     Video Demo real.


  How can I add a row/col to the grid?
 
 There is a simple Tcl solution for this, provided by Stephen Uhler,
(with modification by Donal Fellows):

# insert rows or columns into a grid
#  grid:  the geometry master
#  what:  row or column
#  index: where to insert
#  count: how many rows/cols to insert
 
proc grid_insert {grid what index {count 1}} {
    foreach slave [grid slaves $grid] {
	array set info [grid info $slave]
	if {$info(-$what) >= $index} {
	    incr info(-$what) $count
	    eval {grid $slave} [array get info]
	} elseif {$info(-$what)+$info(-${what}span) > $index} {
	    incr info(-${what}span) $count
	    eval {grid $slave} [array get info]
	}
    }
}