Hi Mike, that sounds pretty similar to what I'm trying to implement. Drag selecting via mouse and one or more component selection (either from drag select, or clicking with mouse).
I've implemented drag selection by using a UIComponent and the following function - startSelection, updateSelection and stopSelection (called from a parent controls mouseDown, mouseMove and mouseUp, respectively). What do you have a selection queue for?? I figured I would have a list of selected objects, but not much more than that. With the popup overlay, do you use the popupManager? And I presume for client overlay you just add the selection as a child of the control? Thanks for your insight! Mark ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Michael Schmalle Sent: 31 May 2007 17:33 To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] What functions do I need to override to return correct component size? Hi, Actually I have a really complicated selection manager component. It works great. It does multi selection so there is client selection rectangles and then a popup selection rectangle that encompases all selected components in a canvas. basically you have the option of a popup overlay or client overlays. I use both. it gets complicated if you want more than just basic functionality. As far as moving, just add listeners to the component that is selected, MOVE, RESIZE and handle it from there. Mine even has a mouse selection rectangle and all that but, then I use a selectionQueue in the manager. complicated ;-) Peace, Mike On 5/31/07, Mark Ingram <[EMAIL PROTECTED]> wrote: So if you go via the manager approach, the manager adds the selection as a child to the component? e.g. textArea.addChild(selectionManager.newSelection) ? The way I was thinking was for the main page (extension of Canvas) to add the selection to itself, and just position it over the component to be selected. I suppose the downsides of that are that you need to manually update the selection location when the component moves or sizes... Thanks, Mark ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] ups.com <http://ups.com> ] On Behalf Of Michael Schmalle Sent: 31 May 2007 16:45 To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] What functions do I need to override to return correct component size? Hi, Yeah, I have a manager that does exactly this. Basically my advice is, keep the UIComponents seperate from your selection. Use some sort of singleton manager that you register selections with. Then when a user or application geasture allows a selection, use the manager to create an instance of your selection, embed it into the UIComponent and either offset the graphix or create the overlay -10 pixels from the components x and y and adjust the width of the selection overlay by 10X2. This way you are only dealing with the overlay's size not the component's. Another simpler approach is if you have certain components that are selectable. just create the overlay in each in their createChildren(). Create an ISelectable interface interface; function get selected():Boolean function set selected(value):Boolean; Then when your components are selected they turn the visible to tru on the overlay and size it to the dimensions you need with the offset. This way you are not even messing with the measure dealing with the selection overlay. Peace, Mike On 5/31/07, Mark Ingram < [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: Hi Mike, essentially I am drawing a selection rectangle around controls, for the time being it's a 10pixel wide red rectangle (it will be configurable later). If you have any better suggestions for doing a selection rectangle that'd be great :-) My current train of thought is that the page container should place the selection component over the top of each control. Mark ________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] ups.com <http://ups.com> ] On Behalf Of Michael Schmalle Sent: 31 May 2007 15:58 To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] What functions do I need to override to return correct component size? Hi, Yes it does. Here is the way it works, You need to figure out why you need a - offset because really, this does not fit into the framework. The only time, a negative offset is viable is an overlay(that is not measured with the component's children). Think 4th dimensionally here, why do you need the offset? The layout manager assumes every component is a rectangle inside it's x,y width and height bounds. This is where measure comes in. Your measured values must comply with the actual content you are measuring inside your UIComponent virtual rectangle. Any deviation from this will just result in layout bugs and unexpected behavior. Give me a little more info about what you are doing and I am sure I can suggest an alternative. Peace, Mike On 5/31/07, Mark Ingram < [EMAIL PROTECTED]> wrote: Does it matter that the border is drawn at -10, -10? Because obviously the x, y values of the control will perhaps be 70, 70, but the border will be at 60, 60. Hope that makes sense. Thanks, Mark ________________________________ From: [EMAIL PROTECTED] ups.com <http://ups.com> [mailto:[EMAIL PROTECTED] ups.com <http://ups.com> ] On Behalf Of Michael Schmalle Sent: 31 May 2007 15:08 To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] What functions do I need to override to return correct component size? Hi, override protected function measure():void { super.measure(); measuredWidth = 120; measuredHeight = 120; } Note, that is just hard coding but, you will do your measurment calcs in that method. Peace, Mike On 5/31/07, Mark Ingram <[EMAIL PROTECTED]> wrote: Hi, I have a custom UIComponent that is 100x100 pixels. Around this component is a rectangle which I have drawn to a depth of 10 pixels (i.e. there is a 10 pixel border around my component). What functions do I need to override so I can return the correct width and height of 120 (instead of 100). Thanks, Mark -- Teoti Graphix http://www.teotigraphix.com Blog - Flex2Components http://www.flex2components.com You can find more by solving the problem then by 'asking the question'. -- Teoti Graphix http://www.teotigraphix.com Blog - Flex2Components http://www.flex2components.com You can find more by solving the problem then by 'asking the question'. -- Teoti Graphix http://www.teotigraphix.com Blog - Flex2Components http://www.flex2components.com You can find more by solving the problem then by 'asking the question'. -- Teoti Graphix http://www.teotigraphix.com Blog - Flex2Components http://www.flex2components.com You can find more by solving the problem then by 'asking the question'.