F
Ferenc Engard
Hello,
I am getting more into the GUI.
I have a form where I enter some values into entries, and when pushing
the Ok button I process them.
I put validatecommands on the entries where I need some checks about
their value, so they are validated when focus goes away from them, and
if the value is invalid, I put the focus to the entry again.
The first problem was that when I push a button it do not take focus, so
the last entry was not validated. I solved this by putting a
@btnOk.focus as the first row of the Ok button's callback.
The next problem is, that the entry's focusout validate callback handler
do not execute while I am in the callback of the OK button, i.e., after
the @btnOk.focus cmd the focus is on the button, and the entry's
validate proc (which would take away focus from the button) runs only
after I return from this proc.
So, this do not work in the button proc:
def btnOkHandler
@btnOk.focus
if Tk.focus != @btnOk
# the entry forcibly holds the focus because of error
return
end
# ... process data
end
What can I do instead? I have to call the validating proc directly? It
is not pretty, and even it is complicated to figure out what is it in my
program...
Thanks:
Ferenc
I am getting more into the GUI.
I have a form where I enter some values into entries, and when pushing
the Ok button I process them.
I put validatecommands on the entries where I need some checks about
their value, so they are validated when focus goes away from them, and
if the value is invalid, I put the focus to the entry again.
The first problem was that when I push a button it do not take focus, so
the last entry was not validated. I solved this by putting a
@btnOk.focus as the first row of the Ok button's callback.
The next problem is, that the entry's focusout validate callback handler
do not execute while I am in the callback of the OK button, i.e., after
the @btnOk.focus cmd the focus is on the button, and the entry's
validate proc (which would take away focus from the button) runs only
after I return from this proc.
So, this do not work in the button proc:
def btnOkHandler
@btnOk.focus
if Tk.focus != @btnOk
# the entry forcibly holds the focus because of error
return
end
# ... process data
end
What can I do instead? I have to call the validating proc directly? It
is not pretty, and even it is complicated to figure out what is it in my
program...
Thanks:
Ferenc