Bug in TButton CANCEL clause

Post Reply
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Bug in TButton CANCEL clause

Post 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

#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
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post 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
dpaterso
Posts: 142
Joined: Tue Jan 24, 2006 9:45 am
Location: South Africa
Contact:

Post 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.
User avatar
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post 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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

James Bott wrote:My apologies, it was my misunderstanding--not your English. I misread this:
No problems, James.

EMG
Post Reply