[flexcoders] Re: How to Position a Popup relative to the control that invoked the popup?
Thx a bunch - this looks like what I need - however for some reason I'm seeing -ve numbers for my x + y coordinates and my popup is partway off my form/window - any further suggestions. Since my grid is dynamically created are there any other issues/gotcha's I need to consider here? TIA --- In flexcoders@yahoogroups.com, Dimitrios Gianninas [EMAIL PROTECTED] wrote: I think what you what is this: 1)from the click event get the ref to the button: var btn:Button = event.target as Button; 2) then get its coordinates: var point:Point = new Point(0, 0); point = btn.globalToLocal( point ); 3) now use it to position your pop up mypop.x = point.x; mypop.y = point.y + 10; Dimitrios Gianninas Optimal Payments Inc. -Original Message- From: flexcoders@yahoogroups.com on behalf of pbrendanc Sent: Thu 26/06/2008 7:55 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] How to Position a Popup relative to the control that invoked the popup? I have a grid with an array of buttons that when clicked, will display a popup window that collects user info. What I'd like to do is position the popup relative (immediately below) the button that the user clicked within the grid - not necessarily centered on the current window. How can I get access the position/coordinates of the calling button - is this data somehow available via the createComplete event of the popup. I imagine this data is buried somewhere in the event/eventtarget object, but I'm not quite sure how to access it. (Please don't tell me that I need to assign a listener to every button in the grid from within the Popup window as I'm creating the grid dynamically and it varies in size). Can anyone help with this, TIA, Patrick -- WARNING --- This electronic message and its attachments may contain confidential, proprietary or legally privileged information, which is solely for the use of the intended recipient. No privilege or other rights are waived by any unintended transmission or unauthorized retransmission of this message. If you are not the intended recipient of this message, or if you have received it in error, you should immediately stop reading this message and delete it and all attachments from your system. The reading, distribution, copying or other use of this message or its attachments by unintended recipients is unauthorized and may be unlawful. If you have received this e-mail in error, please notify the sender. AVIS IMPORTANT -- Ce message électronique et ses pièces jointes peuvent contenir des renseignements confidentiels, exclusifs ou légalement privilégiés destinés au seul usage du destinataire visé. L'expéditeur original ne renonce à aucun privilège ou à aucun autre droit si le présent message a été transmis involontairement ou s'il est retransmis sans son autorisation. Si vous n'êtes pas le destinataire visé du présent message ou si vous l'avez reçu par erreur, veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses pièces jointes, de votre système. La lecture, la distribution, la copie ou tout autre usage du présent message ou de ses pièces jointes par des personnes autres que le destinataire visé ne sont pas autorisés et pourraient être illégaux. Si vous avez reçu ce courrier électronique par erreur, veuillez en aviser l'expéditeur.
[flexcoders] Re: How to Position a Popup relative to the control that invoked the popup?
No that is not part of the question - I have all the components working and the popup opens and closes correctly - what I'm trying to do is (re)position the popup relative to the location of the grid button that caused it to open - this should be simple but I can't find an example how to do this. Any ideas - TIA --- In flexcoders@yahoogroups.com, Tracy Spratt [EMAIL PROTECTED] wrote: How far have you actually gotten? Do you have your buttons invoking the pop-up yet? Or is that part of your question? Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of pbrendanc Sent: Thursday, June 26, 2008 9:00 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: How to Position a Popup relative to the control that invoked the popup? Sorry, while I don't mean to be obtuse - however I need some clarification on how/where to get a reference to that event object - that's really what I having a problem with. In my scenario please note: 1) The controls are dynamic, so how to addEventListener to run time controls is unclear to me. (DO I even need to do this?) 2)The popup form is created by the popUp manager and the form handles createComplete event - however I don't see a ref here to an event object - what am I missing? An explicit code sample would be helpful. TIA --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Josh McDonald dznuts@ wrote: You should be able to get the button which triggered the click event from event.target -Josh On Fri, Jun 27, 2008 at 9:55 AM, pbrendanc pbrendanc@ wrote: I have a grid with an array of buttons that when clicked, will display a popup window that collects user info. What I'd like to do is position the popup relative (immediately below) the button that the user clicked within the grid - not necessarily centered on the current window. How can I get access the position/coordinates of the calling button - is this data somehow available via the createComplete event of the popup. I imagine this data is buried somewhere in the event/eventtarget object, but I'm not quite sure how to access it. (Please don't tell me that I need to assign a listener to every button in the grid from within the Popup window as I'm creating the grid dynamically and it varies in size). Can anyone help with this, TIA, Patrick -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo ! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: josh@
RE: [flexcoders] Re: How to Position a Popup relative to the control that invoked the popup?
maybe its related to what you are specifying as the parent of the PopUp? Make sure it is the same parent that the button is contained within. Dimitrios Gianninas RIA Developer and Team Lead Optimal Payments Inc. From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of pbrendanc Sent: Friday, June 27, 2008 5:57 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: How to Position a Popup relative to the control that invoked the popup? Thx a bunch - this looks like what I need - however for some reason I'm seeing -ve numbers for my x + y coordinates and my popup is partway off my form/window - any further suggestions. Since my grid is dynamically created are there any other issues/gotcha's I need to consider here? TIA --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Dimitrios Gianninas [EMAIL PROTECTED] wrote: I think what you what is this: 1)from the click event get the ref to the button: var btn:Button = event.target as Button; 2) then get its coordinates: var point:Point = new Point(0, 0); point = btn.globalToLocal( point ); 3) now use it to position your pop up mypop.x = point.x; mypop.y = point.y + 10; Dimitrios Gianninas Optimal Payments Inc. -Original Message- From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com on behalf of pbrendanc Sent: Thu 26/06/2008 7:55 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] How to Position a Popup relative to the control that invoked the popup? I have a grid with an array of buttons that when clicked, will display a popup window that collects user info. What I'd like to do is position the popup relative (immediately below) the button that the user clicked within the grid - not necessarily centered on the current window. How can I get access the position/coordinates of the calling button - is this data somehow available via the createComplete event of the popup. I imagine this data is buried somewhere in the event/eventtarget object, but I'm not quite sure how to access it. (Please don't tell me that I need to assign a listener to every button in the grid from within the Popup window as I'm creating the grid dynamically and it varies in size). Can anyone help with this, TIA, Patrick -- WARNING --- This electronic message and its attachments may contain confidential, proprietary or legally privileged information, which is solely for the use of the intended recipient. No privilege or other rights are waived by any unintended transmission or unauthorized retransmission of this message. If you are not the intended recipient of this message, or if you have received it in error, you should immediately stop reading this message and delete it and all attachments from your system. The reading, distribution, copying or other use of this message or its attachments by unintended recipients is unauthorized and may be unlawful. If you have received this e-mail in error, please notify the sender. AVIS IMPORTANT -- Ce message électronique et ses pièces jointes peuvent contenir des renseignements confidentiels, exclusifs ou légalement privilégiés destinés au seul usage du destinataire visé. L'expéditeur original ne renonce à aucun privilège ou à aucun autre droit si le présent message a été transmis involontairement ou s'il est retransmis sans son autorisation. Si vous n'êtes pas le destinataire visé du présent message ou si vous l'avez reçu par erreur, veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses pièces jointes, de votre système. La lecture, la distribution, la copie ou tout autre usage du présent message ou de ses pièces jointes par des personnes autres que le destinataire visé ne sont pas autorisés et pourraient être illégaux. Si vous avez reçu ce courrier électronique par erreur, veuillez en aviser l'expéditeur.
[flexcoders] Re: How to Position a Popup relative to the control that invoked the popup?
This should give you an idea: ?xml version=1.0 encoding=utf-8? mx:Application xmlns:mx=http://www.adobe.com/2006/mxml; layout=absolute creationComplete=onCreationComplete(event) mx:Script ![CDATA[ import mx.controls.Button; import mx.containers.GridItem; import mx.containers.GridRow; import mx.containers.Grid; import mx.events.FlexEvent; import mx.controls.Alert; private var buttonsArray:Array = new Array(One, two, Three, Four, Five, Six, Seven, Eight, Nine); private var myGridRow:GridRow; private var myButton:Button; private function onCreationComplete(event:FlexEvent):void { var myGrid:Grid = new Grid(); for(var i:int = 0 ; i buttonsArray.length ; i++) { var myGridItem:GridItem = new GridItem(); myButton = new Button(); myButton.label = buttonsArray[i]; myButton.addEventListener(MouseEvent.CLICK, buttonWasClicked); myGridItem.addChild(myButton); if((i % 3) == 0 || i == 0) { if(i != 0) { myGrid.addChild(myGridRow); } myGridRow = new GridRow(); } myGridRow.addChild(myGridItem); } myGrid.addChild(myGridRow); this.addChild(myGrid); } private function buttonWasClicked(event:MouseEvent):void { var currentButton:Button = event.target as Button; var pt:Point = new Point(currentButton.x, currentButton.y); pt = event.target.localToGlobal(pt); Alert.show(Clicked Button Left: + pt.x + \n + Clicked Button Bottom: + (pt.y + currentButton.height).toString()); } ]] /mx:Script /mx:Application -Original Message- From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com on behalf of pbrendanc Sent: Thu 26/06/2008 7:55 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] How to Position a Popup relative to the control that invoked the popup? I have a grid with an array of buttons that when clicked, will display a popup window that collects user info. What I'd like to do is position the popup relative (immediately below) the button that the user clicked within the grid - not necessarily centered on the current window. How can I get access the position/coordinates of the calling button - is this data somehow available via the createComplete event of the popup. I imagine this data is buried somewhere in the event/eventtarget object, but I'm not quite sure how to access it. (Please don't tell me that I need to assign a listener to every button in the grid from within the Popup window as I'm creating the grid dynamically and it varies in size). Can anyone help with this, TIA, Patrick
RE: [flexcoders] Re: How to Position a Popup relative to the control that invoked the popup?
You may need to use the local / global conversion functions, like localtoGlobal() Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of pbrendanc Sent: Friday, June 27, 2008 5:57 AM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: How to Position a Popup relative to the control that invoked the popup? Thx a bunch - this looks like what I need - however for some reason I'm seeing -ve numbers for my x + y coordinates and my popup is partway off my form/window - any further suggestions. Since my grid is dynamically created are there any other issues/gotcha's I need to consider here? TIA --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Dimitrios Gianninas [EMAIL PROTECTED] wrote: I think what you what is this: 1)from the click event get the ref to the button: var btn:Button = event.target as Button; 2) then get its coordinates: var point:Point = new Point(0, 0); point = btn.globalToLocal( point ); 3) now use it to position your pop up mypop.x = point.x; mypop.y = point.y + 10; Dimitrios Gianninas Optimal Payments Inc. -Original Message- From: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com on behalf of pbrendanc Sent: Thu 26/06/2008 7:55 PM To: flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com Subject: [flexcoders] How to Position a Popup relative to the control that invoked the popup? I have a grid with an array of buttons that when clicked, will display a popup window that collects user info. What I'd like to do is position the popup relative (immediately below) the button that the user clicked within the grid - not necessarily centered on the current window. How can I get access the position/coordinates of the calling button - is this data somehow available via the createComplete event of the popup. I imagine this data is buried somewhere in the event/eventtarget object, but I'm not quite sure how to access it. (Please don't tell me that I need to assign a listener to every button in the grid from within the Popup window as I'm creating the grid dynamically and it varies in size). Can anyone help with this, TIA, Patrick -- WARNING --- This electronic message and its attachments may contain confidential, proprietary or legally privileged information, which is solely for the use of the intended recipient. No privilege or other rights are waived by any unintended transmission or unauthorized retransmission of this message. If you are not the intended recipient of this message, or if you have received it in error, you should immediately stop reading this message and delete it and all attachments from your system. The reading, distribution, copying or other use of this message or its attachments by unintended recipients is unauthorized and may be unlawful. If you have received this e-mail in error, please notify the sender. AVIS IMPORTANT -- Ce message électronique et ses pièces jointes peuvent contenir des renseignements confidentiels, exclusifs ou légalement privilégiés destinés au seul usage du destinataire visé. L'expéditeur original ne renonce à aucun privilège ou à aucun autre droit si le présent message a été transmis involontairement ou s'il est retransmis sans son autorisation. Si vous n'êtes pas le destinataire visé du présent message ou si vous l'avez reçu par erreur, veuillez cesser immédiatement de le lire et le supprimer, ainsi que toutes ses pièces jointes, de votre système. La lecture, la distribution, la copie ou tout autre usage du présent message ou de ses pièces jointes par des personnes autres que le destinataire visé ne sont pas autorisés et pourraient être illégaux. Si vous avez reçu ce courrier électronique par erreur, veuillez en aviser l'expéditeur.
[flexcoders] Re: How to Position a Popup relative to the control that invoked the popup?
Sorry, while I don't mean to be obtuse - however I need some clarification on how/where to get a reference to that event object - that's really what I having a problem with. In my scenario please note: 1) The controls are dynamic, so how to addEventListener to run time controls is unclear to me. (DO I even need to do this?) 2)The popup form is created by the popUp manager and the form handles createComplete event - however I don't see a ref here to an event object - what am I missing? An explicit code sample would be helpful. TIA --- In flexcoders@yahoogroups.com, Josh McDonald [EMAIL PROTECTED] wrote: You should be able to get the button which triggered the click event from event.target -Josh On Fri, Jun 27, 2008 at 9:55 AM, pbrendanc [EMAIL PROTECTED] wrote: I have a grid with an array of buttons that when clicked, will display a popup window that collects user info. What I'd like to do is position the popup relative (immediately below) the button that the user clicked within the grid - not necessarily centered on the current window. How can I get access the position/coordinates of the calling button - is this data somehow available via the createComplete event of the popup. I imagine this data is buried somewhere in the event/eventtarget object, but I'm not quite sure how to access it. (Please don't tell me that I need to assign a listener to every button in the grid from within the Popup window as I'm creating the grid dynamically and it varies in size). Can anyone help with this, TIA, Patrick -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]
RE: [flexcoders] Re: How to Position a Popup relative to the control that invoked the popup?
How far have you actually gotten? Do you have your buttons invoking the pop-up yet? Or is that part of your question? Tracy From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of pbrendanc Sent: Thursday, June 26, 2008 9:00 PM To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: How to Position a Popup relative to the control that invoked the popup? Sorry, while I don't mean to be obtuse - however I need some clarification on how/where to get a reference to that event object - that's really what I having a problem with. In my scenario please note: 1) The controls are dynamic, so how to addEventListener to run time controls is unclear to me. (DO I even need to do this?) 2)The popup form is created by the popUp manager and the form handles createComplete event - however I don't see a ref here to an event object - what am I missing? An explicit code sample would be helpful. TIA --- In flexcoders@yahoogroups.com mailto:flexcoders%40yahoogroups.com , Josh McDonald [EMAIL PROTECTED] wrote: You should be able to get the button which triggered the click event from event.target -Josh On Fri, Jun 27, 2008 at 9:55 AM, pbrendanc [EMAIL PROTECTED] wrote: I have a grid with an array of buttons that when clicked, will display a popup window that collects user info. What I'd like to do is position the popup relative (immediately below) the button that the user clicked within the grid - not necessarily centered on the current window. How can I get access the position/coordinates of the calling button - is this data somehow available via the createComplete event of the popup. I imagine this data is buried somewhere in the event/eventtarget object, but I'm not quite sure how to access it. (Please don't tell me that I need to assign a listener to every button in the grid from within the Popup window as I'm creating the grid dynamically and it varies in size). Can anyone help with this, TIA, Patrick -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo ! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]
Re: [flexcoders] Re: How to Position a Popup relative to the control that invoked the popup?
If you're creating a popup on a button click, you must already have an event listener. Can you post the code that creates your popup? -Josh On Fri, Jun 27, 2008 at 11:00 AM, pbrendanc [EMAIL PROTECTED] wrote: Sorry, while I don't mean to be obtuse - however I need some clarification on how/where to get a reference to that event object - that's really what I having a problem with. In my scenario please note: 1) The controls are dynamic, so how to addEventListener to run time controls is unclear to me. (DO I even need to do this?) 2)The popup form is created by the popUp manager and the form handles createComplete event - however I don't see a ref here to an event object - what am I missing? An explicit code sample would be helpful. TIA --- In flexcoders@yahoogroups.com, Josh McDonald [EMAIL PROTECTED] wrote: You should be able to get the button which triggered the click event from event.target -Josh On Fri, Jun 27, 2008 at 9:55 AM, pbrendanc [EMAIL PROTECTED] wrote: I have a grid with an array of buttons that when clicked, will display a popup window that collects user info. What I'd like to do is position the popup relative (immediately below) the button that the user clicked within the grid - not necessarily centered on the current window. How can I get access the position/coordinates of the calling button - is this data somehow available via the createComplete event of the popup. I imagine this data is buried somewhere in the event/eventtarget object, but I'm not quite sure how to access it. (Please don't tell me that I need to assign a listener to every button in the grid from within the Popup window as I'm creating the grid dynamically and it varies in size). Can anyone help with this, TIA, Patrick -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED] -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups Links -- Therefore, send not to know For whom the bell tolls. It tolls for thee. :: Josh 'G-Funk' McDonald :: 0437 221 380 :: [EMAIL PROTECTED]