Autor Beitrag
LonghornUser
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: So 19.04.09 16:26 
Hallo,

ich habe folgendes Problem:
Immer dann, wenn der User meine Form minimiert, soll sie versteckt werden (Form1.Hide;). Das klappt auch wunderbar durch eine Zuweisung an Application.OnMinimize.

Natürlich wird dann auch ein Symbol neben der Systemuhr erstellt. Das Problem ist nun: Wenn ich die Anwendung mittels Form1.Show; (was in einem Popupmenu, welches mit der Tray-Komponente verknüpft ist, aufgerufen wird) nun wieder hervorhole, denkt sie immernoch, sie sei minimiert worden (obwohl die Form zu sehen ist). Daher reagiert dann der Minimieren-Knopf des Fenster nicht.

Ich habe nun versucht statt Form1.Show im Popupmenu ein Application.Restore zu nutzen, aber dann scheint auf einmal AppMinimize nicht mehr OnMinimize zugewiesen zu sein, denn, wenn man dann meine Form minimiere, versteckt sie sich nicht.

Habt ihr eine Idee ?

Ciao LHUser


Moderiert von user profile iconNarses: Topic aus Windows API verschoben am So 19.04.2009 um 22:52
FinnO
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1331
Erhaltene Danke: 123

Mac OSX, Arch
TypeScript (Webstorm), Kotlin, Clojure (IDEA), Golang (VSCode)
BeitragVerfasst: So 19.04.09 16:36 
schau dir mal Form1.WindowState (oder so ähnlich) an.
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: So 19.04.09 16:49 
Das habe ich auch schon versucht (Form1.WindowState := wsNormal), aber es hat nicht funktioniert.

Ich poste am besten mal den Code:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
procedure TForm1.AppMinimize(Sender: TObject);
begin
  if HideByMinimize = True then
    Form1.Hide;
end;

procedure TForm1.PopupStartExecute(Sender: TObject);
begin
  Form1.Show;
  Form1.WindowState := wsNormal; // hat nix gebracht :-(
end;

FormCreate: Application.OnMinimize := AppMinimize;
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: So 19.04.09 20:55 
Hat keiner ne Idee ? :(
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: So 19.04.09 21:01 
Pushen ist erst nach 24 Stunden erlaubt. Du bist seit 2003 hier, das solltest du doch wissen.

Probier es mit:

ausblenden Delphi-Quelltext
1:
Application.Restore;					

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



BeitragVerfasst: So 19.04.09 21:06 
Sorry fürs Pushen :oops:

user profile iconLonghornUser hat folgendes geschrieben Zum zitierten Posting springen:

Ich habe nun versucht statt Form1.Show im Popupmenu ein Application.Restore zu nutzen, aber dann scheint auf einmal AppMinimize nicht mehr OnMinimize zugewiesen zu sein, denn, wenn man dann meine Form minimiere, versteckt sie sich nicht.
thepaine91
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 763
Erhaltene Danke: 27

Win XP, Windows 7, (Linux)
D6, D2010, C#, PHP, Java(Android), HTML/Js
BeitragVerfasst: Mo 20.04.09 08:55 
Hi,

am rande mal so viel zu WindowState:

[Mit WindowState können Sie festlegen und ermitteln, ob das Formular normal, minimiert (als Symbol) oder maximiert (Vollbild) (!!!geöffnet wird!!!).]

d.h. Windowstate bringt in deinem Fall deshalb auch nichts würde lediglich zur abfrage dienen. Oder vor dem Öffnen des Formulars zuweisen.
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mo 20.04.09 09:47 
Vielleicht hilft dir das hier weiter?
www.delphi-treff.de/...kleiste%20entfernen/

_________________
PROGRAMMER: A device for converting coffee into software.
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Mo 20.04.09 10:10 
@Xentar: Sieht so aus, als hätte das das Problem gelöst. Ich schaue mir das mal genauer an, danke :)
Edit: OK, das geht nun soweit. Nun habe ich aber das Problem, dass bei jedem Kompilieren dasteht:
Zitat:
Feld Form1.ApplicationEvents1 besitzt keine entsprechende Komponente. Soll die Deklaration entfernt werden.

Kann man diese Meldung irgendwie unterdrücken, ohne andere Meldungen dieser Art zu unterdrücken (die sind nämlich relativ hilfreich) ?
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mo 20.04.09 12:18 
Du könntest auch einfach die entsprehcende Komponente, TApplicationEvents auf deinem Formular parken.

Falls ud das nicht haben willst, löschst du halt die entsprechende Zeile.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
  TForm1 = class(TForm)
    ApplicationEvents1: TApplicationEvents;
    procedure ApplicationEvents1Minimize(Sender: TObject);
    private
      { Private-Deklarationen }
      procedure Systray(var sMsg: TMessage); message IC_CLICK;
    public
      { Public-Deklarationen }
    end;

_________________
PROGRAMMER: A device for converting coffee into software.
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Mo 20.04.09 18:36 
Ist ja komisch. Das Löschen der Zeile hat gefunzt. Braucht man die denn garnicht ?
Xentar
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 2077
Erhaltene Danke: 2

Win XP
Delphi 5 Ent., Delphi 2007 Prof
BeitragVerfasst: Mo 20.04.09 18:44 
Nicht, wenn du keine zugehörige Komponente auf dem Formular hast.

_________________
PROGRAMMER: A device for converting coffee into software.
LonghornUser Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 796



BeitragVerfasst: Mo 20.04.09 18:52 
Das macht Sinn ;)