Delphi-PRAXiS

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/)
-   -   Delphi Für FMX TGrid OnTopLeftChanged nachempfinden? (https://www.delphipraxis.net/198258-fuer-fmx-tgrid-ontopleftchanged-nachempfinden.html)

QuickAndDirty 17. Okt 2018 15:16

Für FMX TGrid OnTopLeftChanged nachempfinden?
 
Hallo ich möchte zwei(eigentlich 3) FMX TGrids Synchronisieren.
Also auf das ändern der obersten-linken-angezeigten-Zelle reagieren.

Wie kann ich das machen?

Hintergrund:
Für eine vom Benutzer bearbeitbare Many-to-Many Beziehung brauche ich ein Gitter mit nicht vertikal rollendem header und Nicht horizontal rollender Seitenleiste...
Da es ja FixedCol Nicht mehr gibt, emuliere ich eine Fixedcol durch ein benachbartes TGrid.

Harry Stahl 17. Okt 2018 17:06

AW: Für FMX TGrid OnTopLeftChanged nachempfinden?
 
Versuchs mal mit dem Event "OnViewPortpositionChange"...

QuickAndDirty 17. Okt 2018 17:08

AW: Für FMX TGrid OnTopLeftChanged nachempfinden?
 
OK, SetTopLeft ändert ja auch ViewPortPosition.

Allerdings hat TGrid OnViewPortpositionChange nicht published... ich suche es mal
Delphi-Quellcode:
procedure TStyledGrid.SetTopLeft(const ACol, ARow: Integer);
var
  R: TRect;
  LCol, LRow: Integer;
begin
  if ((ACol >= 0) or (ARow >= 0)) and (ACol < Model.ColumnCount) and (ARow < Model.RowCount) then
  begin
    LCol := Max(0, ACol);
    LRow := Max(0, ARow);
    R := CellRect(LCol, LRow);
    AniCalculations.BeginUpdate;
    try
      if not AniCalculations.Down then
        AniCalculations.MouseDown(0, 0);
      AniCalculations.MouseLeave;
      if ACol < 0 then
        ViewportPosition := TPointF.Create(ViewportPosition.X, R.Top)
      else if ARow < 0 then
        ViewportPosition := TPointF.Create(R.Left, ViewportPosition.Y)
      else
        ViewportPosition := TPointF.Create(R.Left, R.Top);
    finally
      AniCalculations.EndUpdate;
    end;
    AniCalculations.UpdatePosImmediately(True);
  end;
end;

QuickAndDirty 17. Okt 2018 17:18

AW: Für FMX TGrid OnTopLeftChanged nachempfinden?
 
OK, das geht :)


Alle Zeitangaben in WEZ +1. Es ist jetzt 06:16 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