When I assign icons (32*32) to my nodes the text is not repositioned at the right of the icon, its written right over it!? How can I position the text?
Regards, Mikael
Position text on node
Re: Position text on node
Hi Mikael,
I'm trying to reproduce the problem with the following code:
Could you please explain what would you expect to obtain or what modifications are needed to reproduce the problem?
I'm trying to reproduce the problem with the following code:
Code: Select all
uses TeeTree, PNGImage;
procedure TForm1.FormCreate(Sender: TObject);
var Tree1: TTree;
TreeNodeShape1: TTreeNodeShape;
begin
Tree1:=TTree.Create(self);
Tree1.Parent:=Self;
Tree1.Align:=alClient;
TreeNodeShape1:=TTreeNodeShape.Create(self);
TreeNodeShape1.Text.Text:='my first node';
TreeNodeShape1.Tree:=Tree1;
TreeNodeShape1.Image.LoadFromFile('C:\tmp\32_button_red.png');
// TreeNodeShape1.ImageAlignment:=iaCenter;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Position text on node
I use the following code to create then nodes:
Node := Tree.AddRootObject('Group ' + intToStr(I), TNodeData.Create);
Node.AutoSize := True;
Node.Height := 34;
Node.Font.Size := 12;
Node.Border.Hide;
Node.ImageListIndex := 0;
After some testing I found that it's the "Node.Height := 34;" command that is the problem! When I comment this line the text is positioned right of the icon.
The icons are 32*32 so if I don't set the hight to 34 there is no space between them!.
Mikael
Node := Tree.AddRootObject('Group ' + intToStr(I), TNodeData.Create);
Node.AutoSize := True;
Node.Height := 34;
Node.Font.Size := 12;
Node.Border.Hide;
Node.ImageListIndex := 0;
After some testing I found that it's the "Node.Height := 34;" command that is the problem! When I comment this line the text is positioned right of the icon.
The icons are 32*32 so if I don't set the hight to 34 there is no space between them!.
Mikael
Re: Position text on node
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Position text on node
No, the HorizOffset and VertOffset only positions the text within the node! I want to increase the distance between two nodes in Y-direction. As default the icons added to the nodes are positioned exactly below each other!
Regards, Mikael
Regards, Mikael
Re: Position text on node
Hi Mikael,
So the problem may be in the height? Could you please try the following?
So the problem may be in the height? Could you please try the following?
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var t: Integer;
begin
with Tree1.AddRoot('Root') do
begin
Tree1.Items[0].Height:=32;
Tree1.Items[0].Width:=Form1.Canvas.TextWidth(Tree1.Items[0].Text.Text);
for t:=1 to 20 do
begin
AddChild('Node '+IntToStr(t));
Tree1.Items[t].Height:=32;
Tree1.Items[t].Width:=Form1.Canvas.TextWidth(Tree1.Items[t].Text.Text);;
end;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |