Scrollbars of simplegraph
Select messages from
# through # FAQ
[/[Print]\]

DELPHI AREA -> DELPHI AREA's Products

#1: Scrollbars of simplegraph Author: P_GLocation: Germany PostPosted: 02/08/04 11:07
    —
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. Idea

C.U. P_G

#2:  Author: KambizLocation: Tehran, Iran PostPosted: 03/08/04 20:24
    —
I tried but I couldn't find an easy way to implement it. Sad

#3:  Author: KambizLocation: Tehran, Iran PostPosted: 04/08/04 07:23
    —
I added new FreezeTopLeft property to the TSimpleGraph's interface. When this property is True, the objects don't accept negative coordinates.

Cheers,
Kambiz

#4: Good workaround Author: P_GLocation: Germany PostPosted: 04/08/04 20:14
    —
Yip! That's a good way. Thank you, Kambiz. Wink

P_G

#5: Patch to enable scrolling beyond the topleft corner... Author: MeWLocation: Netherlands PostPosted: 21/02/05 15:18
    —
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;

#6:  Author: StefanLocation: Belgium, Antwerp PostPosted: 21/02/05 16:35
    —
Hello,

I've adjusted the code a little to get a little different behaviour, hope you don't mind Smile

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;

#7:  Author: MeWLocation: Netherlands PostPosted: 03/03/05 12:02
    —
more enhancements are being prepared in the SourceForge project which also handles scrolling outside the bottomright corner...



DELPHI AREA -> DELPHI AREA's Products


output generated using printer-friendly topic mod. All times are GMT

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group