entry widget and validation

43 views
Skip to first unread message

Michel Enns

unread,
Aug 27, 2011, 2:12:11 AM8/27/11
to 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

unread,
Aug 27, 2011, 9:21:04 AM8/27/11
to 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
Reply all
Reply to author
Forward
0 new messages