entry widget and validation

43 wyświetlenia
Przejdź do pierwszej nieodczytanej wiadomości

Michel Enns

nieprzeczytany,
27 sie 2011, 02:12:1127.08.2011
do Tk Documentation and Resources
I'm running into problems trying to get validation working for entry
widgets. Working in Ruby I tried adding validation to Mark Rosemans's
demo http://www.tkdocs.com/tutorial/firstexample.html#code with the
following additions.

$feet = TkVariable.new; $meters = TkVariable.new
f = Tk::Tile::Entry.new(content) {width 7; textvariable
$feet}.grid( :column => 2, :row => 1, :sticky => 'we' )

f.validate = 'focus'
f.validatecommand "%P".to_i>5
f.invalidcommand Tk::messageBox :message => 'Metres must be less
than 5.'

What results is as soon as the program just after the main window is
complete the invalidcommand message box pops up. Once it is dismissed
the main window appears complete but then an error message comes up -
invalid command name "0"

Help?

Matt Burson

nieprzeczytany,
27 sie 2011, 09:21:0427.08.2011
do tkd...@googlegroups.com
idk lol


--
You received this message because you are subscribed to the Google Groups "Tk Documentation and Resources" group.
To post to this group, send email to tkd...@googlegroups.com.
To unsubscribe from this group, send email to tkdocs+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/tkdocs?hl=en.




--
Matt
Odpowiedz wszystkim
Odpowiedz autorowi
Przekaż
Nowe wiadomości: 0