> tcltk
@aol.com schrieb:
> > I am now working on a header detail data entry and I'm having some
> > trouble with tablelist key binding and how use wcb to validate cell
> > entry and convert cell entry to uppercase.
> > package require Tk
> > package require tablelist
> > tablelist::tablelist .t -columns {0 "First Column" 0 "Another
> > column"} -stretch all -background white
> > pack .t
> > .t insert end [list "first row" "another value"]
> > .t insert end [list "another row" "bla bla"]
> > bind [ .t bodytag ] <F9> \
> > { tk_messageBox -title "Pick List" \
> > -message "Select an item!" -type ok
> > focus .t }
> > bind [ .t bodytag] <1> { focus [.t bodypath] }
> > .t columnconfigure 0 -editable yes
> > 1. With the example above the F9 key doesn't get triggered when the
> > cursor is on an editable column/cell.
> As explained in the documentation, the binding tag [.t bodytag] is only
> associated with the body of the tablelist widget, the separators, and
> some other embedded widgets, but not with the temporary entry widget
> used for interactive cell editing. For this reason, you will have to
> repeat the bind command for that entry (see the example below).
> Alternatively, you could add the binding tag [.t bodytag] to the list of
> binding tags of the entry widget.
> > 2. Will someone be kind enough to show me a simple example on how to
> > use wcb with tablelist. Like limiting length of entry and converting
> > to uppercase.
> The Tablelist demo script "miscWidgets.tcl" illustrates how to do this.
> See below for another example.
> > Please I urgently need everyones help here since I need to delivery
> > this program by Monday.
> > Thanks.
> Here is a modified version of your script, with <F9> working during
> interactive cell editing, too, and in which the temporary entry widget
> limits the user input to max. 20 characters and does automatic uppercase
> conversion:
> package require Wcb
> package require tablelist
> tablelist::tablelist .t \
> -columns {0 "First Column" 0 "Another column"} \
> -stretch all -background white -editstartcommand editStartCmd
> pack .t -expand yes -fill both
> .t insert end [list "FIRST ROW" "another value"]
> .t insert end [list "ANOTHER ROW" "bla bla"]
> bind [.t bodytag] <F9> {
> tk_messageBox -title "Pick List" \
> -message "Select an item!" -type ok
> }
> bind [ .t bodytag] <1> { focus [.t bodypath] }
> .t columnconfigure 0 -editable yes
> proc editStartCmd {tbl row col text} {
> set w [$tbl editwinpath]
> bind $w <F9> {
> tk_messageBox -title "Pick List" \
> -message "Select an item!" -type ok
> }
> wcb::callback $w before insert \
> {wcb::checkEntryLen 20} wcb::convStrToUpper
> return $text
> }
> --
> Csaba Nemethi http://www.nemethi.de mailto:csaba.neme@t-online.de
Thank you very much.