AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Sonstige Fragen zu Delphi Delphi VirtualTreeView Editfelder, ComboBox und andere
Thema durchsuchen
Ansicht
Themen-Optionen

VirtualTreeView Editfelder, ComboBox und andere

Ein Thema von Jens Hartmann · begonnen am 28. Mär 2016 · letzter Beitrag vom 1. Nov 2016
Antwort Antwort
Benutzerbild von haentschman
haentschman

Registriert seit: 24. Okt 2006
Ort: Seifhennersdorf / Sachsen
5.457 Beiträge
 
Delphi 12 Athens
 
#1

AW: VirtualTreeView Editfelder, ComboBox und andere

  Alt 2. Apr 2016, 17:17
Gern geschehen...
Ich denke, das wichtigste an diesem Konstrukt ist die Unabhängigkeit vom "Parent" darunter. Wie man das dann gestaltet ist die Kür.
  Mit Zitat antworten Zitat
Benutzerbild von Jens Hartmann
Jens Hartmann

Registriert seit: 11. Jan 2009
Ort: Wilnsdorf
1.439 Beiträge
 
Delphi XE2 Professional
 
#2

AW: VirtualTreeView Editfelder, ComboBox und andere

  Alt 2. Apr 2016, 21:19
Hallo haentschman,

wie Positionierst Du die Form auf dem VST.

Ich habe das ganze wie folgt versucht, die Position passt aber nicht...

Delphi-Quellcode:
var
  CellRect : TRect;
  Node : PVirtualNode;
begin
...
  CellRect := vst.GetDisplayPosition(Node, Column, false);
  fForm2.Top := CellRect.Top;
  fForm2.Left := CellRect.Left;
  fForm2.ShowModal;
end;
Jens Hartmann
Das Leben selber ist zu kurz, also nutze jeden Tag wie er kommt.
  Mit Zitat antworten Zitat
Benutzerbild von haentschman
haentschman

Registriert seit: 24. Okt 2006
Ort: Seifhennersdorf / Sachsen
5.457 Beiträge
 
Delphi 12 Athens
 
#3

AW: VirtualTreeView Editfelder, ComboBox und andere

  Alt 3. Apr 2016, 06:19
Moin...

aktuell habe ich noch eine TAdvListview drunter. Die Umstellung auf VT steht auf der TodoListe.

Vieleicht können dir die Brocken ein paar Ansätze liefern.

1. Positionierung Form
Delphi-Quellcode:
class procedure TdTools.SetEditorPositions(ParentListView: TAdvListView; Editor: TForm);
var
  I: Integer;
  CurrentPoint: TPoint;
  CurrentTop: Integer;
begin
  CurrentPoint:= ParentListview.ClientToScreen(Point(30,0)); // 30 = um erste Spalte eingerückt
  CurrentTop:= CurrentPoint.Y + ParentListview.Selected.Top; // beim Listview hat der selektierte Eintrag Top... VT ?
  if (CurrentTop + Editor.Height) > Screen.WorkAreaHeight then // klappt den Editor entweder nach unten oder nach oben wenn er nicht mehr auf den Screen paßt
  begin
    CurrentTop:= (CurrentTop + ParentListview.ItemHeight) - Editor.Height + 4;
  end;
  Editor.Top:= CurrentTop;
  Editor.Left:= CurrentPoint.X;
  Editor.Width:= 0;
  for I := 1 to ParentListView.Columns.Count -1 do
  begin
    Editor.Width:= Editor.Width + ParentListView.Column[I].Width;
  end;
  Editor.Width:= Editor.Width + conEditorOffsetWidth; // Offset = Feinjustierung für Liniendicke des Grids
end;
2. Im constructor bekommt der Editor(Form) den Parent mit:
Delphi-Quellcode:
constructor TfoInlineEditorProfiles.Create(Preferences: TdVAPreferences; Database: IdVA_Database; Profile: TProfile; ParentListview: TAdvListView);
begin
  inherited Create(nil);
  FLogic:= TInlineEditorProfile.Create(Preferences, Database, Profile); // die BL zum Form
  FLogic.OnGetProfileGroups:= DoOnGetProfileGroups;
  FLogic.OnGetParameters:= DoOnGetParameters;
  FLogic.GetData;

  pgrProfileProperties.ActivePageIndex:= 0;
  tvDevices.Width:= FLogic.Preferences.PositionsVA.SplitterEditorProfiles;
  TdTools.SetControlPosition(ParentListview, 1, True, edtProfileNameLong, daLeft); // Positionierung der 1. Reihe auf die Spalten
  TdTools.SetControlPosition(ParentListview, 2, True, cbbProfileGroup, daLeft);
  TdTools.SetControlPosition(ParentListview, 3, True, cbbBatchJob, daLeft);
  TdTools.SetControlPosition(ParentListview, 4, True, cbbVisualType, daLeft);
  TdTools.SetControlPosition(ParentListview, 5, True, cbbActive, daLeft);
  if FLogic.Preferences.PositionsVA.SplitterEditorProfiles > pnlDevices.Width then
  begin
    pnlDevices.Width:= FLogic.Preferences.PositionsVA.SplitterEditorProfiles;
  end
  else
  begin
    FLogic.Preferences.PositionsVA.SplitterEditorProfiles:= pnlDevices.Width;
  end;
end;
3. Positionierung auf Spalten
Delphi-Quellcode:
class procedure TdTools.SetControlPosition(ParentListView: TAdvListView; ColumnIndex: Integer; SetWidth: Boolean; Control: TControl; Align: TdAlign);
var
  I: Integer;
begin
  // Todo: Berücksichtigung wenn Control größer als Column
  Control.Left:= 0;

  for I := 1 to ColumnIndex do
  begin
    if I = 1 then
    begin
      Control.Left:= Control.Left;
    end
    else
    begin
      Control.Left:= Control.Left + ParentListView.Column[I - 1].Width;
    end;
    if (I = ColumnIndex) and not (ColumnIndex = 1) then
    begin
      Control.Left:= Control.Left - 1;
    end;
  end;

  if SetWidth then
  begin
    Control.Width:= ParentListView.Column[ColumnIndex].Width + 1;
    if Control is TAdvSmoothComboBox then
    begin
      TAdvSmoothComboBox(Control).DropDownWidth:= Control.Width;
    end;
  end;

  case Align of
    daLeft: Control.Left:= Control.Left;
    daRight: Control.Left:= Control.Left + (ParentListView.Column[ColumnIndex].Width - Control.Width);
    daCenter: Control.Left:= Control.Left + ((ParentListView.Column[ColumnIndex].Width - Control.Width) div 2);
  end;
end;
  Mit Zitat antworten Zitat
Antwort Antwort


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 06:56 Uhr.
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