TSimpleGraph suggestion

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

TSimpleGraph suggestion

Postby vaccaro » July 10th, 2005, 7:50 pm

Hello,

I did a simple and small change on TSimpleGraph.MouseUp event in order to allow create elements with one click. I hope this could be interesting to someone.

In the code below, "50" could be replaced by a "default size" property.

Best regards,

Guilherme Vaccaro.

Code: Select all
  ...
  else if CommandMode = cmInsertNode then
  begin
    { Start - Modified by Vaccaro - 10-07-2005 }
    {
    if (Button = mbLeft) and not (ssDouble in Shift) and
        not IsRectEmpty(SelectionRect)
    then
      InsertNode(@SelectionRect);
    }
    if (Button = mbLeft) and not (ssDouble in Shift) then
    begin
      if IsRectEmpty(SelectionRect) then
      begin
        if SnapToGrid and not (ssCtrl in Shift) then
          StopPoint := Point((StartPoint.X + 50) div GridSize * GridSize, (StartPoint.Y + 50) div GridSize * GridSize)
        else
          StopPoint := Point(StartPoint.X + 50, StartPoint.Y + 50);
        SelectionRect := MakeRect(StartPoint, StopPoint);
      end;
      InsertNode(@SelectionRect);
    end;
    { Stop - Modified by Vaccaro - 10-07-2005 }
    CommandMode := cmEdit;
    if ssShift in Shift then
      CommandMode := cmInsertNode;
  end
  ....
vaccaro
Member
Member
 
Posts: 1
Joined: July 10th, 2005, 7:44 pm

Thanks

Postby perahi » August 22nd, 2005, 8:15 am

This was very interresting to me! I have implemented it into my TSimpleGraph.

Thank you very much!

PAH
perahi
Active Member
Active Member
 
Posts: 8
Joined: March 2nd, 2005, 1:13 pm


Return to DELPHI AREA Projects

Who is online

Users browsing this forum: No registered users and 2 guests

cron