![]() |
VirtualStringTree: "Beispiel" beschreibt Form.capt
Hallo und Frohe Ostern!
Momentan lese ich mich in VirtualStringTree ein und habe das simple Beispiel "Minimal" in meine Anwendung kopiert. Ohne jegliche Veränderung! Problem ist nun, die Routine "InitNode" beschreibt nicht die Captions der Knoten, sondern verändert lediglich meinen Fenstertitel.
Delphi-Quellcode:
Sehe ich den Wald vor lauter Bäumen nicht???
procedure TFMain.TVElemente1InitNode(Sender: TBaseVirtualTree; ParentNode,
Node: PVirtualNode; var InitialStates: TVirtualNodeInitStates); var Data: PMyRec; begin with Sender do begin Data := GetNodeData(Node); // Construct a node caption. This event is triggered once for each node but // appears asynchronously, which means when the node is displayed not when it is added. Data.Caption := Format('Level %d, Index %d', [GetNodeLevel(Node), Node.Index]); end; end; Gruss, Ralf |
Re: VirtualStringTree: "Beispiel" beschreibt Form.
Guck dir ma den Data - Typ genauer an bzw. poste den hier rein.
Oder OnGetText Ereignis |
Re: VirtualStringTree: "Beispiel" beschreibt Form.
Die sind auch aus dem Beispiel kopiert:
Datatype:
Delphi-Quellcode:
OnGetText:
type
PMyRec = ^TMyRec; TMyRec = record Caption: WideString; end;
Delphi-Quellcode:
Selbst eine Änderung von "Caption" in z.B. "Captions" bringt nichts ... :gruebel:
procedure TFMain.TVElemente1GetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType; var CellText: WideString); var Data: PMyRec; begin // A handler for the OnGetText event is always needed as it provides the tree with the string data to display. // Note that we are always using WideString. Data := Sender.GetNodeData(Node); if Assigned(Data) then Text := Data.Caption; end; |
Re: VirtualStringTree: "Beispiel" beschreibt Form.
Hallo,
der Fehler dürfte in der vorletzten Zeile liegen:
Delphi-Quellcode:
Gruß Hawkeye
Data := Sender.GetNodeData(Node);
if Assigned(Data) then // Text := Data.Caption; CellText := Data.Caption; end; |
Re: VirtualStringTree: "Beispiel" beschreibt Form.
Zitat:
Frage mich nur, weshalb das in dem Beispiel "Minimal" so funktioniert?! Danke und Gruss, Ralf |
Re: VirtualStringTree: "Beispiel" beschreibt Form.
Zitat:
Gruß Hawkeye |
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:23 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 by Thomas Breitkreuz