Autor Beitrag
Martok
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: So 19.09.10 19:37 
Hallo!

Ein ListView soll bei Doppelklick auf ein Item ein Editorfenster öffnen. Idealerweise sollte das so sein, dass je nach angeklickter Spalte ein anderer Editor geöffnet wird (sonst müsste ich alles in einen quetschen, und das wir dann hässlich).

Dazu muss ich aber rauskriegen, wo geklickt wurde. Die Mausposition kriegt man ja dann per .ScreenToClient(Mouse.CursorPos) - aber wie kriege ich jetzt am schönsten raus welche Spalte das war?
Eine einfache HitTest-Routine dafür scheint es nicht zu geben, die kann mir nur sagen welches Item getroffen wurde. Aber das weiß ich ja dank .Selected schon :gruebel:

Danke schonmal,
Martok

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: So 19.09.10 20:11 
Ich habe es nicht ausprobiert, aber ist nicht genau dafür der Subitem-Hittest da?
LVM_SUBITEMHITTEST
Martok Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 3661
Erhaltene Danke: 604

Win 8.1, Win 10 x64
Pascal: Lazarus Snapshot, Delphi 7,2007; PHP, JS: WebStorm
BeitragVerfasst: So 19.09.10 20:35 
Korrekt, aber das ist eine derer die Borland für die D7-VCL nicht einbauen wollte.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
    hti.pt:= lvPlanGames.ScreenToClient(Mouse.CursorPos);
    ListView_SubItemHitTest(lvPlanGames.Handle, @hti);
    case hti.iSubItem of
      // Datum
      4 : begin
{...}

CommCtrl nicht vergessen.

Danke!

_________________
"The phoenix's price isn't inevitable. It's not part of some deep balance built into the universe. It's just the parts of the game where you haven't figured out yet how to cheat."