Jordi.Tolra
5th July 2012, 12:07
Hola a tothom,

does somebody know how can I identify that the user press the button Cancel in choice option Find (def.find)?

thanks & regards

Jordi

zardoz
5th July 2012, 12:22
Just put a variable like:

boolean find.executed
....
.....
choice.def.find:
before.choice:
find.executed = FALSE
after.choice:
find.executed = TRUE

if the user cancel the operation, the after.choice isn't executed, so you can test the var find.executed to see if this happened.

Jordi.Tolra
5th July 2012, 12:35
But after.choice section is executed although Cancel is pressed. In fact this is my problem there are some actions in the section after.choice which should be only executed if the user press Ok button.

mark_h
5th July 2012, 16:06
You can try something like this - no promises it will work, but I believe when you hit okay it runs at least main table io section:

choice.def.find:
before.choice:
find.some.record = true

main.table.io:
before.read:
if find.some.record then
........do what you were doing......
find.some.record = false
endif


Now depending on what you want to do you could use before.read or the after.read section. If this does not work one way to find alternatives is to enter every possible event section available to the program. Then trace through everything that happens when okay is hit or if cancel is hit. I think when cancel is hit it just knows to stop - but I do not know how it knows.

Another thing you can try is to put the session in debug mode and do upper case L on the before.choice and after.choice section to see if you see anything that might relate to the cancel key. I did not readily see anything, but that does not mean I did not miss something.

Hitesh Shah
5th July 2012, 17:02
But after.choice section is executed although Cancel is pressed. In fact this is my problem there are some actions in the section after.choice which should be only executed if the user press Ok button.

Ideally on cancel after.choice should not be executed . But that's not correct . In such a case i think there is no way to trap .

U can check the value of variables like e stp.io.error etc . But the chances are that there is none to trap cancel click .

But this means program must be finding whatever written in find window whether you press ok or cancel . So would request this functionality the way it is .

However you can always do some checking in field events of index field and check for condition like choice = def.find to something specific to find choice.

Jordi.Tolra
6th July 2012, 11:58
Many thanks Mark,

the workaround that you proposed solves my problem.

Best regards

Jordi