[Lazarus] UML Designer program

Leslie Kaye les.kaye at couchmansfarm.plus.com
Sat Jul 25 20:05:19 CEST 2009

Osvaldo Filho wrote:
> Hi all.
> Where can i find information for create a designer with control of
> entities: redesign, move entities (squares), like uml designer.
To move components around at run time, first create the drawing surface 
- a TPanel for example and place a sample entity like a another TPanel 
on it, then set its events.
Use MouseDown to

    *  confirm you have a left mouse click and set an EntityIsDragging
      Boolean variable to True
    *   identify the component being moved (which you get from
      TWinControl(Sender) )
    *  store the component's starting Top and Left position and the
      starting mouse position

Use MouseMove  check if EntityIsDragging then change the component's Top 
and Left according to the new mouse position
Use MouseUp to set EntityIsDragging to False

You can then delete the sample entity component that you have created.

At run time you will allow the user to create new entities. You will 
need to set the Mouse events of the new entities to the code you created 
(hence the importance of identifying the active entity from the Sender 
passed in the Mouse down event).

You may wish to create new entities by drag and drop for instance from a 
list of buttons or whatever on a sidebar (like allowed with the Delphi 
tool palette and it would be nice to have in Lazarus!!). You use the 
Drag and Drop methods in a very similar way, just remembering to set 
your design surface DragOver event to include
Accept := True;

> Like IbEasy Designer.
> Any code sample for download?
> Thanks

More information about the Lazarus mailing list