Delphi-PRAXiS
Seite 3 von 4     123 4      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   falsche Anordnung von TPanels (https://www.delphipraxis.net/217272-falsche-anordnung-von-tpanels.html)

Geri 3. Jun 2025 13:01

AW: falsche Anordnung von TPanels
 
Noch eine Info dazu: Habe in das Beispiel von Uwe noch Cornerbuttons, wie bei mir eingefügt. Das funktioniert auch
Delphi-Quellcode:
procedure TForm1.ShowPanel(APanel: TPanel);
begin
  APanel.Height := APanel.TagFloat;
end;

procedure TForm1.SetLandScape(const Value: Boolean);
begin
  if FLandScape <> Value then
  begin
    FLandScape := Value;
    if Value then
    begin
       btn1.parent:=panel1;
       btn2.parent:=panel1;
       btn3.parent:=panel3;
       btn4.parent:=panel3;
       btn5.parent:=panel5;
       btn6.parent:=panel5;
    end
    else
    begin
       btn1.parent:=panel2;
       btn2.parent:=panel2;
       btn3.parent:=panel4;
       btn4.parent:=panel4;
       btn5.parent:=panel6;
       btn6.parent:=panel6;
    end;
    for var pnl in [Panel2, Panel4, Panel6] do
    begin
      if Value then
        HidePanel(pnl)
      else
        ShowPanel(pnl);
    end;
  end;
end;

Uwe Raabe 3. Jun 2025 13:27

AW: falsche Anordnung von TPanels
 
Also, das Verfahren funktioniert nun zwar prinzipiell, aber dummerweise in deinem konkreten Fall nicht. Dann muss da noch irgendwas anderes die Ursache sein und somit brauchen wird noch ein paar mehr Informationen.

Geri 3. Jun 2025 14:08

AW: falsche Anordnung von TPanels
 
Liste der Anhänge anzeigen (Anzahl: 3)
So, habe nun mal ein Programm mit den selben Panels erstellt.

Anbei das Projekt.
Nicht er identische, aber ähnlicher Fehler. Alle Panels pnlAxis01, pnlAxis11 und pnlAxis21, die im Portrai-Modus dargestellt sind, werden am Ende angehängt
Vielleicht hat es etwas mit dem Stylebook zu tnun

Delphi-Quellcode:
unit uFirstApp;

interface

uses
  System.Rtti, System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,FMX.Objects,
  FMX.Controls.Presentation, System.ImageList, FMX.ImgList, FMX.Layouts
  {$ifdef ANDROID}
  ,
  Androidapi.JNI.Bluetooth,
  Androidapi.JNI.JavaTypes,
  Androidapi.Helpers,
  Androidapi.jni.app,
  Androidapi.JNI.Os,
  Androidapi.JNI.Net,
  Androidapi.JNI.GraphicsContentViewText,
  Androidapi.JNIBridge,
  System.IOUtils
  {$endif}
  ;

type
  TForm1 = class(TForm)
    pnlAxis0: TPanel;
    btnAxisName0: TCornerButton;
    SB: TStyleBook;
    btnAxisValue0: TCornerButton;
    btnAxisUnit0: TCornerButton;
    btnAxisDiv0: TCornerButton;
    btnAxisW0: TCornerButton;
    btnAxisBuzzer0: TCornerButton;
    ImageList1: TImageList;
    pnlAxis2: TPanel;
    btnAxisName2: TCornerButton;
    btnAxisValue2: TCornerButton;
    btnAxisUnit2: TCornerButton;
    btnAxisDiv2: TCornerButton;
    btnAxisBuzzer2: TCornerButton;
    pnlAxis1: TPanel;
    btnAxisName1: TCornerButton;
    btnAxisValue1: TCornerButton;
    btnAxisUnit1: TCornerButton;
    btnAxisDiv1: TCornerButton;
    btnAxisW1: TCornerButton;
    btnAxisBuzzer1: TCornerButton;
    Button1: TButton;
    btnAxisW2: TCornerButton;
    pnlAxis21: TPanel;
    pnlAxis11: TPanel;
    pnlAxis01: TPanel;
    procedure Button1Click(Sender: TObject);
  private
   FLandScape: Boolean;
   procedure SetLandScape(const Value: Boolean);
    { Private declarations }
  protected
    procedure ShowPanel(APanel: TPanel);
    procedure HidePanel(APanel: TPanel);
  public
    property LandScape: Boolean read FLandScape write SetLandScape;

  end;
var
  Form1: TForm1;

implementation

{$R *.fmx}

procedure TForm1.Button1Click(Sender: TObject);
begin
 LandScape := not LandScape;
end;

procedure TForm1.SetLandScape(const Value: Boolean);
begin
  if FLandScape <> Value then
  begin
    FLandScape := Value;
    if FLandscape then
    begin
      btnAxisW0.parent:= pnlAxis0;
      btnAxisDiv0.parent:= pnlAxis0;
      btnAxisBuzzer0.parent:= pnlAxis0;

      btnAxisW1.parent:= pnlAxis1;
      btnAxisDiv1.parent:= pnlAxis1;
      btnAxisBuzzer1.parent:= pnlAxis1;

      btnAxisW2.parent:= pnlAxis2;
      btnAxisDiv2.parent:= pnlAxis2;
      btnAxisBuzzer2.parent:= pnlAxis2;
    end
    else
    begin
      btnAxisW0.parent:= pnlAxis01;
      btnAxisDiv0.parent:= pnlAxis01;
      btnAxisBuzzer0.parent:= pnlAxis01;

      btnAxisW1.parent:= pnlAxis11;
      btnAxisDiv1.parent:= pnlAxis11;
      btnAxisBuzzer1.parent:= pnlAxis11;

      btnAxisW2.parent:= pnlAxis21;
      btnAxisDiv2.parent:= pnlAxis21;
      btnAxisBuzzer2.parent:= pnlAxis21;
    end;

    for var pnl in [pnlAxis01, pnlAxis11, pnlAxis21] do
    begin
      if Value then
        HidePanel(pnl)
      else
      begin
        ShowPanel(pnl);
      end;
    end;
  end

end;


procedure TForm1.HidePanel(APanel: TPanel);
begin
  APanel.TagFloat := APanel.Height;
  APanel.Height := 0;
end;

procedure TForm1.ShowPanel(APanel: TPanel);
begin
  APanel.Height := APanel.TagFloat;
end;

end.

Uwe Raabe 3. Jun 2025 14:12

AW: falsche Anordnung von TPanels
 
Ist das Absicht, dass der Anhang in deinem letzten Post exakt meinem Beispiel entspricht? Interessanter wäre ein Beispiel, bei dem es nicht funktioniert.

Geri 3. Jun 2025 15:00

AW: falsche Anordnung von TPanels
 
Ja, das war Absicht, damit es übersichtlicher wird. Meiner Ansicht stimmt hier die Reihenfolge auch nicht.
Die Anordnung sollte in der Portrait-Ansicht:

SOLL:
pnlAxis0
pnlAxis01
pnlAxis1
pnlAxis11
pnlAxis2
pnlAxis21
sein.

IST:
pnlAxis0
pnlAxis1
pnlAxis2
pnlAxis01
pnlAxis11
pnlAxis21

Uwe Raabe 3. Jun 2025 15:09

AW: falsche Anordnung von TPanels
 
In dem Code-Beispiel kommen aber gar keine pnlAxis<irgendwas> vor. Der Anhang ist exakt die Zip-Datei, die ich in meinem Anhang schon mitgeschickt hatte.

Geri 3. Jun 2025 15:18

AW: falsche Anordnung von TPanels
 
Liste der Anhänge anzeigen (Anzahl: 1)
Sorry, hast recht, mein Fehler.

Anbei das Projekt.

Uwe Raabe 3. Jun 2025 15:32

AW: falsche Anordnung von TPanels
 
Liste der Anhänge anzeigen (Anzahl: 3)
Wenn ich die Panel in ein TLayout setze, wie in meinem Beispiel, funktioniert es.

Geri 3. Jun 2025 16:10

AW: falsche Anordnung von TPanels
 
Liste der Anhänge anzeigen (Anzahl: 1)
Ja, so wie bei dir sollte es aussehen. Bei mir tut es das nicht.

Ich nutze Delphi 12 Community Edition

Die Version sollte recht aktuell sein, habe sie letzte Woche installiert.

Gibt es evtl. noch globale Einstellungen, die zu dem Verhalten führen könnten?

Geri 3. Jun 2025 16:12

AW: falsche Anordnung von TPanels
 
mit Layout geht es bei mir auch:-D

Ich probiere nun noch das komplexere Programm


Alle Zeitangaben in WEZ +1. Es ist jetzt 20:54 Uhr.
Seite 3 von 4     123 4      

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz