Autor Beitrag
Hybrid
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 112

Win XP Pro
D7 Ent
BeitragVerfasst: Sa 22.05.04 20:05 
Ich habe ein TAnimate das ein Video abspielt. Das Form ist mit clFuchsia transparent und passt sich an die größe des Tanimate an. Heißt also dass man nur das Video sieht. (soll eine Screenmate werden :) )
Das Problem ist, dass ich nun eine OnClick Prozedur benötige, die aber bei einer TAnimate nicht möglich ist.

Ich habe versucht ein label, timage, panel,... mit align:=alclient; zu benutzten, das geht aber nicht weil die TAnimate immer im Vordergrund liegt. Selbst wenn ich per timer SendToBack; benutzte.

Wie kann ich das machen?

Bitte um schnelle Antwort.

mfg Andreas S.


Zuletzt bearbeitet von Hybrid am Di 25.05.04 16:40, insgesamt 2-mal bearbeitet
Hybrid Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 112

Win XP Pro
D7 Ent
BeitragVerfasst: So 23.05.04 09:21 
Wenn ihr noch weitere Informationen braucht, sagt es mir. So langsam bin ich am verzweifeln. :cry:
Gibts es denn keine Möglichkeit Mausklicks ohne Komponenten, wie labels usw. abzufragen?
Irgendetwas wie mouse.shiftstate oder so???
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: So 23.05.04 10:35 
Gibs auch kein OnMouseUp-Event (Hab grad kein Delphi zur Hand - anderer Rechner)?
Dann blieb theoretisch noch neue Komponente von TAnimate ableiten, die eine Mausmessage (Klick, Up, etc) abfängt.

_________________
JSXGraph
Hybrid Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 112

Win XP Pro
D7 Ent
BeitragVerfasst: So 23.05.04 11:53 
Sorry, aber ich weiß jetzt nicht genau was du mit ableiten meinst.
Ich hab auch schon versucht, statt der TAnimate einen mediaplayer mit einem panel zu benutzten.
Problem:
Man kann dann keine Transparenz für das Video einstellen die wie bei der TAnimate die Trans.-Farbe aus dem Video ausließt. Außerdem gab es beim Panel Probleme mit der Größe des Videos, das wurde in die Horizontale lang gezogen(?!).
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: So 23.05.04 12:05 
so:
ausblenden volle Höhe 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:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls;

type
  TMyAnimate = class(TAnimate)
  private
    FOnClick: TNotifyEvent;
    procedure MsgClickHdl(var Msg: TMessage); message WM_LBUTTONUP;
  public
    property OnClick: TNotifyEvent read FOnClick write FOnClick;
  end;

  TForm1 = class(TForm)
    procedure FormCreate(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure AnimateClick(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  Animate1: TMyAnimate;

implementation

{$R *.dfm}

procedure TMyAnimate.MsgClickHdl(var Msg: TMessage);
begin
  if Assigned(FOnClick) then FOnClick(self);
end;

procedure TForm1.AnimateClick(Sender: TObject);
begin
  ShowMessage('Click');
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Animate1 := TMyAnimate.Create(Form1);
  Animate1.Parent := Form1;
  Animate1.Left := 100;
  Animate1.Top := 100;
  Animate1.Width := 100;
  Animate1.Height := 100;
  Animate1.CommonAVI := aviFindFile;
  Animate1.Play(0, Animate1.FrameCount-1, Animate1.FrameCount);
  Animate1.OnClick := AnimateClick;
end;

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  FreeAndNil(Animate1);
  CanClose := true;
end;

end.


Einfach 'n neues Projekt mit leerer Form und das hier in die Unit kopieren...


raziel

_________________
JSXGraph
Hybrid Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 112

Win XP Pro
D7 Ent
BeitragVerfasst: So 23.05.04 12:21 
Vielen Dank! Klappt alles bestens. Jetzt kann ich meinen Imp (die Screenmate) auch schlagen :twisted:
user defined image
Hybrid Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 112

Win XP Pro
D7 Ent
BeitragVerfasst: Di 25.05.04 16:41 
Und wie mache ich das wenn ich noch eine MouseEnter und MouseLeave Prozedur benötige?

mfg Andreas S.
raziel
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 2453

Arch Linux
JS (WebStorm), C#, C++/CLI, C++ (VS2013)
BeitragVerfasst: Di 25.05.04 19:04 
+mouseenter (zusätzlich noch ein label auf die form):
ausblenden volle Höhe 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:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls;

type
  TMyAnimate = class(TAnimate)
  protected
    FOnClick: TNotifyEvent;
    FOnEnter: TNotifyEvent;
    procedure MsgClickHdl(var Msg: TMessage); message WM_LBUTTONUP;
    procedure MsgEnterHdl(var Msg: TMessage); message CM_MOUSEENTER;
  public
    property OnClick: TNotifyEvent read FOnClick write FOnClick;
    property OnEnter: TNotifyEvent read FOnEnter write FOnEnter;
  end;

  TForm1 = class(TForm)
    Label1: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure AnimateClick(Sender: TObject);
    procedure AnimateEnter(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form1: TForm1;
  Animate1: TMyAnimate;

implementation

{$R *.dfm}

procedure TMyAnimate.MsgClickHdl(var Msg: TMessage);
begin
  if Assigned(FOnClick) then FOnClick(self);
end;

procedure TMyAnimate.MsgEnterHdl(var Msg: TMessage);
begin
  if Assigned(FOnEnter) then FOnEnter(self);
end;

procedure TForm1.AnimateClick(Sender: TObject);
begin
  ShowMessage('Click');
end;

procedure TForm1.AnimateEnter(Sender: TObject);
begin
  Label1.Caption := 'On the animation';
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Animate1 := TMyAnimate.Create(Form1);
  Animate1.Parent := Form1;
  Animate1.Left := 100;
  Animate1.Top := 100;
  Animate1.Width := 100;
  Animate1.Height := 100;
  Animate1.CommonAVI := aviFindFile;
  Animate1.Play(0, Animate1.FrameCount-1, Animate1.FrameCount);
  Animate1.OnClick := AnimateClick;
  Animate1.OnEnter := AnimateEnter;
end;

procedure TForm1.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  FreeAndNil(Animate1);
  CanClose := true;
end;

end.


das mit OnLeave müsstest du selbst gar hinkriegen, wenn ich dir sag dass die Message CM_MOUSELEAVE ist... oder?


raziel

_________________
JSXGraph
Hybrid Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 112

Win XP Pro
D7 Ent
BeitragVerfasst: Di 25.05.04 19:45 
Erstmal danke für den Code, hat alles super geklappt!

Erlich gesagt hab ich das "fast" so versucht, aber ich habe was wichtiges vergessen:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
type 
  TMyAnimate = class(TAnimate) 
  protected 
    FOnClick: TNotifyEvent; 
    FOnEnter: TNotifyEvent;
    procedure MsgClickHdl(var Msg: TMessage); message WM_LBUTTONUP; 
    procedure MsgEnterHdl(var Msg: TMessage); message CM_MOUSEENTER; 
  public 
    property OnClick: TNotifyEvent read FOnClick write FOnClick; 
    property OnEnter: TNotifyEvent read FOnEnter write FOnEnter; 
  end;


Die type Definition hab ich übersehen, da mein Quelltext so groß ist (bin gerade am aufräumen).
Da es nicht geklappt hat hab ich das dan wieder rausgenommen (*dumm sei*).

Nochmals Danke!

Moderiert von user profile iconChristian S.: "color" durch "highlight" ersetzt