Merci oh maitre :)
MagicVinni
-------------------------------
Réponse au message :
-------------------------------
> Il y a une autre méthode, qui réalise ce que tu veux. Mais c'est un peu détourné. Met la propriété Style du ComboBox à csOwnerDrawFixed, puis ajoute le code suivant dans OnDrawItem :
> procedure TForm1.ComboBox1DrawItem(Control: TWinControl; Index: Integer;
> Rect: TRect; State: TOwnerDrawState);
> begin
> With ComboBox1 Do With Canvas Do
> Begin
> FillRect(Rect);
> if odSelected In State
> Then Font.Color := clHighLightText
> Else Font.Color := clBtnText;
> If Index>=0
> Then Begin
> If (Items[Index]='Autre')And (odComboBoxEdit In State )
> Then TextOut(Rect.Left, Rect.Top, 'Vous avez fait un autre choix')
> Else TextOut(Rect.Left, Rect.Top, Items[Index]);
> End;
> End;
> end;
>
>
> ---

Nono40@fr.st

---
> Nouveau --->
Nono40.fr.st>
>
> -------------------------------
> Réponse au message :
> -------------------------------
>
> > Merci,
> > Mais je voudrais pouvoir garder l'item "autre" et seulement changer le texte de la combobox, c'est possible tu penses?
> > Merci
> > MagicVinni
> >
> >
> > -------------------------------
> > Réponse au message :
> > -------------------------------
> >
> > > Dans l'évènement OnChange du composant TComboBox :
> > > procedure TForm1.ComboBox1Change(Sender: TObject);
> > > begin
> > > with ComboBox1 do
> > > if Items.IndexOf('Autre') = ItemIndex then
> > > begin
> > > Items[ItemIndex] := 'Vous avez fait un autre choix';
> > > ItemIndex := Items.IndexOf('Vous avez fait un autre choix');
> > > end;
> > > end;
> > >
> > >
May Delphi be with you> > >
> > >
> > > -------------------------------
> > > Réponse au message :
> > > -------------------------------
> > >
> > > > Bonjour,
> > > > J'ai un comboBox, avec une liste de choix et j'ai rajoutté un dernier item : "autre". Je voudrais que quand on clique sur autre, il y ai ecrit dans la comboBox : 'Vous avez fait un autre choix'. Je fais donc :
> > > >
> > > > ComboBox.Text:='Vous......' et là rien ne se passe puisque lorque l'on choisit "autre" et bien il est écrit "autre". Comment faire donc pour forcer l'affichage du texte?
> > > > Merci
> > > > MagicVinni
> > >
> >
>