Autor Beitrag
Gesus
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43



BeitragVerfasst: Do 24.03.05 15:01 
Hallo!

Ich habe ein Feld aus Bildern.
Nun möchte ich, das sich die Bilder ändern, wenn man mit der Maus drüber fährt.
Das ist ja auch kein Problem mit Mousemove. Aber ich würde das gerne so machen, das die Mouse gedrückt sein muss. (Bei jedem Bild extra klicken möchte ich nicht)

Lösungsmöglichkeit: Gibt es ne Funktion/ Variable die überprüft OB die Maus grade gedrückt wird? (Möglichst vielleicht sogar Rechts/Links unterscheidet)

danke, mfg Gesus
Diabele$
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 53



BeitragVerfasst: Do 24.03.05 15:17 
zumindest bei OnMouseDown:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  Case Button OF
    mbleft:   //linke Maustaste
    mbright:  //rechte Maustaste
    mdmiddle: //Mausrad
  end;
end;


Man könnte ja dann anhand der Mauspostition und eines Timers bestimmen, ob die Maus bewegt wurde.
Gesus Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43



BeitragVerfasst: Do 24.03.05 15:29 
Gut, damit kann ich jetzt die Maus kontrolieren ob links, rechts, doppel,... geklickt wurde, aber das Problem das "mit gedrückter Taste ziehen" habe ich leider immer noch
WeBsPaCe
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 2322
Erhaltene Danke: 1

FireFox 3, Internet Explorer 6 SP1
D1, D3Prof, D6Pers, D7Pers+Indy, VisualStudio Express
BeitragVerfasst: Do 24.03.05 15:37 
ausblenden Delphi-Quelltext
1:
2:
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;  
  Shift: TShiftState; X, Y: Integer);

Das kannst du irgendwie mit diesem Shift von deiner OnMouseMove-Procedure (ich hoff mal da isses auch drin... ;) ) abfragen. kA wie, hab leider grad kein Delphi da... :(
Gesus Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43



BeitragVerfasst: Fr 25.03.05 19:02 
Also irgendwie bekomme ich das nicht hin.
Für alle die noch nicht wissen was ich meine:
z.b bei den Karteneditoren von AoE oder von EE, solange wie die Maus gedrückt ist, kann man die Umgebung ändern.
Ich kann das im Moment nur, das bei einem einzigen Klick die Stelle geändert wird.

Kann mir da einer helfen?

danke, gesus
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Fr 25.03.05 20:13 
OnMouseDown:
ausblenden Delphi-Quelltext
1:
  MPressed := True;					


OnMouseMove:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
  if MPressed then
  begin
    // Was auch immer sein soll.
  end;


OnMouseUp:
ausblenden Delphi-Quelltext
1:
  MPressed := False;					

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Gesus Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43



BeitragVerfasst: Fr 25.03.05 21:09 
Habe ich gemacht! Das Problem ist jetzt, das wenn ich ein Bild angeklickt habe, die Maus bewegen muss, damit sich DIESES Bild ändert! Dazukommt, dass die anderen Bilder, wenn man drüber fährt, immer noch nicht geändert werden!:(
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Fr 25.03.05 21:14 
OnMouseDown:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
  MPressed := True;
  while MPressed do
  begin
    // BlaBla
  end;


OnMouseUp:
ausblenden Delphi-Quelltext
1:
  MPressed := False;					

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Gesus Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43



BeitragVerfasst: Fr 25.03.05 21:24 
da Bricht es komplett Zusammen!
--> es reagiert dann nicht mehr
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Fr 25.03.05 21:28 
Mh, dann reagiert er nicht mehr aufs OnMouseUp. Sry.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Gesus Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43



BeitragVerfasst: Fr 25.03.05 21:33 
Kennst du noch ne andere Möglichkeit?
Gesus Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43



BeitragVerfasst: Fr 25.03.05 21:45 
Ich habe das Gefühl, dass wenn man die Maustastegedrückt hält, funktioniert die MouseMove bei andern Bildern überhaupt nicht!?
GTA-Place
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
EE-Regisseur
Beiträge: 5248
Erhaltene Danke: 2

WIN XP, IE 7, FF 2.0
Delphi 7, Lazarus
BeitragVerfasst: Fr 25.03.05 23:02 
Mit meiner Methode oben geht es, wenn du noch ein Application.ProcessMessages; in die Schleife schreibst.

_________________
"Wer Ego-Shooter Killerspiele nennt, muss konsequenterweise jeden Horrorstreifen als Killerfilm bezeichnen." (Zeit.de)
Gesus Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 43



BeitragVerfasst: Di 29.03.05 00:55 
Jetzt geht es fast einwandfrei (ABER leider nur mit der rechten, sowie der mittleren Maustaste!) Ich habe im ganzen Quelltext nichts mit "rechts, mitte oder links" geschrieben!

Weiß da jmd woran das liegen kann?

mfg Gesus
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Di 29.03.05 15:16 
ich kann da den code von meinem snake level editor empfehlen:
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:
procedure TEditor.LevelMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if button = mbleft then
    setwall(x, y);
  if button = mbright then
    deletewall(x, y);
end;

procedure TEditor.LevelMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var
  FX, FY: integer;
begin
  if ssLeft in Shift then
    SetWall(x, y);
  if ssRight in Shift then
    DeleteWall(x, y);  
  FX:= round(x div 5) + 1;
  FY:= round(y div 5) + 1;
  coord.caption:= inttostr(FX) + '/' + inttostr(FY); 
  DrawMap;
  LoadWalls;
  if Map[FX, FY] = Wall then
    FillField(FX, FY, clgreen) else
      FillField(FX, FY, clred);  
end;

funzt perfekt !
F34r0fTh3D4rk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 5284
Erhaltene Danke: 27

Win Vista (32), Win 7 (64)
Eclipse, SciTE, Lazarus
BeitragVerfasst: Di 29.03.05 15:17 
ich kann da den code von meinem snake level editor empfehlen:
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:
procedure TEditor.LevelMouseDown(Sender: TObject; Button: TMouseButton;
  Shift: TShiftState; X, Y: Integer);
begin
  if button = mbleft then
    setwall(x, y);
  if button = mbright then
    deletewall(x, y);
end;

procedure TEditor.LevelMouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
var
  FX, FY: integer;
begin
  if ssLeft in Shift then
    SetWall(x, y);
  if ssRight in Shift then
    DeleteWall(x, y);  
  FX:= round(x div 5) + 1;
  FY:= round(y div 5) + 1;
  coord.caption:= inttostr(FX) + '/' + inttostr(FY); 
  DrawMap;
  LoadWalls;
  if Map[FX, FY] = Wall then
    FillField(FX, FY, clgreen) else
      FillField(FX, FY, clred);  
end;

funzt perfekt !