Page 1 of 1
Replace TeeTree after Zoom
Posted: Tue May 18, 2010 2:53 pm
by 10551078
Hi ,
D2007 + VLC 8.04
How to keep the tree on Top an Left = 0 after Zooming ??
I find the code But, without result
{ var tmpPos : Integer;
begin
tmpPos := (Tree1.HorzScrollBar.Max-Tree1.HorzScrollBar.Min) div 2;
tmpPos := tmpPos - (Tree1.HorzScrollBar.PageSize div 2);
Tree1.View3DOptions.HorizOffset := -tmpPos;
end;
}
E
Re: Replace TeeTree after Zoom
Posted: Thu May 20, 2010 11:45 am
by yeray
Hi mivchart,
I'm not sure what are you exactly trying to align on the top-left. Could you please send us a complete and simple example project we can run as-is to reproduce the issue here?
Re: Replace TeeTree after Zoom
Posted: Fri May 21, 2010 6:51 am
by 10551078
Hi,
it's simple, i join project with post
exmple code =========================
procedure TForm1.Track_ZoomChange(Sender: TObject); //Not result !
begin
// Change zoom
Tree1.View3DOptions.Zoom:=Track_Zoom.Position;
LabelZoom.Caption:=TeeStr(Tree1.View3DOptions.Zoom)+'%';
//<<<< HERE when i Zoom, the tree create offset on TOP and Left, it's no goodg for user !!!
end;
procedure TForm1.BtAlignTopLeftClick(Sender: TObject);
begin
Track_Zoom.Position:=100; //If Zoom return in 100% > ok Vetical Ofset =0
Tree1.View3DOptions.Zoom:=100; //<<< How take for align on TOP and LEFT=0 if Zoom <> 100%
Tree1.View3DOptions.HorizOffset:=0;
Tree1.View3DOptions.VertOffset:=0;
end;
Re: Replace TeeTree after Zoom
Posted: Mon May 24, 2010 2:59 pm
by yeray
Hi mivchart,
Apparently it seems to be a problem with the Horizontal and Vertical scrollbars that should be reset to 0. The problem then is that the Position property is read-only so the following code isn't accepted:
Code: Select all
procedure TForm1.Track_ZoomChange(Sender: TObject);
begin
// Change zoom
Tree1.View3DOptions.Zoom:=Track_Zoom.Position;
LabelZoom.Caption:=TeeStr(Tree1.View3DOptions.Zoom)+'%';
Tree1.Draw();
Tree1.Draw();
end;
procedure TForm1.Tree1AfterDraw(Sender: TObject);
begin
Tree1.VertScrollBar.Position:=0;
Tree1.HorzScrollBar.Position:=0;
end;
But it will be accepted if you change TTreeScrollBar's Position property definition TeeTree.pas from:
Code: Select all
property Position:Integer read GetPosition;
To this:
Code: Select all
property Position:Integer read GetPosition write SetPosition default 0;
I've seen that you are source code customer so, please, try with the changes above and tell us if it works better.
Also note that 8.04 is not the latest version available so, please, try with the latest (8.07).
Re: Replace TeeTree after Zoom
Posted: Tue May 25, 2010 7:07 am
by 10551078
Hi,
sorry , but no result.
i have changed the code in unit Teetree.pas with example
Code: Select all
property Position:Integer read GetPosition write SetPosition default 0;
i have changed my code > but without effect !
Code: Select all
procedure TFrameEfcTree.Tree1AfterDraw(Sender: TObject);
begin
Tree1.VertScrollBar.Position :=0;
Tree1.HorzScrollBar.Position :=0;
end;
My request is simple, if I zoom I want to keep the position and left top = 0 = 0 of my tree for the good look user ?
Re: Replace TeeTree after Zoom
Posted: Tue May 25, 2010 7:42 am
by yeray
Hi mivchart,
Have you assigned the AfterDraw event correctly? I haven't posted the code because I've created it at design time.
Re: Replace TeeTree after Zoom
Posted: Tue May 25, 2010 7:59 am
by 10551078
i have this code in my form
Code: Select all
procedure TFrameEfcTree.Tree1AfterDraw(Sender: TObject);
begin
Tree1.VertScrollBar.Position :=0; //no result !!
Tree1.HorzScrollBar.Position :=0;
end;
procedure TFrameEfcTree.Tree1Zoom(Sender: TObject);
begin
if not ZoomChange then begin
// Show % percent of zoom in label
LabelZoom.Caption:=TeeStr(Tree1.View3DOptions.Zoom)+'%';
Tree1.draw();
Tree1.draw();
end;
end;
in my unit teetree, only
Code: Select all
property Position:Integer read GetPosition write SetPosition default 0; //MD 4.215
Re: Replace TeeTree after Zoom
Posted: Tue May 25, 2010 9:52 am
by yeray
Hi mivchart,
I see you've included the Tree1Zoom event that wasn't in the project you sent.
I've added this to the defect list to be revised in future releases (TV52014910) but in the meanwhile please, try with event like Zoom, AfterDraw,... as you do.
I've seen that the Horizontal and Vertical ScrollBars are changing their Min and Max values when zooming. The problem could come from here.