Version 0 of BWidget::NoteBook - changing placement of arrowbutton

Updated 2007-02-01 22:26:51

HE 20070201: I like BWidgets notebook. The only thing I'm missing is to configure the placement of arrowbuttons. It is a little bit inefficient to move with the mousepointer from side to side, if I had to change the direction the tabs are moved.

Here is a small patch (diff -n) to add a new option -arrowplace (left|both|right) with 'both' as default. 'both' is the original behavior.

 a92 1
        {-arrowplace         Enum both 0 {left both right}}
 a617 3
        if {$base == -1} {
            return
        }
 d623 1
 d953 2
 a954 19

    switch -- [Widget::cget $path -arrowplace] {
        left {
            set xl      0
            set xr      $_warrow
            set permanent 1
        }
        both {
            set xl      0
            set xr      [expr {$w-$_warrow+1}]
            set permanent 0
        }
        right {
            set xl      [expr {$w-$_warrow-$_warrow+1}]
            set xr      [expr {$w-$_warrow+1}] 
            set permanent 1
        }
    }

 d967 1
 a967 1
    if { $data(base) > 0 || $permanent} {
 d981 1
 a981 1
    } elseif {!$permanent} {
 d986 1
 a986 1
         $data(wpage) + [_get_x_page $path 0] + 6 > $w} {
 d1000 1
 a1000 1
    } elseif {!$permanent} {

if you are working on a platform without patch, you can use the following:

  • create the file notebook.diff in the bwidget1.8 directory.
  • copy the diff data in to notebook.diff
  • open a wish or tclsh
  • copy the code from patch for rcs in tcl into the open console
  • execute the following lines:
 cd [tk_chooseDir -title "Select bwidget1.8 directory"]
 file rename notebook.tcl notebook.tcl.orig
 rcs::file2array notebook.tcl.orig filedata
 set fid [open notebook.diff r]
 set patch [read $fid]
 close $fid
 rcs::patch $patch filedata
 set fid [open notebook.tcl w]
 foreach index [lsort -dictionary [array names filedata]] {
    puts $fid $filedata($index)
 }
 close $fid