AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Verkleiner eines modalen Fenster soll gesamte Anwendung verkleinern

Verkleiner eines modalen Fenster soll gesamte Anwendung verkleinern

Ein Thema von hoika · begonnen am 30. Jul 2020 · letzter Beitrag vom 31. Jul 2020
Antwort Antwort
hoika

Registriert seit: 5. Jul 2006
Ort: Magdeburg
8.270 Beiträge
 
Delphi 10.4 Sydney
 
#1

Verkleiner eines modalen Fenster soll gesamte Anwendung verkleinern

  Alt 30. Jul 2020, 18:35
Hallo,
folgende Situation:

Ich öffne aus dem Hauptprogramm ein modales Fenster.
Dann verkleinere ich das modale Fenster.
Das Hauptfenster wird aber nicht verkleinert!

Ich kann auf das Hauptfenster klicken -> Ping.
Erst wenn ich aber Alt+Tab das Hauptfenster quasi wieder "aktiviere",
ist das modale Fenster wieder da.

Wie bekomme ich das hin, dass das Verkleinern des modalen Fensters auch das Hauptfenster verkleinert.
Das kann muss natürlich auch einige Stufen tiefer klappen:
Hauptfenster->modales Fenster1 -> modales Fenster2.

Verkleinere ich jetzt "modales Fenster2", muss ebenfalls das Hauptfenster verkleinert werden
und damit ja auch "modales Fenster1".
Bei der "Rückkehr" muss dann alles wieder beim alten sein, der Focus also auf "modales Fenster2" liegen.
Heiko
  Mit Zitat antworten Zitat
Benutzerbild von KodeZwerg
KodeZwerg

Registriert seit: 1. Feb 2018
3.685 Beiträge
 
Delphi 11 Alexandria
 
#2

AW: Verkleiner eines modalen Fenster soll gesamte Anwendung verkleinern

  Alt 31. Jul 2020, 07:24
Mit ShowWindow() und einem SW_HIDE parameter mache ich Fenster temporär komplett unsichtbar, auch von TaskBar.
Gruß vom KodeZwerg
  Mit Zitat antworten Zitat
hoika

Registriert seit: 5. Jul 2006
Ort: Magdeburg
8.270 Beiträge
 
Delphi 10.4 Sydney
 
#3

AW: Verkleiner eines modalen Fenster soll gesamte Anwendung verkleinern

  Alt 31. Jul 2020, 07:51
Hallo,
ich will es ja nicht unsichtbar machen.
Aber der Ansatz passt.
Heiko
  Mit Zitat antworten Zitat
Benutzerbild von KodeZwerg
KodeZwerg

Registriert seit: 1. Feb 2018
3.685 Beiträge
 
Delphi 11 Alexandria
 
#4

AW: Verkleiner eines modalen Fenster soll gesamte Anwendung verkleinern

  Alt 31. Jul 2020, 07:57
Für Deinen konkreten Fall gibt es ja auch den SW_MINIMIZE parameter, ich habe dabei allerdings oft das problem bei modalen Fenstern das das Icon in TaskBar oder NotifyArea ist und der User da immernoch zugriff drauf hat.
Kann man aber auch per Code mit IsIconic() abfragen lassen (das wertet aus ob ein Fenster minimiert ist)
Gruß vom KodeZwerg
  Mit Zitat antworten Zitat
Benutzerbild von KodeZwerg
KodeZwerg

Registriert seit: 1. Feb 2018
3.685 Beiträge
 
Delphi 11 Alexandria
 
#5

AW: Verkleiner eines modalen Fenster soll gesamte Anwendung verkleinern

  Alt 31. Jul 2020, 08:26
Ich habe hier noch was online gefunden was Du mit Sicherheit auf Deinen Fall umbasteln könntest: dim-out-the-main-form-of-an-application-when-a-modal-form-dialog-is-displayed/


Author: Žarko Gajić

Falls Seite tot geht, hier der inhalt:
Code:
Dim Out the Main Form of an Application When a Modal Form (/Dialog) is Displayed

Dim Main Form From Dialog

Dialog windows you use to display critical information to the user are, in most cases, displayed modally. A modal window (form) is the one where the application can’t continue to run until the modal window is closed. Delphi’s ShowMessage, InputBox and MessageDlg, for example, display a modal form to the user waiting for some action. Your custom dialogs are displayed using the ShowModal method of a form.

Dimmer – a device for varying the brightness of light
To emphasize the importance of a modal form and the information it presents, you could gray out the main form of the application when the modal form is activated.

Here’s how to add a dim-out effect to your main form when modal forms are waiting for the user input.

Have a main form in your application. (Or some other form you want to dim).
Add a new form to the project. This will be the “dimmer” form.
Drop the TApplicationEvents component on the main form
Handle OnModalBegin and OnModalEnd events…
The dimmer form is created at application startup – and since it is not the main form, it will not be displayed initially.

The Display procedure aligns the dimmer form above the main form and gets displayed before any modal form is shown. This happens in the ApplicationEvent’s OnModalBegin event. OnModalEnd ensures that dimmer form is hidden until needed next time.

procedure TDimmerForm.FormCreate(Sender: TObject);
begin
  AlphaBlend := true;
  AlphaBlendValue := 128;
  BorderStyle := bsNone;
end;

The above is the OnCreate event handler for the dimmer form. By using the AlphaBlend property and the AlphaBlendValue you can make the form translucent. As it will be displayed over the main form, we want it to create the dim-out effect. BorderStyle ensures this form has no border, no caption bar, no title buttons.

The Display procedure aligns the dimmer form above the main form:

type
  TDimmerForm = class(TForm)
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    procedure Display(const dimForm : TForm);
  end;
 
...
 
procedure TDimmerForm.Display(const dimForm: TForm);
begin
  with Self do
  begin
    Left := dimForm.Left;
    Top := dimForm.Top;
    Width := dimForm.Width;
    Height := dimForm.Height;
 
    Show;
  end;
end;

Finally, handle the OnModalBegin and OnModalEnd events of the TApplicationEvents component on the main form:

procedure TMainForm.ApplicationEvents1ModalBegin(Sender: TObject);
begin
  if Assigned(DimmerForm) then DimmerForm.Display(self);
end;
 
procedure TMainForm.ApplicationEvents1ModalEnd(Sender: TObject);
begin
  if Assigned(DimmerForm) then DimmerForm.Hide;
end;
And … that’s it.
Für Dich wird vor allem das Event interessant sein hoffe ich um drauf zu reagieren.
Gruß vom KodeZwerg
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.114 Beiträge
 
Delphi 12 Athens
 
#6

AW: Verkleiner eines modalen Fenster soll gesamte Anwendung verkleinern

  Alt 31. Jul 2020, 08:46
Über Screen.Forms kommst an alle Fenster,
über Application.Mainform kommt man auch von überall an Dieses dran
mit Application.Minimize/Restore kannst bestimmt was Feines machen

und vielleicht noch paar interessante Dinge für Fensterchen wären z.B. Application.Active/BringToFront/ModalLevel/DialogHandle.
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat
hoika

Registriert seit: 5. Jul 2006
Ort: Magdeburg
8.270 Beiträge
 
Delphi 10.4 Sydney
 
#7

AW: Verkleiner eines modalen Fenster soll gesamte Anwendung verkleinern

  Alt 31. Jul 2020, 12:21
Danke,
das schaue ich mir heute Abend mal an.
Heiko
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:37 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz