TComboBox

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

TComboBox

Post by Enrico Maria Giordano »

In the following sample, VALID clause is not fired when the combobox losts the focus:

Code: Select all

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    LOCAL oCbx, cVar := SPACE( 20 )

    DEFINE DIALOG oDlg

    @ 1, 1 COMBOBOX oCbx VAR cVar;
           ITEMS { "First", "Second", "Third" };
           STYLE CBS_DROPDOWN;
           VALID ( MSGINFO( "Valid" ), .T. )

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

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL
EMG
User avatar
Ugo
Posts: 283
Joined: Sat Oct 15, 2005 6:40 am
Location: Turin, Italy

Re: Bug in TComboBox

Post by Ugo »

Enrico Maria Giordano wrote:In the following sample, VALID clause is not fired when the combobox losts the focus
Enrico,
not fired when the combobox lost the focus but fired when the button lost the focus! :shock:
Ciao, best regards,
Ugo
Colin Wisbey
Posts: 56
Joined: Mon Jul 03, 2006 2:34 am

Post by Colin Wisbey »

Enrico,

I'm afraid I can't help. I gave up on valid's with comboboxes about 10 years ago after raising the problem many times. I came up with a fix back then (IIRC it required change to CONTROL and also to DEFAULT method in COMBOBOX.prg) but I can no longer find it and it got broken in a subsequent upgrade anyway. I'm not convinced valid on a combobox (without modifications) has ever completely worked (although I could be wrong).

As an aside, although I can confirm the bug you reported, I suggest you avoid using MSGINFO() to test for a VALID as that can shift the focus to the MSGINFO(). I use something like MSGBEEP() instead.
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Post by Enrico Maria Giordano »

No problem friends. I reported it only for Antonio. I don't need that fix at all.

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 »

Theoretically it seems one would not need to validate a combobox selection since only valid options are available in the list.

If you need to call a codeblock for some other use, perhaps you could use bLostFocus.

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 »

Please note that the combobox in my sample is a CBS_DROPDOWN one.

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,

>Please note that the combobox in my sample is a CBS_DROPDOWN one.

Ops!

James
Post Reply