Autor Beitrag
matzerg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

Win XP
D6 Pers
BeitragVerfasst: Do 21.10.04 17:10 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
var
  Form1: TForm1;
  xold, yold: integer;
implementation

{$R *.dfm}

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
X := X-(2*(x-xold));
Y := Y-(2*(Y-yold));
xold:=X;
yold:=Y;
setcursorpos(x, y);
end;


procedure TForm1.FormCreate(Sender: TObject);
begin
xold:=400;
yold:=400;
end;

ich hab mal so probiert ist aber nichts weiter rausgekommen als das die maus in der unteren rechten ecke landete....
uall@ogc
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1826
Erhaltene Danke: 11

Win 2000 & VMware
Delphi 3 Prof, Delphi 7 Prof
BeitragVerfasst: Do 21.10.04 19:33 
zuerst bekommst du in x und x den wert von der form, mit setcursorpos setzt du den wert vom ganzen deskatop, ausserdem gibbet nen flackern da wenn du setcurospos aufruft direkt wieder in on mousemove gesprugen wird, also so ne art endlosschleife
matzerg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

Win XP
D6 Pers
BeitragVerfasst: Fr 22.10.04 11:52 
ok ich glaube verstanden zu haben was du meinst aber habe kp wie besser geht...

hat irgendwer ne idee mit verständlichem bsp???
.Chef
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1112



BeitragVerfasst: Fr 22.10.04 21:38 
Du musst das OnMouseMove vorm SetCursorPos auf nil setzen, und danach erst wieder zuweisen.

_________________
Die Antworten auf die 5 häufigsten Fragen:
1. Copy(), Pos(), Length() --- 2. DoubleBuffered:=True; --- 3. Application.ProcessMessages bzw. TThread --- 4. ShellExecute() --- 5. Keine Vergleiche von Real-Typen mit "="!
matzerg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

Win XP
D6 Pers
BeitragVerfasst: Sa 23.10.04 15:59 
wenne damit meinst ich soll den onmousemove deaktivieren bevor ich setcursorpos mache dann hab ich verstanden aber wie????
wie nur???
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Sa 23.10.04 19:11 
ausblenden Delphi-Quelltext
1:
2:
3:
OnMouseMove := nil;
SetCursorPos(...);
OnMouseMove := DeineProc;

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.
matzerg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

Win XP
D6 Pers
BeitragVerfasst: So 24.10.04 00:11 
wenn ichs so mache funzt es nit... :(
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
var
  Form1: TForm1;
  xold, yold :integer;
implementation

{$R *.dfm}

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
X := X-(2*(x-xold));
Y := Y-(2*(Y-yold));
xold:=X;
yold:=Y;
OnMouseMove := nil;
setcursorpos(x, y);
OnMouseMove := FormMouseMove;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
xold:=400;
yold:=400;
end;

bzw. die maus ist wieder unten rechts...
.Chef
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1112



BeitragVerfasst: So 24.10.04 22:51 
Du musst zwei Probleme lösen:
- Du brauchst einen korrekten Anfangswert innerhalb des Formulars!
- Du musst den Fall berücksichtigen, dass die Maus das Formular verlässt und an einer anderen Stelle wieder eintritt!

Dieser Code funktioniert, solange die Maus über dem Formular bleibt:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
implementation
var
  yold, xold : Integer;
  pt : TPoint;

{$R *.dfm}

procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
begin
  OnMouseMove:=nil;
  GetCursorPos(pt);
  pt.X:=pt.X-2*(pt.X-xold);
  pt.Y:=pt.Y-2*(pt.Y-yold);
  xold:=pt.X;
  yold:=pt.Y;
  Setcursorpos(pt.X,pt.Y);
  OnMouseMove:=FormMouseMove;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  pt.X:=Form1.Left+100;
  pt.Y:=Form1.Top+50;
  SetCursorPos(pt.X,pt.Y);
  xold:=pt.X;
  yold:=pt.Y;
end;

_________________
Die Antworten auf die 5 häufigsten Fragen:
1. Copy(), Pos(), Length() --- 2. DoubleBuffered:=True; --- 3. Application.ProcessMessages bzw. TThread --- 4. ShellExecute() --- 5. Keine Vergleiche von Real-Typen mit "="!
matzerg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

Win XP
D6 Pers
BeitragVerfasst: So 24.10.04 23:56 
danke es funzt aber wirklich NUR wenn die Maus von ANFANG AN auf form1 ist..

ich würds daher nur weiterempfehlen für leute die in ihrem programm mit vollbild arbeiten...
.Chef
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1112



BeitragVerfasst: Mo 25.10.04 00:04 
Ich hab nie behauptet, dass es für alle Fälle gilt. Es ist nur ein Beispiel, das du weiter ausbauen musst. Und zwar mit den Features, die ich oberhalb des Quellcodes angesprochen habe.

Edit: Was glaubst du, warum ich die Maus am Anfang auf das Formular gesetzt habe? :roll:

_________________
Die Antworten auf die 5 häufigsten Fragen:
1. Copy(), Pos(), Length() --- 2. DoubleBuffered:=True; --- 3. Application.ProcessMessages bzw. TThread --- 4. ShellExecute() --- 5. Keine Vergleiche von Real-Typen mit "="!
matzerg Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 70

Win XP
D6 Pers
BeitragVerfasst: Mo 25.10.04 00:08 
mir kanns ja egal sein weil ich im vollbild programmiere das richtete sich eher an alle "kommenden Generationen" die in den (bis dahin) verstaubten bits und bytes des archiv von diesem Forum nach solchen sachen suchen.... ^^

achja hab ich mich schon bedankt???

danke danke danke