How to "FreezeBottomRight"?

Please post bug reports, feature requests, or any question regarding the DELPHI AREA projects here.

How to "FreezeBottomRight"?

Postby lbc » August 5th, 2005, 9:17 am

Hello
I appreciate particularly the FreezeTopLeft property
Now as i'd like to let the user to put shapes only in the graph current dimensions (I mean: without getting scrollbars when he goes down the bottom right edge), how to get something like a "FreezeBottomRight"?

I was thinking to use OnCanMoveResizeNode but it doesn't seem to get the wished result (basically I have tried to reassign the width of the node)

thanks for any suggestion/help about the above

Code: Select all
procedure TForm1.SimpleGraphCanMoveResizeNode(Graph: TSimpleGraph;
  Node: TGraphNode; var NewLeft, NewTop, NewWidth, NewHeight: Integer;
  var CanMove, CanResize: Boolean);
begin
 //
 if Node.BoundsRect.Right > GRaph.ClientRect.Right then
 begin
  // NewWidth :=  set the difference
 end;
end;
lbc
Junior Member
Junior Member
 
Posts: 48
Joined: February 4th, 2004, 7:50 am
Location: Italy

Postby Kambiz » August 5th, 2005, 9:21 pm

Instead of Graph.ClientRect.Right try Graph.ClientWidth. It may work. :?:

The whole code could be as follow:

Code: Select all
procedure TForm1.SimpleGraphCanMoveResizeNode(Graph: TSimpleGraph;
  Node: TGraphNode; var NewLeft, NewTop, NewWidth, NewHeight: Integer;
  var CanMove, CanResize: Boolean);
begin
  if Node.BoundsRect.Right >= Graph.ClientWidth then
  begin
    CanMove := False;
    CanResize := False;
  end;
end;
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby lbc » August 6th, 2005, 10:11 am

hi Kambiz thank you for your suggestion
I have tried it and it works but unfortunately there are 2 problems:

- the side scrollbars shows up as soon as the shape is moved to the right or to the bottom
- enabling CanMove and CanResize (both=true) "lock"definitely the shape, instead it would be nice to get something like the FreezeLeftTop behaviour, that is the user can move down or right the shape currently "frozen" at the very left top border.

As a workaround i have found the following but unfortunately it doesn't seem to work "perfectly"

Code: Select all
if (Node.BoundsRect.Right >= Graph.ClientWidth) or (Node.BoundsRect.Bottom >= Graph.ClientHeight) then
 begin
   //CanMove := false;
   CanResize := false;
   NewLeft := Node.Left- 2; // need a little shift, to avoid the shape stays "frozen"
   NewTop := Node.Top - 2;
   NewWidth := Node.Width - 2;
   NewHeight := Node.Height - 2;
   // hide the scrollbars when they are displayed
   if Graph.VertScrollBar.IsScrollBarVisible then Graph.VertScrollBar.Visible := false;
   if Graph.HorzScrollBar.IsScrollBarVisible then Graph.HorzScrollBar.Visible := false;
 end;


It would be wonderful if you could add a property FreezeBottomRight which behaves like the FreezeTopLeft counterpart, in a next release of TSimpleGraph, of course if possibile

thank you!
lbc
Junior Member
Junior Member
 
Posts: 48
Joined: February 4th, 2004, 7:50 am
Location: Italy

Postby Kambiz » August 18th, 2005, 9:25 am

My code was just something to show how to use the event.

The SimpleGraph project has been moved on SourceForge under name .
ExtGraph Project. Your request should be posted on the new project's page.

You may also find the following link useful:
http://www.delphiarea.com/forum/viewtopic.php?t=296
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Postby valar2006 » August 18th, 2005, 1:38 pm

Why not?
ImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImageImage
valar2006
Member
Member
 
Posts: 1
Joined: July 13th, 2005, 1:18 am


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 3 guests