Page 1 of 1

Bug in TButton CANCEL clause

PostPosted: Fri Feb 17, 2006 10:45 pm
by Enrico Maria Giordano
The following sample shows that if you hit ALT-C the DIALOG is closed but the VALID of the GET is also executed while if you click on the button with the mouse the VALID is not executed (as it should be):

Code: Select all  Expand view
#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL cVar := SPACE( 20 )

    DEFINE DIALOG oDlg

    @ 1, 1 GET cVar;
           VALID ( MSGINFO( "Hello" ), .T. )

    @ 3, 1 BUTTON "&Close";
           ACTION oDlg:End();
           CANCEL

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


EMG

PostPosted: Sat Feb 18, 2006 1:48 am
by James Bott
Enrico,

I think you have it backwards. It sounds like the bug is in the Alt-C not the clicking the button. Valids are NOT supposed to be executed when the CANCEL clause is used. If there were, then you could not cancel a new (empty) dialog without filling in any data necessary to meet any VALIDs (and then such data would be discarded). Correct?

James

PostPosted: Sat Feb 18, 2006 12:48 pm
by Enrico Maria Giordano
Yes, the bug is in the Alt-C. That's what I said (or that I was trying to say, sorry for my bad english).

EMG

PostPosted: Sat Feb 18, 2006 12:57 pm
by dpaterso
Hello,

Quite right - just tested - does the same on all of my dialogs - Cancel Button (with CANCEL clause) when clicked - no problem / Alt-C - big problem - GET is VALIDATED.

Dale.

PostPosted: Sat Feb 18, 2006 8:15 pm
by James Bott
Enrico,

Yes, the bug is in the Alt-C. That's what I said (or that I was trying to say, sorry for my bad english).


My apologies, it was my misunderstanding--not your English. I misread this:

click on the button with the mouse the VALID is not executed (as it should be):


I thought is said "(but it should be)."

So, as you said Alt-C should not execute the VALID.

Regards,
James

PostPosted: Sat Feb 18, 2006 10:00 pm
by Enrico Maria Giordano
James Bott wrote:My apologies, it was my misunderstanding--not your English. I misread this:


No problems, James.

EMG