Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 7 of 7 total |
how to drag and drop panels |
Fri, Nov 25 2016 5:52 AM | Permanent Link |
kamran | HI
I am looking for a way to drag a panel from a list of defined panels onto a master panel. The master panel must then remember the position where it was dragged to for next time. e.g. I will have a red square, blue square, yellow square etc (panels) on the left side of the screen that once selected needs to be "draggable" to the Master panel on the right and then be remembered (so i will have to save the screen positions of the colored squares in a database I guess ( like a simple layout ) 1. Is that possible? 2. If so a little code snippet to illustrate would be immensely helpful. I searched the forum and came across the "enabledrag" property which seems to have disappeared. perhaps it will surface later as I know Tim might be working on something to make drag and drop available. Kind regards Kamran |
Fri, Nov 25 2016 8:09 AM | Permanent Link |
Matthew Jones | kamran wrote:
> HI > > I am looking for a way to drag a panel from a list of defined panels onto a master panel. > The master panel must then remember the position where it was dragged to for next time. > > e.g. I will have a red square, blue square, yellow square etc (panels) on the left side of the screen that once selected needs to be "draggable" to the Master panel on the right and then be remembered (so i will have to save the screen positions of the colored squares in a database I guess ( like a simple layout ) > > 1. Is that possible? > 2. If so a little code snippet to illustrate would be immensely helpful. > > I searched the forum and came across the "enabledrag" property which seems to have disappeared. perhaps it will surface later as I know Tim might be working on something to make drag and drop available. > It is certainly possible, you just have to go back to basics. I did a thing like this where I had the shapes on a panel. Using a little magic, you simply detect the mouse down, hide the one it is clicked on, show a shape that is on the main form and not a child, and then the mouse move moves that shape around. You can detect where you are, and when the mouse is let go, put it in an appropriate place. Or rather, show a shape in the place you want it. I found it only a little fiddly. You have to take the X/Y coordinates of the move, and find the parent to get the form-relative location. But in general it wasn't too hard. -- Matthew Jones |
Fri, Nov 25 2016 9:18 AM | Permanent Link |
kamran | Hi Matthew.
Thanks for the pointers.. you make it sound so easy.. 1. How do I get the mouse position at time of drag? I obviously need to hide the object i want to move and display it at the current mouse position ? Thanks Kamran "Matthew Jones" wrote: It is certainly possible, you just have to go back to basics. I did a thing like this where I had the shapes on a panel. Using a little magic, you simply detect the mouse down, hide the one it is clicked on, show a shape that is on the main form and not a child, and then the mouse move moves that shape around. You can detect where you are, and when the mouse is let go, put it in an appropriate place. Or rather, show a shape in the place you want it. I found it only a little fiddly. You have to take the X/Y coordinates of the move, and find the parent to get the form-relative location. But in general it wasn't too hard. -- Matthew Jones |
Fri, Nov 25 2016 12:01 PM | Permanent Link |
Matthew Jones | kamran wrote:
> 1. How do I get the mouse position at time of drag? The Mouse events have X,Y parameters. > I obviously need to hide the object i want to move and display it at the current mouse position ? How you handle it is up to you, but I found it easiest to have "static" things to be visible on a panel for the user to click on, and when they start a drag, to use another parented on the form to be the moving object. -- Matthew Jones |
Fri, Nov 25 2016 12:05 PM | Permanent Link |
Matthew Jones | Matthew Jones wrote:
> kamran wrote: > > > 1. How do I get the mouse position at time of drag? > > The Mouse events have X,Y parameters. > > > I obviously need to hide the object i want to move and display it at the current mouse position ? > > How you handle it is up to you, but I found it easiest to have "static" things to be visible on a panel for the user to click on, and when they start a drag, to use another parented on the form to be the moving object. I see that my video of this is still available, so whizz to 4:29 on my video : http://www.banxia.com/resources/connect/video/start/index.html I expect that I posted more on this way back in the early days, so searching for MouseDown and MouseMove might find more. -- Matthew Jones |
Fri, Nov 25 2016 1:42 PM | Permanent Link |
kamran | "Matthew Jones" wrote:
HI Matthew.. Thanks a lot .. I got it working .. sort of ...in the end. Have a good weekend. Kamran Matthew Jones wrote: I see that my video of this is still available, so whizz to 4:29 on my video : http://www.banxia.com/resources/connect/video/start/index.html I expect that I posted more on this way back in the early days, so searching for MouseDown and MouseMove might find more. -- Matthew Jones |
Mon, Nov 28 2016 1:28 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Kamran,
<< I am looking for a way to drag a panel from a list of defined panels onto a master panel. The master panel must then remember the position where it was dragged to for next time. >> You're going to need to create a TBasicPanel descendant and override 3 protected TControl methods: function DoCaptureStart(Button: Integer; ShiftKey, CtrlKey, AltKey: Boolean; X,Y: Integer): Boolean; procedure DoCapturing(X,Y: Integer); procedure DoCaptureEnd(X,Y: Integer); Check out the TCaptionBarControl class in the WebCtnrs unit to see how to handle the dragging. You'll use the DoCapturing method to detect where you are on the application surface, relative to other controls. You can use these TControl properties to determine your surface position: property SurfaceLeft property SurfaceTop Using the X and Y mouse values combined with these properties will allow you to determine whether you're "in" the drop area or not. EWB will handle making sure that all mouse events get routed to the control that you're dragging. That's what the whole Capture* part is about. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Friday, September 13, 2024 at 03:42 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |