locked
Stop Valid event firing RRS feed

  • Question

  • I need to stop Textbox Valid event firing when releasing the form. The problem is my form has a cancel button to release the form. If the focus is on textbox and when I try to click on Cancel then the textbox valid event fires.

    Is there any direct way to stop that?

    Thursday, April 5, 2012 6:47 AM

Answers

  • Hello, I check in valid whether an object with CANCEL=.t. (button property) was clicked. Like this in the valid event : Local oob oob=Sys(1270) If Lastkey()==27 .Or. (Type("oob.cancel")=="L" .And. oob.Cancel==.T. Return .T. ENDIF Other check code Return checkerg HTH Tom
    • Proposed as answer by Olaf Doschke Thursday, April 5, 2012 7:09 AM
    • Marked as answer by Youen Zen Wednesday, April 18, 2012 8:26 AM
    Thursday, April 5, 2012 6:53 AM

All replies

  • Hello, I check in valid whether an object with CANCEL=.t. (button property) was clicked. Like this in the valid event : Local oob oob=Sys(1270) If Lastkey()==27 .Or. (Type("oob.cancel")=="L" .And. oob.Cancel==.T. Return .T. ENDIF Other check code Return checkerg HTH Tom
    • Proposed as answer by Olaf Doschke Thursday, April 5, 2012 7:09 AM
    • Marked as answer by Youen Zen Wednesday, April 18, 2012 8:26 AM
    Thursday, April 5, 2012 6:53 AM
  • Checking Lastekey()=27 is sufficient, becuase a button with Cancel=.T. will cause that ESC key pressed, too.

    But otherwise Tom has given you the answer, skip the valid check, if Lastkey()=27.

    Bye, Olaf.

    Thursday, April 5, 2012 7:08 AM