Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Developing 2 D graphics apps in firemonkey


This question is answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 8 - Last Post: Sep 18, 2015 7:32 PM Last Post By: Douglas Rudd
Derek Seymour

Posts: 11
Registered: 10/8/15
Developing 2 D graphics apps in firemonkey  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 8, 2015 2:48 AM
Hi,

I have a cross-platform project where I need to develop an application similar to a ERD (entity relationship diagram) where entities can be created on the fly, and each entity can be linked to another, dragged around, and dropped, etc, and then saved. There might be in theory thousands of entities (I'm not sure how many) so speed will be an issue I imagine when displaying them. It needs to be lightening fast.

Each entity on the screen is basically a rectangle with some other bits of information displayed in it (name, description, etc). The entity must be selectable (receive focus) and be capable of being dragged around, etc, so that the connectors paint properly. The area where the rectangles are drawn must be zoomable.

If anyone has done something like this, I would appreciate some guidance on this. We're at the very beginning of the project so any feedback/tips on possible directions will be much appreciated.

At the moment, my initial thoughts are to use TShape. I expect this might change

Thanks
Eli M

Posts: 1,346
Registered: 11/9/13
Re: Developing 2 D graphics apps in firemonkey
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 8, 2015 6:30 AM   in response to: Derek Seymour in response to: Derek Seymour
Probably a TScrollBox or TVertScrollBox which contains a TLayout. You can change the TLayout scale to handle the zooming.

For the objects yeah TShape or TRectangle. And you should bitmap cache the objects.

http://www.fmxexpress.com/speed-up-your-apps-with-bitmap-caching-in-delphi-xe5-firemonkey-on-android-and-ios/
Derek Seymour

Posts: 11
Registered: 10/8/15
Re: Developing 2 D graphics apps in firemonkey  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 17, 2015 12:49 AM   in response to: Eli M in response to: Eli M
Eli M wrote:
Probably a TScrollBox or TVertScrollBox which contains a TLayout. You can change the TLayout scale to handle the zooming.

For the objects yeah TShape or TRectangle. And you should bitmap cache the objects.

http://www.fmxexpress.com/speed-up-your-apps-with-bitmap-caching-in-delphi-xe5-firemonkey-on-android-and-ios/

Thanks for the reply


I've been playing around with some code. The thing I'm struggling with at the moment is the difference between firemonkey and delphi drag and drop. Stuff I would do in Delphi doesn't seem to work in Firemonkey. Do you have any experience writing firemonkey apps where the user is able to move controls around?

John Gray

Posts: 15
Registered: 10/3/99
Re: Developing 2 D graphics apps in firemonkey  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 17, 2015 8:14 AM   in response to: Derek Seymour in response to: Derek Seymour
Derek Seymour wrote:
[...]
Do you have any experience writing firemonkey apps where the user is able to move controls around?

Have a look at TSelection. You would create a TShape with the TSelection as parent (set the shape to alClient). Set the Shape's HitTest to pass mouse actions through to the Selection object. TSelection has grab handles built in, you can show/hide those as desired. Use the Selection's HitTest property to prevent or allow movement and resizing. In essence, you're moving/resizing the Selection onscreen, and the Shape goes with it. (Note: this is based on XE4 experience. Some aspects may have changed in newer FMX versions.)

hth,
John

Darryl Strickland

Posts: 1
Registered: 11/17/07
Re: Developing 2 D graphics apps in firemonkey  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 17, 2015 9:06 AM   in response to: Derek Seymour in response to: Derek Seymour
Take a look at TMS Diagram Studio. I needed similar features years ago and Diagram Studio worked great.

http://www.tmssoftware.com/site/diagram.asp


Derek Seymour wrote:
Hi,

I have a cross-platform project where I need to develop an application similar to a ERD (entity relationship diagram) where entities can be created on the fly, and each entity can be linked to another, dragged around, and dropped, etc, and then saved. There might be in theory thousands of entities (I'm not sure how many) so speed will be an issue I imagine when displaying them. It needs to be lightening fast.

Each entity on the screen is basically a rectangle with some other bits of information displayed in it (name, description, etc). The entity must be selectable (receive focus) and be capable of being dragged around, etc, so that the connectors paint properly. The area where the rectangles are drawn must be zoomable.

If anyone has done something like this, I would appreciate some guidance on this. We're at the very beginning of the project so any feedback/tips on possible directions will be much appreciated.

At the moment, my initial thoughts are to use TShape. I expect this might change

Thanks
Douglas Rudd

Posts: 314
Registered: 5/16/97
Re: Developing 2 D graphics apps in firemonkey  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 17, 2015 3:11 PM   in response to: Derek Seymour in response to: Derek Seymour
Take a look at my blog post about dragging rectangles around the form at run time:

http://firemonkeyblog.blogspot.com/2015/09/dragging-rectangles-on-firemonkey-form.html
Derek Seymour

Posts: 11
Registered: 10/8/15
Re: Developing 2 D graphics apps in firemonkey  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 17, 2015 5:02 PM   in response to: Douglas Rudd in response to: Douglas Rudd
Douglas Rudd wrote:
Take a look at my blog post about dragging rectangles around the form at run time:

http://firemonkeyblog.blogspot.com/2015/09/dragging-rectangles-on-firemonkey-form.html


Thanks!! I have no speech. This is exactly what I need and provides an unbelievable jumping off point. Thanks

Kees Vermeulen

Posts: 23
Registered: 11/7/99
Re: Developing 2 D graphics apps in firemonkey  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 18, 2015 6:04 AM   in response to: Douglas Rudd in response to: Douglas Rudd
Updating HitTest for all rectangles every time a drag operation starts doesn't look like the best option. What works better is capturing the mouse inside a control and handle mouse events from there.

To capture the mouse use code like this: DraggableObject.Root.Captured := DraggableObject;
DraggableObject will now receive all mouse events.
Douglas Rudd

Posts: 314
Registered: 5/16/97
Re: Developing 2 D graphics apps in firemonkey  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 18, 2015 7:32 PM   in response to: Kees Vermeulen in response to: Kees Vermeulen
Good idea.
I added some more features to the example.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02