![]() |
OnMouseOver bei Listbox Items
Hi,
ich würde gerne, wenn man mit der Maus über ein Item einer Listbox fährt einen Hint oder eine Beschreibung dazu anzeigen... Wie kann ich das realisieren? Synonym |
Re: OnMouseOver bei Listbox Items
Hallo
ich verwende diesen Code für ein Stringrid, er würde jede Zelle als hint anzeigen
Delphi-Quellcode:
er zeigt aber, was du machen mußt (application.cancelhint, sonst siehst du keinen neuen Hint).
procedure TForm1.StringGrid1MouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer); var MyRow, MyCol: Integer; oldhint:string; begin oldhint:=StringGrid1.hint; StringGrid1.MouseToCell(x, y, MyCol, MyRow); if (MyRow<>-1) and (Mycol<>-1) then StringGrid1.hint:=StringGrid1.Cells[mycol,myrow] else StringGrid1.hint:=''; if oldhint<>StringGrid1.hint then Application.CancelHint; end; Brauchst das nur an die listbox anpassen und mousetocell mit ItemAtPos auswechseln. Mfg Frank |
Re: OnMouseOver bei Listbox Items
hi,
habs schnell für ne listbox gemacht:
Delphi-Quellcode:
[edit 1001] junge, junge ... war echt neben mir :drunken: - nochmal alles geändert [/edit 1001]
procedure TForm1.ListBox1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
var idx: integer; olh: string; begin with listbox1 do begin olh := hint; idx := itematpos(point(x, y), false); if (idx <= items.count - 1) then hint := items.strings[idx] else hint := ''; if hint <> olh then application.cancelhint end end; |
Re: OnMouseOver bei Listbox Items
auch ausprobiert? ;)
Delphi-Quellcode:
deine Chancen auf das richtige Item bei einer gescrollten Listbox sind gering.
idx := round(y div itemheight);
richtiger wäre listbox1.itematpos(...); edit: if hint <> oh then application.CancelHint würd ich ans ende setzen, kannst du probieren, wenn du über dem letztem item und dem unteren rand bist Mfg Frank |
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:31 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