RECHERCHE PAR MOTS CLEFS AVEC UNE LISTBOX

cs_morinxav2 Messages postés 67 Date d'inscription mercredi 30 juin 2004 Statut Membre Dernière intervention 6 octobre 2011 - 8 janv. 2008 à 16:11
yannfrance Messages postés 48 Date d'inscription mardi 18 septembre 2007 Statut Membre Dernière intervention 1 décembre 2010 - 7 mai 2009 à 17:42
Cette discussion concerne un article du site. Pour la consulter dans son contexte d'origine, cliquez sur le lien ci-dessous.

https://codes-sources.commentcamarche.net/source/19591-recherche-par-mots-clefs-avec-une-listbox

yannfrance Messages postés 48 Date d'inscription mardi 18 septembre 2007 Statut Membre Dernière intervention 1 décembre 2010
7 mai 2009 à 17:42
merci beaucoup pour ce source, elle m'as tres bien servi.
Ca merite la note maxi...
cs_morinxav2 Messages postés 67 Date d'inscription mercredi 30 juin 2004 Statut Membre Dernière intervention 6 octobre 2011 4
8 janv. 2008 à 16:11
Bonsoir,
super cela m'a economisé quelques nuits de sommeil !!
juste deux fonctions supplèmentaires pour completer ton travail :

{-----------------< FUNCTION Cherche_ListBox_Suivant >-------------------}

function Cherche_ListBox_Suivant(Chaine : string ; ListBox : TListBox) : Integer;
var
Index : integer;
CurrentItem : string;

begin
Result := -1;
Chaine := UpperCase(Chaine);

for Index := listbox.ItemIndex+1 to ListBox.Items.Count - 1 do
begin
CurrentItem := UpperCase(ListBox.Items.Strings[Index]);
//AddError(IntToStr(Index) + ' WinText : ' + Chaine + ' Nb Sous Chaine : ' + IntToStr(NbSousChaine(Chaine, CurrentItem)));
//AddError(Chaine + ' - ' + CurrentItem);
if NbSousChaine(Chaine, CurrentItem) > 0 then
begin
Result := Index;
Exit;
end;
end;
end;
{----------------< FUNCTION Cherche_ListBox_Precedant >------------------}

function Cherche_ListBox_Precedant(Chaine : string ; ListBox : TListBox) : Integer;
var
Index : integer;
CurrentItem : string;

begin
Result := -1;
Chaine := UpperCase(Chaine);

for Index := listbox.ItemIndex-1 downto 0 do
begin
CurrentItem := UpperCase(ListBox.Items.Strings[Index]);
//AddError(IntToStr(Index) + ' WinText : ' + Chaine + ' Nb Sous Chaine : ' + IntToStr(NbSousChaine(Chaine, CurrentItem)));
//AddError(Chaine + ' - ' + CurrentItem);
if NbSousChaine(Chaine, CurrentItem) > 0 then
begin
Result := Index;
Exit;
end;
end;
end;
bonne prog, A+
Rejoignez-nous