I think I've come across this before but I can't remember how I got round it.
I have 2 fill in fields e.g. fi-name and fi-age
To start with fi-name is sensitive and fi-age isn't.
On LEAVE of fi-name I want to check the contents and if something has been entered (i.e. not fi-name:screen-value = "") then I want to make fi-age sensitive and move the cursor to it.
The code I have in LEAVE of fi-name goes something like...
...
if self:screen-value = "" then
do:
assign
fi-age:screen-value = ""
fi-age:sensitive = false.
end.
else
do:
assign
fi-age:sensitive = true.
apply "ENTRY" to fi-age.
end.
...
However this doesn't seem to work how it should.
I go into fi-name and type my name (for instance) and then click on a different field (i.e. NOT fi-age) and fi-age becomes sensitive (so the code is working) but the cursor stays in the field I clicked instead of entering into fi-age.
The reason I want this to happen is that (due to legacy code etc...) the age MUST be entered if the name is enetered. So I have a check on LEAVE of fi-age to make sure something is entered.
Thanks
Oliver
Try to add
RETURN NO-APPLY .
as the last statement of your on LEAVE trigger.
Otherwise Progress has determined the field that will receive focus before the LEAVE trigger is executed and would place focus in that field after the trigger. Overriding your APPLY statements results.
Thank you.
Worked a charm.
I can't believe I didn't try it before. I guess I normally use it to undo the changes and place the cursor back in the same field so thought it would do that?
Thanks!
It works ... but is is bad UI design. One should never force the user into a field. Let them enter data in the order they want and at the time of save validate that an age has been entered and let them know if they haven't.
Thanks Thomas.
I have since changed the way it validates and works so that it doesn't move the user around the GUI and then lets them know if something is wrong at the end.
Thank you.
Oliver
Good for you! It isn't often that someone listens!