Einzelnen Beitrag anzeigen

leonreiser

Registriert seit: 16. Jul 2015
30 Beiträge
 
Delphi XE8 Professional
 
#4

AW: GetItemAtPos macht bei Listbox manchmal probleme

  Alt 16. Jul 2015, 15:07
Natürlich. Also hier hab ich noch die zwei Routinen für das Füllen und leeren. Dabei soll man sozusagen mit einem Klick auf ein Item jenes in die jeweils andere
Listbox schreiben:
Delphi-Quellcode:
procedure TForm2.ListBox1Click(Sender: TObject);
var
I :Integer;
begin
  for I := 0 to ListBox1.Count-1 do
    if ListBox1.Selected[I] = True then begin
        ListBox2.Items.Add(ListBox1.Items[I] + '');

       ListBox1.Items.Delete(I);
        break;
    end;
    ListBox1.Height := 16 * ListBox1.Count; // geschmackssache
    ListBox2.Height := 16 * ListBox2.Count; // geschmackssache

end;

procedure TForm2.ListBox2Click(Sender: TObject);
var
I :Integer;
begin
  for I := 0 to ListBox2.Count-1 do
    if ListBox2.Selected[I] = True then begin
      // SortType[I] := Null;
      ListBox2.Items[I] := StringReplace(ListBox2.Items[I], '','',[rfReplaceAll , rfIgnoreCase]);
      ListBox2.Items[I] := StringReplace(ListBox2.Items[I], '','',[rfReplaceAll , rfIgnoreCase]);
        ListBox1.Items.Add(ListBox2.Items[I]);
        ListBox2.Items.Delete(I);
        break;
    end;
  ListBox1.Height := 16 * ListBox1.Count; // geschmackssache
    ListBox2.Height := 16 * ListBox2.Count; // geschmackssache
end;
  Mit Zitat antworten Zitat