Konuyu Oyla:
  • Derecelendirme: 0/5 - 0 oy
  • 1
  • 2
  • 3
  • 4
  • 5
Kordinat index no
#1
Merhaba. Foruma yeni katıldım  Blush


Aşağıdaki kodları netde araştırma yaparken buldum. Listviewde satırın index numarasını sorunsuz alabiliyorum. 
Fakat listbox için uyarladığımda hata alıyorum. Çözüm için ne yapabilirim acaba.

Hata Kodu
error F2063: F2063 Could not compile used unit 'dinamik.pas'




function ListBoxGetIndexAtPos(LBox: TListBox; TP: TPointF): Integer;
begin
  Result := -1;
  for I := 0 to LBox.Items.Count - 1 do
  begin
    Tr := LBox.GetItemRect(I);
    if Tr.Contains(TP) then
    begin
      Result := I;
      Break;
    end;
  end;
end;


  try
    Obj := ObjectAtPoint(Screen.MousePos);
    if Obj <> Nil then
    begin
      LBIndex := ListBoxGetIndexAtPos(ListBoxDin, Point);
      if LBIndex <> -1 then
      begin

Cevapla
#2
Foruma hoş geldiniz  Smile

Sorunuza başka bir fonksiyon grubu ile cevap vereyim. 
if PtInRect( ListBox.BoundsRect, P ) 

ile P koordinatlarının ilgili Listbox üzerinde mi sorgusunu yaptıktan sonra

   Listbox.ItemByPoint( PListBox.X, PListBox.Y ).Index 

değeri item indexi verir. 

Tabi Listbox position.X ve Y değerlerine odaklı olarak P.X ve Y değerlerini - /+ revize ettikten sonra. 

PListBox burada revize edilmiş koordinatı temsil ediyor.
Saygılarımla
Muharrem ARMAN

guplouajuixjzfm15eqb.gif
Cevapla


Konu ile Alakalı Benzer Konular
Konular Yazar Yorumlar Okunma Son Yorum
  Adresten Konum Kordinat bulma [Çözüldü.] codder71 6 1.215 20-05-2023, Saat: 22:38
Son Yorum: codder71
  Invalid imagelist index hido 10 7.089 11-08-2019, Saat: 16:18
Son Yorum: uzanet
  Image Index numarasını alma ahmetb 3 2.924 24-09-2018, Saat: 11:36
Son Yorum: ahmetb
  Listview index number update YasinDalli 3 2.593 20-09-2018, Saat: 15:00
Son Yorum: mrmarman
  Kordinat mesafe hesaplama hassur 2 2.348 15-05-2018, Saat: 23:58
Son Yorum: mcuyan



Konuyu Okuyanlar: 1 Ziyaretçi