Announcement

Collapse
No announcement yet.

Fenster nach Minimieren an Statusbar andocken

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Fenster nach Minimieren an Statusbar andocken

    Hallo zusammen,

    ich erzeuge in meiner MainForm weitere Forms, die die MainForm als Parent haben.
    Auf der MainForm ist am unteren Rand eine Statusleiste plaziert. Wenn man nun die Forms in der MainForm minimiert, verschwinden sie immer hinter der Statusleiste.
    Wie kann ich diese beim Minimieren an der Statusleiste andocken, oder sie zumindest über der Leiste anzeigen.

    Danke im voraus
    Anfred

  • #2
    Ungetestet: Platziere auf der MainForm ein Panel mit alClient und benutze das als Parent deiner Kind-Forms.
    <br>Uli

    Comment


    • #3
      Hallo Uli,

      das hab ich schon versucht. Das Fenster ist nach dem minimize verschwunden. Weiß aber nicht warum, hab Align auf Client gesetzt, und weise der Form (ich fang im Moment die Minimizemessage von Windows ab) das Panel als Parent zu. Aber ich würde gern, wenn es irgendwie geht, auf weitere Komponenten auf der Form verzichten.

      Gruß
      Anfre

      Comment


      • #4
        Hallo Anfred,<p>
        ist die Statusleiste als AlBottom direkt aufs Form gesetzt? <p>
        Ich habe gerade einen Versuch gemacht: Neue Anwendung, Form1 als MDIForm, Form2 dazu als MdiChild. Minimiere ich Form2, bleibt es über der Statusleiste.<br>
        Entweder verstehe ich Dein Problem nicht, oder Du verwendest andere Komponenten oder es liegt an der Delphi-Version (D6.02).<p>
        Schöne Grüße, Mario NOac
        Schöne Grüße, Mario

        Comment


        • #5
          Hallo Mario,

          ich muss aber mit einer sdi-form arbeiten. Mit der MDI-Form funktioniert es perfekt. Leider nicht mit der SDI.

          Gruß
          Anfre

          Comment


          • #6
            Hi Anfred, <br>
            ich poste dir mal meine Experimente zu dem Thema -- schau mal, ob' dir was nützt.
            <br>Ciao, Uli.

            Unit1.pas:
            <pre class="sourcecode"><code>
            <b>unit</b> Unit1;
            <br><br><b>interface</b>
            <br><br><b>uses</b>
            Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
            StdCtrls, ExtCtrls, ComCtrls;
            <br><b>type</b>
            TMainForm = <b>class</b>(TForm)
            Panel1: TPanel;
            Button1: TButton;
            StatusBar1: TStatusBar;
            Button2: TButton;
            <b>procedure</b> Button1Click(Sender: TObject);
            <b>procedure</b> Button2Click(Sender: TObject);
            <b>private</b>
            <font color="#003399"><i>{ Private-Deklarationen }</i></font>
            <b>public</b>
            <font color="#003399"><i>{ Public-Deklarationen }</i></font>
            <b>end</b>;
            <br><b>var</b>
            MainForm: TMainForm;
            <br><b>implementation</b>
            <br><b>uses</b>
            Unit2;
            <br><font color="#003399"><i>{$R *.DFM}</i></font>
            <br><b>procedure</b> TMainForm.Button1Click(Sender: TObject);
            <b>var</b>
            f: TChildForm;
            <b>begin</b>
            f := TChildForm.Create(Self);
            f.Parent := Panel1;
            f.Show;
            <b>end</b>;
            <br><b>procedure</b> TMainForm.Button2Click(Sender: TObject);
            <b>var</b>
            i: Integer;
            c: TControl;
            <b>begin</b>
            <b>for</b> i := 0 <b>to</b> pred(Panel1.ControlCount) <b>do</b>
            <b>begin</b>
            c := Panel1.Controls[i];
            c.Perform(WM_SYSCOMMAND, SC_MINIMIZE, 0);
            <b>end</b>;
            <b>end</b>;
            <br><b>end</b>.
            </code></pre&gt

            Comment


            • #7
              Unit1.dfm:
              <pre class="sourcecode"><code>
              <b>object</b> MainForm: TMainForm
              Left = 280
              Top = 54
              Width = 696
              Height = 480
              Caption = <font color="#9933CC">'MainForm'</font>
              Color = clBtnFace
              Font.Charset = DEFAULT_CHARSET
              Font.Color = clWindowText
              Font.Height = -11
              Font.Name = <font color="#9933CC">'MS Sans Serif'</font>
              Font.Style = []
              OldCreateOrder = False
              PixelsPerInch = 96
              TextHeight = 13
              <b>object</b> Panel1: TPanel
              Left = 144
              Top = 0
              Width = 544
              Height = 434
              Align = alRight
              Caption = <font color="#9933CC">'Panel1'</font>
              TabOrder = 0
              <b>end</b>
              <b>object</b> Button1: TButton
              Left = 16
              Top = 24
              Width = 75
              Height = 25
              Caption = <font color="#9933CC">'Neu'</font>
              TabOrder = 1
              OnClick = Button1Click
              <b>end</b>
              <b>object</b> StatusBar1: TStatusBar
              Left = 0
              Top = 434
              Width = 688
              Height = 19
              Panels = &lt;&gt;
              SimplePanel = False
              <b>end</b>
              <b>object</b> Button2: TButton
              Left = 16
              Top = 64
              Width = 75
              Height = 25
              Caption = <font color="#9933CC">'Alle minimieren'</font>
              TabOrder = 3
              OnClick = Button2Click
              <b>end</b>
              <b>end</b>
              </code></pre&gt

              Comment


              • #8
                Unit2.pas:
                <pre class="sourcecode"><code>
                <b>unit</b> Unit2;
                <br>
                <b>interface</b>
                <br>
                <b>uses</b>
                Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
                <br>
                <b>type</b>
                TChildForm = <b>class</b>(TForm)
                <b>procedure</b> FormClose(Sender: TObject; <b>var</b> Action: TCloseAction);
                <b>private</b>
                <font color="#003399"><i>{ Private-Deklarationen }</i></font>
                <b>public</b>
                <font color="#003399"><i>{ Public-Deklarationen }</i></font>
                <b>end</b>;
                <br>
                <b>var</b>
                ChildForm: TChildForm;
                <br>
                <b>implementation</b>
                <br>
                <font color="#003399"><i>{$R *.DFM}</i></font>
                <br>
                <b>procedure</b> TChildForm.FormClose(Sender: TObject; <b>var</b> Action: TCloseAction);
                <b>begin</b>
                Action := caFree;
                <b>end</b>;
                <br>
                <b>end</b>.
                </code></pre>

                Unit2.dfm:
                <pre class="sourcecode"><code>
                <b>object</b> ChildForm: TChildForm
                Left = 306
                Top = 117
                Width = 171
                Height = 175
                Caption = <font color="#9933CC">'ChildForm'</font>
                Color = clBtnFace
                Font.Charset = DEFAULT_CHARSET
                Font.Color = clWindowText
                Font.Height = -11
                Font.Name = <font color="#9933CC">'MS Sans Serif'</font>
                Font.Style = []
                OldCreateOrder = False
                Position = poDefaultPosOnly
                OnClose = FormClose
                PixelsPerInch = 96
                TextHeight = 13
                <b>end</b>
                </code></pre>
                So, das war alles. :-)
                HTH, Uli

                Comment


                • #9
                  Hi Uli,

                  danke für die Hilfe, hab in der Zwischenzeit auch eine Lösung gefunden.

                  procedure Form1.WMSize(var Msg: TWMSIZE);
                  Var
                  WindowPlacement : TWindowPlacement;
                  begin
                  if Msg.SizeType = 1 then
                  begin
                  WindowPlacement.length := sizeof(TWindowPlacement);
                  GetWindowPlacement(self.Handle, @WINDOWPLACEMENT);
                  WindowPlacement.flags := WPF_SETMINPOSITION;
                  WindowPlacement.ptMinPosition.Y := Form1.Height - 70;
                  SetWindowPlacement(self.Handle, @WINDOWPLACEMENT);
                  end;

                  So funktioniert es super. Aber trotzdem vielen Dank.

                  Gruß
                  Anfre

                  Comment

                  Working...
                  X