FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index Bugs report & fixes / Informe de errores y arreglos TComboBox
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
TComboBox
Posted: Sat Jun 07, 2008 11:06 AM
In the following sample, VALID clause is not fired when the combobox losts the focus:

#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
Posts: 283
Joined: Sat Oct 15, 2005 06:40 AM
Re: Bug in TComboBox
Posted: Sat Jun 07, 2008 11:51 PM
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! :-)
Ciao, best regards,

Ugo
Posts: 56
Joined: Mon Jul 03, 2006 02:34 AM
TComboBox
Posted: Sun Jun 08, 2008 05:20 AM

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.

Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
TComboBox
Posted: Sun Jun 08, 2008 12:56 PM

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

EMG

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
TComboBox
Posted: Sun Jun 08, 2008 06:11 PM

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

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM
TComboBox
Posted: Sun Jun 08, 2008 06:13 PM

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

EMG

Posts: 4840
Joined: Fri Nov 18, 2005 04:52 PM
TComboBox
Posted: Mon Jun 09, 2008 06:59 AM

Enrico,

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

Ops!

James

FWH 18.05/xHarbour 1.2.3/BCC7/Windows 10
Posts: 9022
Joined: Thu Oct 06, 2005 08:17 PM

Continue the discussion