 |
MESSAGE BOARD
|
| View previous topic :: View next topic |
| Author |
Message |
P_G Member
Joined: 14 Jun 2004 Posts: 21 Location: Germany
|
Posted: 02/08/04 11:07 Post subject: Scrollbars of simplegraph |
|
|
Hi, Kambiz
Here's another idea for simplegraph: When you insert a couple of nodes and move them into negativ coordinates (the upper-left corner of the component), they are "lost", because no scrollbars appear. Of course you can mark all objects and move them by keyboard into your view. But for many users it would be a lot more comfortable, if scrollbars are shown for nodes with negativ coordinates too.
C.U. P_G |
|
| Back to top |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 414 Location: Tehran, Iran
|
Posted: 03/08/04 20:24 Post subject: |
|
|
| I tried but I couldn't find an easy way to implement it. |
|
| Back to top |
|
 |
Kambiz Administrator

Joined: 07 Mar 2003 Posts: 414 Location: Tehran, Iran
|
Posted: 04/08/04 07:23 Post subject: |
|
|
I added new FreezeTopLeft property to the TSimpleGraph's interface. When this property is True, the objects don't accept negative coordinates.
Cheers,
Kambiz |
|
| Back to top |
|
 |
P_G Member
Joined: 14 Jun 2004 Posts: 21 Location: Germany
|
Posted: 04/08/04 20:14 Post subject: Good workaround |
|
|
Yip! That's a good way. Thank you, Kambiz.
P_G |
|
| Back to top |
|
 |
MeW Member
Joined: 17 Feb 2005 Posts: 5 Location: Netherlands
|
Posted: 21/02/05 15:18 Post subject: Patch to enable scrolling beyond the topleft corner... |
|
|
I'm not sure if this would be a proper place to enter such a routine, but it seems to behave. Patch the method or create a subclass which overrides this method like this:
| Code: |
procedure TSimpleGraph.DoCanMoveResizeNode(Node: TGraphNode; var aLeft,
aTop, aWidth, aHeight: Integer; var CanMove, CanResize: Boolean);
var
i: integer;
Delta: TPoint;
R: TRect;
begin
if FreezeTopLeft then
begin
if aLeft < 0 then aLeft := 0;
if aTop < 0 then aTop := 0;
end
else
begin
{ MeW: scroll other nodes to the bottom right
if a node is scrolled beyond the topleft }
if (aLeft < Left) or (aTop < Top) then
begin
Delta := Point(0,0);
if (aLeft < Left) then Delta.X := -aLeft;
if (aTop < Top) then Delta.Y := -aTop;
BeginUpdate;
try
for i:=0 to ObjectsCount-1 do
begin
if (Objects.Items[i] <> Node) then
begin
R := Objects[i].BoundsRect;
OffsetRect(R, Delta.X, Delta.Y);
Objects[i].BoundsRect := R;
end;
end;
if (aLeft < Left) then aLeft := Left;
if (aTop < Top) then aTop := Top;
finally
EndUpdate;
end;
end;
end;
if Assigned(OnCanMoveResizeNode) then
OnCanMoveResizeNode(Self, Node, aLeft, aTop, aWidth, aHeight, CanMove, CanResize);
end;
|
|
|
| Back to top |
|
 |
Stefan Junior Member
Joined: 27 Sep 2004 Posts: 51 Location: Netherlands
|
Posted: 21/02/05 16:35 Post subject: |
|
|
Hello,
I've adjusted the code a little to get a little different behaviour, hope you don't mind
Cheers,
Stefan
| Code: |
procedure TExtGraph.DoCanMoveResizeNode(Node: TGraphNode; var aLeft,
aTop, aWidth, aHeight: Integer; var CanMove, CanResize: Boolean);
var
i: integer;
Delta: TPoint;
R: TRect;
begin
if FreezeTopLeft then begin
if aLeft < 0 then aLeft := 0;
if aTop < 0 then aTop := 0;
end else begin
{ MeW: scroll other nodes to the bottom right if a node is scrolled beyond the topleft }
if (aLeft < 0) or (aTop < 0) then begin
Delta := Point(0,0);
if (aLeft < 0) then Delta.X := -aLeft;
if (aTop < 0) then Delta.Y := -aTop;
BeginUpdate;
try
for i:=0 to ObjectsCount-1 do
begin
if (Objects.Items[i] <> Node) then
begin
R := Objects[i].BoundsRect;
OffsetRect(R, Delta.X, Delta.Y);
Objects[i].BoundsRect := R;
end;
end;
if (aLeft < 0) then aLeft := 0;
if (aTop < 0) then aTop := 0;
finally
EndUpdate;
end;
end;
end;
if Assigned(OnCanMoveResizeNode) then
OnCanMoveResizeNode(Self, Node, aLeft, aTop, aWidth, aHeight, CanMove, CanResize);
end;
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
Powered by phpBB 2.0.6 © 2001, 2002 phpBB Group
|