Autor Beitrag
Quivadis
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 314

UBUNTU 9.04
D2005 PERS, JAVA, D7 Pers.
BeitragVerfasst: Di 21.12.04 11:31 
Hi Leute,

bin gerade am progen vom einem MS Paint - Klons. Bin schon ziemlich gut voran gekommen.
Nun habe ich leider doch ein Problem:

Wie kann ich mit einen Panel die rechte Maustaste auf einen Doppelklick abfragen?

linke und rechte maustaste frage ich schon auf click ab, ist eine andere Funktion.

Brauche das dringend.

Danke euch schonmal im vorraus

Quivadis

_________________
Wissen ist macht, nichts wissen macht auch nichts. ODER: Wer nichts weis, kann nichts vergessen.
rochus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 416

Win XP Prof, Fedora Core 4, SuSE 7.0
D7 Ent, D2005 Pers
BeitragVerfasst: Di 21.12.04 11:56 

_________________
Im Nachhinein ist man immer ein Schlauch!
"Dream as if you'll live forever, live as if you'll die today!" James Dean
Quivadis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 314

UBUNTU 9.04
D2005 PERS, JAVA, D7 Pers.
BeitragVerfasst: Di 21.12.04 12:03 
Danke erstmal, werde mich da mal einlesen. Bei Problemen frage ich wider, scheint nicht ganz ohne zu sein. Hoffe bekomme das irgendwie in delphi hin, weil bsp. sind dort alle in C/C++.

_________________
Wissen ist macht, nichts wissen macht auch nichts. ODER: Wer nichts weis, kann nichts vergessen.
rochus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 416

Win XP Prof, Fedora Core 4, SuSE 7.0
D7 Ent, D2005 Pers
BeitragVerfasst: Di 21.12.04 12:17 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
procedure TForm1.FormCreate(Sender: TObject);
begin
   OldWndProc := panel1.WindowProc;
   panel1.windowproc := MyWndProc;
end;

procedure TForm1.MyWndProc(var Message: TMessage);
begin
   case Message.Msg of
      WM_RBUTTONDBLCLK :
         begin
            ShowMessage('blubb');
         end;
      else
         OldWndProc(Message);
   end;
end;

_________________
Im Nachhinein ist man immer ein Schlauch!
"Dream as if you'll live forever, live as if you'll die today!" James Dean
MrSaint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1033
Erhaltene Danke: 1

WinXP Pro SP2
Delphi 6 Prof.
BeitragVerfasst: Di 21.12.04 12:21 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm1.FormCreate(Sender: TObject);
begin
   OldWndProc := panel1.WindowProc;
   panel1.windowproc := MyWndProc;
end;

procedure TForm1.MyWndProc(var Message: TMessage);
begin
   case Message.Msg of
      WM_RBUTTONDBLCLK :
         begin
            ShowMessage('blubb');
            OldWndProc(Message);   // <- würd ich sagen ;) Net, dass noch was verloren geht :)
         end;
      else
         OldWndProc(Message);
   end;
end;

_________________
"people knew how to write small, efficient programs [...], a skill that has subsequently been lost"
Andrew S. Tanenbaum - Modern Operating Systems
rochus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 416

Win XP Prof, Fedora Core 4, SuSE 7.0
D7 Ent, D2005 Pers
BeitragVerfasst: Di 21.12.04 12:42 
ist in dem fall eigentlich egal, weil rdblclick von dem panel nicht weiter beachtet wird.

aufpassen musst du aber, wenn du z.B. den message.result änderst und danach noch die alte wndproc aufrufst, dann wird das result eventuell wieder verändert.

gruß

_________________
Im Nachhinein ist man immer ein Schlauch!
"Dream as if you'll live forever, live as if you'll die today!" James Dean
Quivadis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 314

UBUNTU 9.04
D2005 PERS, JAVA, D7 Pers.
BeitragVerfasst: Di 21.12.04 12:42 
Danke mal testen ob es in meinem Projekt funktioniert. Auf diesen Quelltext wäre ich nie im Leben gekommen. Lerne ja noch Delphi.

Wenns geht mal schauen wie man das dür ca 30 panels umschreiben muss.

nochmals DANKE.

_________________
Wissen ist macht, nichts wissen macht auch nichts. ODER: Wer nichts weis, kann nichts vergessen.
MrSaint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1033
Erhaltene Danke: 1

WinXP Pro SP2
Delphi 6 Prof.
BeitragVerfasst: Di 21.12.04 12:47 
rochus hat folgendes geschrieben:
ist in dem fall eigentlich egal, weil rdblclick von dem panel nicht weiter beachtet wird.


Is aber dennoch sicherer, falls man den Code eben auch mal für was anderes benutzt (z.B. das Panel selber nochmal neu ableitet udn da dann was mit dem RightClick tut, aber nicht mehr drandenkt, dass die Message nicht kommt, da würde man bestimmt ewig suchen). Sicher ist sicher...



MrSaint

_________________
"people knew how to write small, efficient programs [...], a skill that has subsequently been lost"
Andrew S. Tanenbaum - Modern Operating Systems
Quivadis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 314

UBUNTU 9.04
D2005 PERS, JAVA, D7 Pers.
BeitragVerfasst: Di 21.12.04 12:56 
Habe den code mal soeben in mein Projekt eingefügt.

Wird aber nicht kompilliert. Es kommt folgender Fehler:
ausblenden Delphi-Quelltext
1:
[Fehler] Malen_main.pas(653): Undefinierter Bezeichner: 'OldWndProc'					


Welchen Datentyp muss OldWndProc denn haben?

_________________
Wissen ist macht, nichts wissen macht auch nichts. ODER: Wer nichts weis, kann nichts vergessen.
MrSaint
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1033
Erhaltene Danke: 1

WinXP Pro SP2
Delphi 6 Prof.
BeitragVerfasst: Di 21.12.04 12:58 
Ein Blick in die Delphi Hilfe sagt mir: "TWndMethod" :D

_________________
"people knew how to write small, efficient programs [...], a skill that has subsequently been lost"
Andrew S. Tanenbaum - Modern Operating Systems
Quivadis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 314

UBUNTU 9.04
D2005 PERS, JAVA, D7 Pers.
BeitragVerfasst: Di 21.12.04 14:12 
Danke euch. Habe jetzt auch eine DelghiKonforme Lösung gefunden.

Hier der Quellcode dazu:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if (ssRight in Shift) and (ssDouble in shift) then
  begin
    ShowMessage('RDBL-OK!')
  end;
end;


nehme jetzt diese gefundene Lösung. Passt besser in mein Projekt. Habe ja ca. 30 panels. Mit dieser procedure kann ich die alle über sender erreichen.

_________________
Wissen ist macht, nichts wissen macht auch nichts. ODER: Wer nichts weis, kann nichts vergessen.