Major problem with a persistent trigger

Luuk

New Member
Hi,

I have a dynamic fill-in widget which uses data from the database in order to determine it's a integer-field,character-field, date-field, etc....

This widget has a persistently run internal-procedure which handles the on 'leave' of the widget.

Well, here's my problem.....

When my fill-in is of type date and i type an invalid date in the field and then press tab, progress shows me a default error.

I do not want to show this message when a user presses the cancel button. In order to do this i put the following code in my persistent leave-procedure....

-------------------------------------

procedure ip_DynamischeLeave:

if (last-event:event-type = "PROGRESS" and
last-event:widget-enter = btn_cancel:handle in frame detail-frame)
then do:
if hnd_waarde:data-type = "date"
then
assign hnd_waarde:screen-value = ?.

return.
end.

...more code....

end procedure.

--------------------------------------

It works fine when i type an invalid date in the field and directly press the cancel button, but when i first give a tab and receive the default progress error ( number 80) and then press the cancel button i receive the same error.

When i keep trying to press cancel it sometimes suddenly exits the program like it should.

I'm very confused, because i don't know what's wrong....
I hope somebody can help me out.

Regards,

Luuk
 

RKR

Member
Hi Luuk,

Why perform field-level validation, as this is not common windows practice. It is better to perform the validation of the field level widgets when the user presses the OK button. In that case there is no need to overrule the default Progress date validation.

Hope this helps,

Luuk said:
Hi,

I have a dynamic fill-in widget which uses data from the database in order to determine it's a integer-field,character-field, date-field, etc....

This widget has a persistently run internal-procedure which handles the on 'leave' of the widget.

Well, here's my problem.....

When my fill-in is of type date and i type an invalid date in the field and then press tab, progress shows me a default error.

I do not want to show this message when a user presses the cancel button. In order to do this i put the following code in my persistent leave-procedure....

-------------------------------------

procedure ip_DynamischeLeave:

if (last-event:event-type = "PROGRESS" and
last-event:widget-enter = btn_cancel:handle in frame detail-frame)
then do:
if hnd_waarde:data-type = "date"
then
assign hnd_waarde:screen-value = ?.

return.
end.

...more code....

end procedure.

--------------------------------------

It works fine when i type an invalid date in the field and directly press the cancel button, but when i first give a tab and receive the default progress error ( number 80) and then press the cancel button i receive the same error.

When i keep trying to press cancel it sometimes suddenly exits the program like it should.

I'm very confused, because i don't know what's wrong....
I hope somebody can help me out.

Regards,

Luuk
 

Luuk

New Member
Ruud,

in het kader van de verzakelijking..... GA EENS AANT WERK :D

TABEE


RKR said:
Hi Luuk,

Why perform field-level validation, as this is not common windows practice. It is better to perform the validation of the field level widgets when the user presses the OK button. In that case there is no need to overrule the default Progress date validation.

Hope this helps,
 

Sroach

New Member
If you set the frame attribute NO-AUTO-VALIDATE to on then this will solve your problem. This option can be found by double clicking the frame which holds the widget.
 
I see a different angle to every body else here. Instead of trying NOT to get this problem thus altering your code when you have an idea for a different way of solving this prob. Accept that this method works to some extent and use it. Creating a trigger for the error created could be useful. I am going to code it this way, though this error will occur. So do a : ON ERROR DO: END block. Checking if the error occured is the epected error. Saves messing about with different design ideas. Use the 1 you are comfortable with and trap for the error you know you will get.
 
Top