Вниз
Скачать: CL | DM;

Можно ли в ListBox узнать по какой букве в строке был клик   Найти похожие ветки 

 
ListBox   (2006-02-04 00:26) [0]

или по какому слову в строке?


 
vidiv ©   (2006-02-04 12:24) [1]

Без изврата - врядли.


 
vidiv ©   (2006-02-04 12:56) [2]

Вот пример изврата:

procedure TForm1.ListBox1MouseUp(Sender: TObject; Button: TMouseButton;
 Shift: TShiftState; X, Y: Integer);
var ir: TRect;
   i,j:integer;
   s:string;
   ListBox:TListBox;
begin
 ListBox := Sender as TListBox;
 j := ListBox.ItemAtPos(Point(X, Y), True);
 if j>=0 then begin
   ListBox.Canvas.Font := ListBox.Font;
   ir := ListBox.ItemRect(j);
   x := x - ir.Left - 2;
   s := ListBox.Items[j];
   j := 0;

   for i:=1 to length(s) do begin
     if ListBox.Canvas.TextWidth(copy(s, 1, i)) > x then begin
         j := i;
         break
       end;
   end;
   if j > 0 then begin
     showmessage("Вы кликнули по букве номер "+inttostr(j));
   end else begin
     showmessage("Вы не попали по букве");
   end;
 end;
end;


 
Gero ©   (2006-02-04 12:59) [3]

Можно, но в общем случае довольно сложно.


 
ListBox   (2006-02-04 20:35) [4]

Спасибо!



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.03 c
15-1138696408
syte_ser78
2006-01-31 11:33
2006.02.19
символ перехода на следующую строку?


2-1138725144
Neo Trinitron
2006-01-31 19:32
2006.02.19
сортировка в TListViev


15-1138307938
Kerk
2006-01-26 23:38
2006.02.19
Шаблон Word


2-1139080529
ПОМОГИТЕ
2006-02-04 22:15
2006.02.19
нету темы


2-1138896565
park
2006-02-02 19:09
2006.02.19
Не запускается скомпилированая программа




   Наверх