Page 1 of 1

TComboBox

PostPosted: Sat Jun 07, 2008 11:06 am
by Enrico Maria Giordano
In the following sample, VALID clause is not fired when the combobox losts the focus:

Code: Select all  Expand view
#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

Re: Bug in TComboBox

PostPosted: Sat Jun 07, 2008 11:51 pm
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:

PostPosted: Sun Jun 08, 2008 5:20 am
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.

PostPosted: Sun Jun 08, 2008 12:56 pm
by Enrico Maria Giordano
No problem friends. I reported it only for Antonio. I don't need that fix at all.

EMG

PostPosted: Sun Jun 08, 2008 6:11 pm
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

PostPosted: Sun Jun 08, 2008 6:13 pm
by Enrico Maria Giordano
Please note that the combobox in my sample is a CBS_DROPDOWN one.

EMG

PostPosted: Mon Jun 09, 2008 6:59 am
by James Bott
Enrico,

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

Ops!

James

Re: Bug in TComboBox

PostPosted: Sat Jul 26, 2008 10:29 am
by Enrico Maria Giordano
Any news?

EMG