Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Disabling ComboBox When No Data
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
01259788
Message ID:
01259804
Vues:
16
Jerry,

You can put in the init of the listbox something like
Bindevent(this, 'AddItem', thisform, 'CheckCombo', 1)
Bindevent(this, 'AddListItem', thisform, 'CheckCombo', 1)
Bindevent(this, 'RemoveItem', thisform, 'CheckCombo', 1)
Bindevent(this, 'RemoveListItem', thisform, 'CheckCombo', 1)
Bindevent(this, 'RowSourceType', thisform, 'CheckCombo', 1)
Bindevent(this, 'RowSource', thisform, 'CheckCombo', 1)
Then you create a CheckCombo method in your form with
thisform.ComboBox.Enabled = (thisform.ComboBox.ListCount > 0)
Of course if you are subclasing the listbox, the CheckCombo should be a method of the class.

Not sure if I forgot another event that might change the ListCount


[Update]
I forgot you need an lparameters in the CheckCombo method in order to successfully bind to the first 4 events


>I am creating a parent ComboBox class. I want it to automatically disable when nothing is in the combobox; in other words,
>
>ComboBox.Enabled = (ComboBox.ListCount > 0)
>
> I have tried putting the above code into the When, Requery, Refresh, ListCount_Access, ProgrammaticChange, and other methods, but nothing seems to work. None of them fire when the ListCount changes.
> How can I get it to enable/disable whenever the ListCount changes?
>
>Jerry
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform