TCheckListBox

cs_MAsterC Messages postés 217 Date d'inscription lundi 4 février 2002 Statut Membre Dernière intervention 19 décembre 2012 - 5 janv. 2004 à 09:13
yvemoreau Messages postés 308 Date d'inscription mardi 11 juin 2002 Statut Membre Dernière intervention 26 septembre 2008 - 5 janv. 2004 à 23:10
Salut à tous!

Dans mon application j'utilise le Composant TCheckListBox.
TCheckListBox à l'évênement: OnClickCheck

En utilisant cette évênement, j'aimerai détecté si une case à été coché ou décocher tous en ce bassant sur le "Items.Text" (Le Nom de l'item)...

Mais avec de nombreux test, ils ont tous échoué :(
Alors, si quelqu'un pourrait m'aider sur ce problème, il me serait bien utile!

Merci d'avance!

- MAsterC -

1 réponse

yvemoreau Messages postés 308 Date d'inscription mardi 11 juin 2002 Statut Membre Dernière intervention 26 septembre 2008
5 janv. 2004 à 23:10
procedure TForm1.CheckListBox1Click(Sender: TObject);
begin
if(CheckListBox1.State[
CheckListBox1.Items.IndexOf(
CheckListBox1.Items.Strings[0])]
=cbChecked)then beep;
end;

bon pour un test ça fonctionne,mais pour trier ,il te faudra utiliser des booleans pour mémoriser les états ,avec ceux par défaut à la création...

et peut-être aussi simplifier si les items ne changent pas alors tu connais leur position...

if(CheckListBox1.State[0]=cbChecked)then ...
if(CheckListBox1.State[1]=cbChecked)then ...

type TCheckBoxState = (cbUnchecked, cbChecked, cbGrayed);

yve
0
Rejoignez-nous