Autor Beitrag
zero_cool1986
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 95

MS DOS ;)
D6
BeitragVerfasst: Sa 19.01.08 12:45 
Hi, Liebe Community, ich hab da mal ne Frage , ich kome einfach weiter, und zwar habe ich eine Form die ist 600 Pixel Breit, Nun möchte ich, Das wen mein Mauszeiger sich in der linken helfte befindet also <300 ein Ereigniss aufrufen
und andersherum >300...

Ich hab mir gedacht das ganze in einen Timer zu stecken weis vil. wer ne Lösung wäre sehr net

MFG :)
nagel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 708

Win7, Ubuntu 10.10

BeitragVerfasst: Sa 19.01.08 12:53 
Die hast die Antwort schon selbst im Titel deines Threads gegeben: :wink:
Das Ereignis OnMouseMove deiner Form wird bei jeder Mausbewegung aufgerufen und liefert dir als Parameter die aktuellen Koordinaten.
Tilo
ontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1098
Erhaltene Danke: 13

Win7 geg. WInXP oder sogar Win98
Rad2007
BeitragVerfasst: Sa 19.01.08 12:53 
Das Ereignis OnMouseMove hat die Parameter X und Y für die MausPosition.
Mist Nagel war schneller
zero_cool1986 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 95

MS DOS ;)
D6
BeitragVerfasst: Sa 19.01.08 13:00 
Ok danke, nun möchte ich aber wissen wie ich es aufrufe, also Form1.onemousemove geht ja nicht :)
zero_cool1986 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 95

MS DOS ;)
D6
BeitragVerfasst: Sa 19.01.08 13:07 
ok habs ^^
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Sa 19.01.08 13:14 
Wenn du keine anderen Controls auf deiner Form hast, wird das Ereignis OnMouseMove deines Formulars bei jeder Mausbewegung aufgerufen. Wenn sich aber andere Controls auf deinem Formular befinden, wird es schwierig.

Du könntest zum Beispiel einen Timer erstellen, das Interval sehr niedrig einstellen, und dann folgende TimerTimer-Prozedur als Ereigniss deines Timers festlegen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
procedure TForm1.Timer1Timer(Sender: TObject);
var Pos: TPoint;
begin
  // Mausposition ermitteln
  GetCursorPos(Pos);
  // Mausposition relativ zum Formular
  Pos := ScreenToClient(Pos);
  // Wenn Maus nicht im Fenster, Prozedur verlassen
  if (Pos.Y < 0or (Pos.Y >= ClientHeight) or (Pos.X < 0or (Pos.X >= ClientWidth) then Exit;
  if Pos.X < 300 then
  begin
    {linke Hälfte}
  end
  else
  begin
    {rechte Hälfte}
  end;
end;