Autor Beitrag
O'rallY
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 563



BeitragVerfasst: Do 01.08.02 16:09 
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
procedure Tform_Main.TreeView1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

var
        CPos: TPoint;
begin
        GetCursorPos(Cpos);

        if Button = mbRight then
        begin;
           Button := mbLeft;

          //Abfrage ob bestimmter Node gedrückt wurde und Reaktion



           PopupMenu1.Popup(CPos.X, CPos.Y)
        end;
end;


Ich will bei, drücken der rechten Maustaste auf eine Komponente TTreeView, feststellen, ob was für ein Node selektiert ist und dementsprechend ein modifiziertes PopupMenu aufpopen lassen. Nur das Problem ist, wenn ich ein Node in der Kompo anklicke (mit der rechten Mt.), wird dieser nicht selektiert und dem entsprechend kann ich nicht auswerten, welcher selktiert wurde. Ich habe die Eigenschaft RightClickSelect schon auf TRUE gestellt.
Ich hab auch schon probiert bei klicken der rechten Maustaste der Komponente "vorzugaukeln", dass die linke Maustaste gedrückt wurde,
ausblenden Quelltext
1:
2:
3:
...
Button := mbLeft;
...


doch auch das funktioniert nicht.
Bitte um Hilfe!
Tpercon
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 60



BeitragVerfasst: Do 01.08.02 20:36 
Hi

Schau mal in der Hilfe nach: TreeView1.GetNodeAt

Das müßte dir weiter helfen.

Gruß
O'rallY Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 563



BeitragVerfasst: Mo 26.08.02 12:32 
Ok, das hat mir schon mal weitergeholfen. Doch richtig funktionieren tut es noch nicht (jedenfalls nicht so wie ich es anwende). Ich habs mal so versucht:
ausblenden Quelltext
1:
TreeView1.GetNodeAt({Mausposition X}, {Mausposition Y}).Selected := true;					


Wenn ich nun ein Item zur Laufzeit mit der rechten Maustaste anklicke, erscheint folgende Fehlermeldung:
Access violation at address ...... in module .......
toms
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 1099
Erhaltene Danke: 2



BeitragVerfasst: Mo 26.08.02 12:42 
O'rallY Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 563



BeitragVerfasst: Mo 26.08.02 12:46 
Sper, so funktionierts. Vielen Dank!