You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Ulrich Andreas <An...@formware.de> on 2016/09/19 13:01:50 UTC
rollOut Issue with child dropdown in panel
Intern: for project use only
Hi all,
I encountered some problems when using a dropdown as a child component within a removable parent container.
The container listens on "rollout" events for removing itself. The containing dropdown triggers this event (sadly) -only when the drop down list is open and the mouse moves over the itemlist of the dropdown.
How can this be avoided? The Panel should stay open...
Simplified Example:
<?xml version="1.0"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark">
<fx:Script><![CDATA[
import spark.components.DropDownList;
import spark.components.Panel;
var p:Panel;
private function button1_clickHandler(event:MouseEvent):void {
p = new Panel();
p.width = 200;
p.height = 100;
p.addEventListener(MouseEvent.ROLL_OUT, onRollout);
var c:DropDownList = new DropDownList();
p.addElement(c);
addElement(p);
}
private function onRollout(event:MouseEvent):void {
removeElement(p);
p=null;
}
]]></fx:Script>
<s:Button click="button1_clickHandler(event)" label="Say Hello"/>
</s:Application>
Regards,
Andreas
Re: AW: rollOut Issue with child dropdown in panel
Posted by OK <po...@olafkrueger.net>.
Ulrich Andreas wrote
> Callout would be my first choice, sadly it's not the prettiest Flex
> component and needs a lot of skinning/styling which takes a lot of time...
Take a look at the screenshot at this demo [1].
If this look at and feel fits your needs just grab the skin wich is included
within the demo and you're done.
It's not perfect, but probably nicer than the original ;-)
HTH,
Olaf
[1] https://github.com/ok-at-github/Apache-Flex-Callout-demo
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/rollOut-Issue-with-child-dropdown-in-panel-tp13568p13602.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.
AW: rollOut Issue with child dropdown in panel
Posted by Ulrich Andreas <An...@formware.de>.
Intern: for project use only
Thank you - we'll try with relatedObject.
Callout would be my first choice, sadly it's not the prettiest Flex component and needs a lot of skinning/styling which takes a lot of time...
Regards
Andi
-----Ursprüngliche Nachricht-----
Von: OK [mailto:post@olafkrueger.net]
Gesendet: Montag, 19. September 2016 16:17
An: users@flex.apache.org
Betreff: Re: rollOut Issue with child dropdown in panel
>How can this be avoided? The Panel should stay open...
This modified "onRollout" code will work but maybe there is some more elegant way.
It uses the relatedObject property [1].
Btw:
Instead of the Panel maybe the Callout component [2] better suits your needs?.
HTH,
Olaf
[1]
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/MouseEvent.html#relatedObject
[2] https://github.com/ok-at-github/Apache-Flex-Callout-demo
<?xml version="1.0"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<fx:Script></fx:Script>
<s:Button click="button1_clickHandler(event)" label="Say Hello"/>
</s:Application>
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/rollOut-Issue-with-child-dropdown-in-panel-tp13568p13569.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.
Re: rollOut Issue with child dropdown in panel
Posted by OK <po...@olafkrueger.net>.
Mihai Chira wrote
> I would use event.target. I haven't compiled the code, but I imagine
> something like this should work:
>
> if(event.target == p)
> {
> removeElement(p);
> p = null;
> }
Unfortunately "target" and "currentTarget" refers always to the "Panel".
Olaf
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/rollOut-Issue-with-child-dropdown-in-panel-tp13568p13576.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.
Re: rollOut Issue with child dropdown in panel
Posted by Mihai Chira <mi...@gmail.com>.
I would use event.target. I haven't compiled the code, but I imagine
something like this should work:
if(event.target == p)
{
removeElement(p);
p = null;
}
On 19 September 2016 at 16:21, OK <po...@olafkrueger.net> wrote:
> Code was eaten by the mailing list, here's just the modified function:
>
> private function onRollout(event:MouseEvent):void {
> // Analyze the "relatedObject" property
> if(event.relatedObject!=null && Group(event.relatedObject).id !=
> "dropDown") {
> removeElement(p);
> p=null;
> }
> }
>
> HTH,
> Olaf
>
>
>
> --
> View this message in context: http://apache-flex-users.2333346.n4.nabble.com/rollOut-Issue-with-child-dropdown-in-panel-tp13568p13570.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
Re: rollOut Issue with child dropdown in panel
Posted by OK <po...@olafkrueger.net>.
Code was eaten by the mailing list, here's just the modified function:
private function onRollout(event:MouseEvent):void {
// Analyze the "relatedObject" property
if(event.relatedObject!=null && Group(event.relatedObject).id !=
"dropDown") {
removeElement(p);
p=null;
}
}
HTH,
Olaf
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/rollOut-Issue-with-child-dropdown-in-panel-tp13568p13570.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.
Re: rollOut Issue with child dropdown in panel
Posted by OK <po...@olafkrueger.net>.
>How can this be avoided? The Panel should stay open...
This modified "onRollout" code will work but maybe there is some more
elegant way.
It uses the relatedObject property [1].
Btw:
Instead of the Panel maybe the Callout component [2] better suits your
needs?.
HTH,
Olaf
[1]
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/events/MouseEvent.html#relatedObject
[2] https://github.com/ok-at-github/Apache-Flex-Callout-demo
<?xml version="1.0"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark">
<fx:Script></fx:Script>
<s:Button click="button1_clickHandler(event)" label="Say Hello"/>
</s:Application>
--
View this message in context: http://apache-flex-users.2333346.n4.nabble.com/rollOut-Issue-with-child-dropdown-in-panel-tp13568p13569.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.