Konuyu Oyla:
  • Derecelendirme: 5/5 - 1 oy
  • 1
  • 2
  • 3
  • 4
  • 5
İnsert işleminin tutarsızlığı
#1
Selamün aleyküm.

İki faklı listviewler arası drag and dpor ile insert işlemi gerçekleştiriyorum. 
İlk eklediğim indexlerde herhangi bir hata oluşturmuyor. Fakat araka, arkaya farklı indexleri ekleme istediğimde, benim seçtiğim değilde faklı bir index ekliyor bu durumu nasıl çözebilirim?

Saygılarımla.



function GetIndexAtPos(LV: TListView; TP: TPointF): Integer;
var
  I: Integer;
  TR: TRectF;
begin
  Result := -1;
  for I := 0 to LV.Items.Count - 1 do
  begin
    TR := LV.GetItemRect(I);
    if TR.Contains(TP) then
    begin
      Result := I;
      Break;
    end;
  end;
end;

procedure TForm1.ListPDragDrop(Sender: TObject; const [Ref] Data: TDragObject;
  const [Ref] Point: TPointF);
var
  Obj: IControl;
  Plx, Pgx: Integer;
begin
  Obj := ObjectAtPoint(Screen.MousePos);
  if Obj <> Nil then
  begin
    Plx := GetIndexAtPos(ListP, Point);
    Pgx := GetIndexAtPos(ListL, Point);
    if Plx <> -1 then
    begin
      ListP.Items.Insert(Plx);
      ListP.Items[Plx].Data['Metre'] := ListL.Items[Pgx].Data['Metre'].ToString;
    end;
  end;
end;

procedure TForm1.ListPDragOver(Sender: TObject; const [Ref] Data: TDragObject;
  const [Ref] Point: TPointF; var Operation: TDragOperation);
begin
  Operation := TDragOperation.Move;
end;
Cevapla
#2
İlk eklemeden sonra indexlerin sırası değişiyor gibi
Yalnızım ama bir kente yürüyen ordu gibiyim, edebiyattan kaçınmalıyım..
Cevapla


Konu ile Alakalı Benzer Konular
Konular Yazar Yorumlar Okunma Son Yorum
Question Android Device ID Tutarsızlığı YILDIRIMBEY 3 2.522 16-05-2022, Saat: 17:11
Son Yorum: mcuyan
  Web servis uygulması ile Json veri ile update insert select ? diseqc 4 2.425 19-03-2022, Saat: 07:01
Son Yorum: diseqc
  datasnap insert into gonulali 7 2.740 02-10-2021, Saat: 10:49
Son Yorum: gonulali
  Insert ve Silme yakalama ahmetb 4 4.336 18-04-2019, Saat: 16:29
Son Yorum: shooterman
  Listbox insert YasinDalli 10 9.114 07-09-2018, Saat: 12:01
Son Yorum: YasinDalli



Konuyu Okuyanlar: 1 Ziyaretçi