Autor Beitrag
DOCa Cola
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64

Vista x64
D2007
BeitragVerfasst: Sa 03.06.06 19:40 
ich suche eine möglichkeit ereigenisse auszulösen wenn ich z.B hinter meiner form ein anderes fenster anklicke und sie somit den fokus verliert bzw wenn sie schon im hintergrund ist und wieder angeklickt wird (also fokus wieder bekommt), dass sie dann ein anderes event auslöst. kann mir jemand einen tipp geben?

vielen dank
gruß Norman
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Sa 03.06.06 19:57 
Ich nehme an, du meinst OnActive und OnDeactivate.
DOCa Cola Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64

Vista x64
D2007
BeitragVerfasst: Sa 03.06.06 20:18 
habe gerade eine neue form zum testen erstellt, aber in der vergangenheit hatte ich schon keinen erfolg mit den 2 ereignissen.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.FormActivate(Sender: TObject);
begin
label1.Caption := 'aktiv';
end;

procedure TForm1.FormDeactivate(Sender: TObject);
begin
label1.Caption := 'nicht aktiv';
end;

hat bei mir leider keinen effekt. nur zum programmstart wird das label auf 'aktiv' gesetzt. dabei bleibt es aber auch

gruß Norman
Born-to-Frag
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 1094

Win XP SP2, Win 2000 SP4
Delphi 7, 2k5
BeitragVerfasst: Sa 03.06.06 23:56 
Nein, du suchst eher OnEnter und OnExit, richtig? :D


greetz

_________________
Theorie ist wenn man alles weiß, aber nichts funktioniert. Praxis ist wenn alles funktioniert, aber niemand weiß warum.
Microsoft vereint Theorie und Praxis: Nichts funktioniert und niemand weiß warum.
DOCa Cola Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64

Vista x64
D2007
BeitragVerfasst: So 04.06.06 01:29 
nein, leider nicht ;) immer dann wenn die form den fokus verliert oder gewinnt (graue titelleiste, blaue titelleiste) egal durch was :)
DOCa Cola Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64

Vista x64
D2007
BeitragVerfasst: So 04.06.06 01:42 
leute, ich habs zufällig gefunden, so gehts.

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:
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Label1: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure AppOnActivate(Sender: TObject);
    procedure AppOnDeactivate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.AppOnActivate(Sender: TObject);
begin
  label1.Caption := 'aktiv';
end;

procedure TForm1.AppOnDeactivate(Sender: TObject);
begin
  label1.Caption := 'nicht aktiv';
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Application.OnActivate := AppOnActivate;
application.OnDeactivate := AppOnDeactivate;
end;

end.


gruß Norman