ComponentLayoutEditor and moving groups of components


#1

I’ve written a simple test application that lets users drag a box over a selection of components (using LassoComponet) and group them together(using SelectedItemSet). I also have another app that utilises Haydxn’s ComponentEditorLayout* class. I now want to merge the two parts together so that I can edit components on they fly and then move them around, but I’m having some problems, no doubt based on the approach I’m taking. I’ve added the LassoComponent to my main panel, which is a siblings of my ComponentLayoutEditor. Moving components has to be done when in ‘edit’ mode so whenever a users clicks on a component in edit mode I take it’s coordinates on a mousedown event and then use them along with getDistanceFromDragStartX() to calculate the new positions. I’m using calls to getParent() and things like that to break through the editor layer to move my components but I don’t think this is the best approach. Doing it like this also means the rectangles drawn around each component don’t move(obviously) and when I deselect the components and click on them again it no longer works in the same way as before(not so obvious why, to me at least…).

All this leads me to believe I’m going about this the wrong way. Can anyone suggest a better approach. I’m keen to continue using the ComponentLayoutEditor class because of it’s user friendliness. Any ideas? Perhaps the lasso component should form part of the actual ComponentLayoutEditor, although when I tried this it worked even worse. I guess the problem is also to do with the fact ComponentLayoutEditor only works with one object at a time. For what it’s worth I have looked over the Jucer code and also code from JOST. It has helped me get this far but as a relative newbie I find it difficult to follow at times.

Thanks.

*http://www.rawmaterialsoftware.com/viewtopic.php?f=6&t=2635&p=32958#p32958