Autor Beitrag
flamx
Hält's aus hier
Beiträge: 6



BeitragVerfasst: Do 29.09.05 15:00 
ka obs hier reinkomm....


habe herausgefunden, das ich damit

ausblenden Delphi-Quelltext
1:
2:
3:
4:
procedure TForm1.Button1Click(Sender: TObject);
begin
SetCursorPos(x, y);
end;


den maus cursor versetzen kann. aber der bezieht die position wo ich den cursor haben will, immer auf den ganzen bildschirm. daher, wenn ich das fenster verschieb, is der cursor nimmer da, wo er dann sein soll. ich will das er immer auf einen button springt. normalerweise müsste des mit der procedure gehn, die ich auch im threadtitel hab (oder net ?), aber ich weiß net wie ich die anwende richtig.
danke schon mal.

gruß flamx

Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt.
DarkHunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 477

Win XP
D3 Prof, D2005 PE
BeitragVerfasst: Do 29.09.05 15:39 
Hallo,

du kannst mit <Formularname>.left und <Formularname>.top die Position des Formulars abfragen, das rechnest du dann auf deine x und y um. Fertig ;)

Beispiel:
angenommen den Formular sitz bei 10|10
Der Cursor soll zu 25|25 im Formular
Also
ausblenden Delphi-Quelltext
1:
SetCursorPos(35,35);					

;)
bzw wenn das ganze immer neu berechnet wird:
ausblenden Delphi-Quelltext
1:
SetCursorPos(x+form1.left,y+form1.top);					
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Do 29.09.05 15:47 
Hallo,

dafür hat Delphi eine Funktion:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
var pos : TPoint;
begin
  pos.x := 0;
  pos.y := 0;
  //zur linken oberen Ecke der Form, unterhalb der Titelleiste
  pos := Form1.ClientToScreen(pos);
  //zur linken oberen Ecke des Buttons
  //pos := Button1.ClientToScreen(pos);
  SetCursorPos(pos.x, pos.y)

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
flamx Threadstarter
Hält's aus hier
Beiträge: 6



BeitragVerfasst: Do 29.09.05 16:28 
alles klar, danke an euch, hat geklappt