AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Combobox mit suche

Ein Thema von Tyrael Y. · begonnen am 25. Feb 2008 · letzter Beitrag vom 26. Feb 2008
Antwort Antwort
Tyrael Y.

Registriert seit: 28. Jul 2003
Ort: Stuttgart
1.093 Beiträge
 
Delphi 2007 Professional
 
#1

Re: Combobox mit suche

  Alt 26. Feb 2008, 09:26
Direkt konnte ich mit dieser Komponente nix anfangen.

Ich habe es leicht modifiziert und jetzt reagiert ist so, wie ich es wollte.
Bisschen umständlich ist die Handhabung, da man die zweite Liste von Hand füllen muss. Für jedes Item, das man einfügt muss man beachten, das der angezeigte string auch in die zweite Liste eingefügt werden muss. Dies findet nicht automatsich statt.

Hier mal die modifizierte Stelle, das auskommentierte ist der Originalcode

Delphi-Quellcode:
    //if InputLength > 0 then
    //begin
      // Add the items that should be in the dropdownlist to a temporary
      // stringlist, this way you know whether there actually are items
      // to appear in the dropdownlist before manipulating the combobox.
      TempList := TStringList.Create;
      try
        // FDropDownListCandidates is the list that contains all potential items
        // for the dropdownlist.
        for i := 0 to FDropDownListCandidates.Count - 1 do
        begin
          // Add the FDropDownListCandidates to the TempList that are
          // same as strInput:

          //if UpperCase(Copy(FDropDownListCandidates[i], 1, InputLength)) =
          // UpperCase(strInput) then
          if strInput = #0 then
          begin
            TempList.Add(FDropDownListCandidates[i]);
          end
          else
          if Pos(UpperCase(Trim(strInput)), UpperCase(FDropDownListCandidates[i])) > 0 then
          begin
            TempList.Add(FDropDownListCandidates[i]);
          end;
        end;
        if TempList.Count > 0 then
        begin
          // There are items to be displayed in the dropdownlist.
          // First add dummy items before making DroppedDown = True
          // because the DropDownCount can not be increased once it is
          // dropped down:
          for i := 1 to DropDownCount do
          begin
            Items.Add('');
          end;
          DroppedDown := True;
          // Remove dummy items:
          Items.Clear;
          // Copy TempList to Items:
          Items := TempList;
        end
        else // Templist.Count = 0, don't show the DropDownList:
          DroppedDown := False;
      finally
        TempList.Free;
      end;
    //end;
    //else // Length(strInput) = 0, no input, don't show the DropDownList:
    // DroppedDown := False;
Levent Yildirim
Erzeugung von Icons aus Bildern:IconLev
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:44 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz