![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 |
|
Trying to be a Real Coder
|
Re: Drag and drop shape
Oke, InsyaAllah.
Can we resize the shape?
__________________
just a drop of dew in the morning if we facilitate other people's business in the world, then our business will be facilitated in the world and the hereafter |
|
|
|
|
|
#12 |
|
Programmer
Join Date: Jan 2010
Location: Australia
Posts: 56
Rep Power: 1
![]() |
Re: Drag and drop shape
The code supports resizing and prevents the shape from being resized below 32 x 32 pixels.
|
|
|
|
|
|
#13 |
|
Programmer
Join Date: Jan 2010
Location: Australia
Posts: 56
Rep Power: 1
![]() |
Re: Drag and drop shape
here is the project files. I'd add all the little "tricks" that will help you. ie: scrollbars and locking the cursor to control.
This should be a solid base for you. There is no compiled code here, so its virus safe. Just check the code first so you know its not bad. Workflow.zip |
|
|
|
|
|
#14 |
|
Trying to be a Real Coder
|
Re: Drag and drop shape
Chat with you very helpful.
I've tried your program.
__________________
just a drop of dew in the morning if we facilitate other people's business in the world, then our business will be facilitated in the world and the hereafter |
|
|
|
|
|
#15 |
|
Trying to be a Real Coder
|
Re: Drag and drop shape
I've a problem. How to create line that can be "drag and drop"?
__________________
just a drop of dew in the morning if we facilitate other people's business in the world, then our business will be facilitated in the world and the hereafter |
|
|
|
|
|
#16 |
|
Programmer
Join Date: Jan 2010
Location: Australia
Posts: 56
Rep Power: 1
![]() |
Re: Drag and drop shape
O, thats a little more complex.
To fit into the current system Ive given you, I would either make a new TWorkflowShape, or split TWorkflowShape in 2 and derive one from the other. What you are looking for is the "shape" and "dragging" functionality in the subclass, and then the higher class to implement the grips and resizing. That said, you might prefer just to copy TWorkflowShape and hack it. Anyway, a line is just two shapes with a connector between them. So, once you have the connector system extended to support more than one connector, I would implement a line as being two shapes that look like "grips" with a connector between them. The issue here is, each line grip needs to know the other so when you click on one of the grips, both will BringToFront(). Anyway... (I say that a lot) the next step would be to detect when a line grip is moved over a shape grip, in which case, you would destroy the line grip and set the connect or the grip of the shape in question. Which then leaves the question of, how do you disconnect? Um, Id use a double click. So, when you double click a shapes grip that has a connector assigned to it, you create a new line grip and set the connector to that. the new line grip needs to be offset from the shapes grip so they dont over lap. (Thats only one idea, you might choose a TPopupMenu to select disconnect. Finally, diagonal connectors dont really look that good. I would halve the width and height of the box defined by the connector. Then based on the smallest size, I would draw either "Horz, Vert, Horz, Vert" or "Vert, Horz, Vert, Horz". hope that makes sence. You then need to look into arrows. they are pretty simple. Basic vector maths. Hope that helps. Get the connector code finished and worry about the line code later. Like I said, its a large task. There is also the "point on line" code you need to look into if you want to select a line by clicking on it. Arrrrrr, More coding ![]() Last edited by alienkinetics; Feb 7th, 2010 at 1:26 PM. |
|
|
|
|
|
#17 |
|
Programmer
Join Date: Jan 2010
Location: Australia
Posts: 56
Rep Power: 1
![]() |
Re: Drag and drop shape
Btw, I would also put that array of grips (that is currently global) in the class itself, or at least have it selectable. That way, for shapes like ellipses and diamonds, you wouldn't show the corner grips.
you also need to look into TNotifyEvent's if you haven't done so already. A big mistake is if you access the main form from your code libraries. It gets very messy that way. Make up some simple OnShapeSelected OnShapeMoved OnShapeResized OnShapeAdded, OnShapeDelete events. In the main form, you use these to get messages that you use to update the user interface. ie: Have a dialog panel on the left that has the current shapes text, location, color, type, etc. Anyway, I have tons of ideas. Sing if you need more help. |
|
|
|
|
|
#18 |
|
Trying to be a Real Coder
|
Re: Drag and drop shape
argh, my final assignment very confusing.
alien, how to return something from workflow class to main form (unitmain)? return value from child to parent.
__________________
just a drop of dew in the morning if we facilitate other people's business in the world, then our business will be facilitated in the world and the hereafter |
|
|
|
|
|
#19 | |||
|
Programmer
Join Date: Jan 2010
Location: Australia
Posts: 56
Rep Power: 1
![]() |
Quote:
Here we have a class and a simple method. The class has a notify event pointer that other code can tap into. Note, when calling the event, the "sender" is set to the "self" of the current object. Quote:
Quote:
|
|||
|
|
|
|
|
#20 |
|
Trying to be a Real Coder
|
Re: Drag and drop shape
oke, thanks for your answers.
Sorry, I'm too captious. My job should be completed within 1 month. .I want to show a form {popup} so that the name of shape can be inserted through this form. This form is displayed when we double click the shape. But, I can't make double click event (shape). Is there any advice? ![]()
__________________
just a drop of dew in the morning if we facilitate other people's business in the world, then our business will be facilitated in the world and the hereafter |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| popup with drag and drop wont work. | RareDevil | JavaScript and Client-Side Browser Scripting | 1 | Mar 7th, 2009 4:52 PM |
| Drag and Drop Text in C# | BstrucT | C# | 2 | May 12th, 2008 9:29 AM |
| Drag n' Drop | tayspen | C# | 2 | Oct 22nd, 2005 3:46 PM |