Announcement

Collapse
No announcement yet.

Panels vs. Splitter

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

  • Panels vs. Splitter

    Ich möchte die Splitter zwischen die 3 Panels legen -->
    [] -> Panel
    l -> Splitter

    1. []l[]l[] -->

    wenn ich nun einen Panel wegschalte sollte einer der beiden Panels auf Visible := False; gesetzt werden

    2. [ ]l[ ] -->

    ergo nur noch ein Splitter sichtbar zwischen 2 Panels

    3. [ ] -->

    und dann nur noch ein Panel .. beide Splitter auf false

    Hier ist der Quellcode .. viell. hat ja jemand eine Idee )

    <pre>
    // Case angabe zu den Panels

    procedure TForm1.Setze(Pan: Integer);
    var
    Gross, TopPos, t: Integer;
    begin
    if not P0.Visible then
    P0.Visible := True;
    case Pan of
    1:
    begin
    if P1.Visible = False then
    begin
    P0.Visible := True;
    P1.Visible := True;
    P1.Align := alTop;
    SP1.Visible := P2.Visible;
    SP2.Visible := ((P1.Visible) or (P2.Visible)) and (P3.Visible);
    end;
    end;
    2:
    begin
    if P2.Visible = False then
    begin
    P0.Visible := True;
    P2.Visible := True;
    P2.Align := alTop;
    SP1.Visible := P1.Visible;
    SP2.Visible := ((P1.Visible) or (P2.Visible)) and (P3.Visible);
    SP1.Top := P2.Top;
    SP2.Top := P3.Top;
    end;
    end;
    3:
    begin
    if P3.Visible = False then
    begin
    P0.Visible := True;
    P3.Visible := True;
    P3.Align := alTop;
    SP2.Visible := ((P1.Visible) or (P2.Visible)) or (P2.Visible);
    SP2.Top := P3.Top;
    end;
    end;
    -1:
    begin
    P1.Visible := False;
    SP1.Visible := False;
    SP2.Visible := ((P1.Visible) or (P2.Visible)) and (P3.Visible);
    end;
    -2:
    begin
    P2.Visible := False;
    SP1.Visible := False;
    SP2.Visible := ((P1.Visible) or (P2.Visible)) and (P3.Visible);
    end;
    -3:
    begin
    P3.Visible := False;
    SP1.Visible := (P1.Visible) and (P2.Visible);
    SP2.Visible := False;
    end;
    end;

    t := 0;
    if P1.Visible = true then
    Inc(t);
    if P2.Visible = true then
    Inc(t);
    if P3.Visible = true then
    Inc(t);

    if t = 0 then
    begin
    P0.Visible := False;
    Exit;
    end;

    Gross := P0.Height;
    TopPos := 0;
    Gross := Gross div t;

    if P3.Visible then
    begin
    P3.Top := TopPos;
    P3.Height := Gross;
    TopPos := TopPos + Gross;
    end;

    if P2.Visible then
    begin
    P2.Top := TopPos;
    P2.Height := Gross;
    TopPos := TopPos + Gross;
    end;

    if P1.Visible then
    begin
    P1.Top := TopPos;
    P1.Height := Gross;
    TopPos := TopPos + Gross;
    end;

    P1.Align := alTop;
    P2.Align := alTop;
    P3.Align := alTop;
    SP1.Align := alTop;
    SP2.Align := alTop;
    if P1.Visible = True then
    P1.Top := 0;

    if (P1.Visible = False) and (P2.Visible = True) then
    P2.Top := 0;
    if (P1.Visible = True) and (P2.Visible = True) then
    P2.Top := Gross;

    if (P1.Visible = False) and (P2.Visible = False) and (P3.Visible = True) then
    P3.Top := 0;
    if (P1.Visible = True) and (P2.Visible = False) and (P3.Visible = True) then
    P3.Top := Gross;
    if (P1.Visible = True) and (P2.Visible = True) and (P3.Visible = True) then
    P3.Top := Gross * 2;

    SP1.Top := P2.Top - SP1.Height;
    SP2.Top := P3.Top - SP2.Height;

    if (P1.Visible = True) and (P2.Visible = False) and (P3.Visible = False) then
    P1.Align := alClient;
    if (P1.Visible = True) and (P2.Visible = False) and (P3.Visible = True) then
    P3.Align := alClient;
    if (P1.Visible = True) and (P2.Visible = True) and (P3.Visible = False) then
    P2.Align := alClient;
    if (P1.Visible = True) and (P2.Visible = True) and (P3.Visible = True) then
    P3.Align := alClient;
    end;
    </pre>

    MFG Nik

  • #2
    Was funktioniert denn jetzt daran eigentlich nicht?

    Gruß Björ

    Comment


    • #3
      Hallo!<br>
      Ist ja ein netter Effekt. Wenn man die Splitter wieder auf sichtbar schaltet erscheinen Sie an einer vollkommen anderen Position.<br>
      Bei mir klappts mit:<br>
      Splitter1.left := panel1.left + panel1.width;<br>
      (bei drei vertikalen Panels getrennt durch zwei Splitter)<br>
      Also einfach die Position der Splitter nach dem sichtbarmachen neu setzen und schon "springt" der Splitter wieder am seinen ursprünglichen Platz zurück.<br>
      BYE BERN

      Comment

      Working...
      X