Hi Hugo,

when I tried that code I had to add the imports too.
Anyway I tried again, and I'm getting the same fail in the TDJ SearchFilter
example
Are you getting the same?
Also I think you'll need to remove the listener when the popup closes,
since the list is recreated again and a new listener will be attached
If you don't remove the listeners you left the list hanging and can't be
garbage collected.
thanks

El dom., 18 oct. 2020 a las 18:02, Hugo Ferreira (<hferreira...@gmail.com>)
escribió:

> Hi Carlos,
>
> I was able to compile the Royale SDK with ant.
> Built the TDJ and replicate the exactly issue that you mention before.
> Applied a fix that keeps my original fix without the issue that you mention
> but this time directly from the compiled Royale SDK + TDJ.
>
> So, the new code is 2 new imports:
>     import org.apache.royale.jewel.List;
>     import org.apache.royale.events.MouseEvent;
>
> And this:
> public override function set list(value:List):void
>         {
>             super.list = value;
>             COMPILE::JS
> {
> if (list != null)
>            list.addEventListener(MouseEvent.CLICK, onListClick);
>             }
>         }
>
> private function onListClick(event:MouseEvent):void
>         {
>             comboView.popUpVisible = false;
>         }
>
> What do you think ?
>
> Carlos Rovira <carlosrov...@apache.org> escreveu no dia quinta, 15/10/2020
> à(s) 09:13:
>
> > Ok Hugo,
> >
> > many thanks :)
> >
> > El jue., 15 oct. 2020 a las 1:50, Hugo Ferreira (<hferreira...@gmail.com
> >)
> > escribió:
> >
> > > Hi Carlos,
> > >
> > > OK, let me try :)
> > >
> > > Carlos Rovira <carlosrov...@apache.org> escreveu no dia quarta,
> > 14/10/2020
> > > à(s) 08:29:
> > >
> > > > Hi Hugo,
> > > >
> > > > I'm trying that snippet in jewel with TDJ and as I start to interact
> > with
> > > > the CMB I get this:
> > > >
> > > > SearchFilter.as:123 Uncaught TypeError: Cannot read property
> > > > 'addEventListener' of null
> > > >     at
> > > >
> org.apache.royale.jewel.beads.controls.combobox.SearchFilter.set__list
> > > > (SearchFilter.as:123)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.royale.jewel.beads.controls.combobox.SearchFilter.popUpClosedHandler
> > > > (SearchFilter.as:115)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.royale.jewel.ComboBox.org.apache.royale.events.EventDispatcher.fireListeners
> > > > (EventDispatcher.as:131)
> > > >     at Function.goog.events.EventTarget.dispatchEventInternal_
> > > > (eventtarget.js:381)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.royale.jewel.ComboBox.org.apache.royale.events.EventDispatcher.dispatchEvent
> > > > (EventDispatcher.as:108)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.royale.jewel.ComboBox.org.apache.royale.core.ElementWrapper.dispatchEvent
> > > > (ElementWrapper.js:229)
> > > >     at Object.org.apache.royale.utils.sendStrandEvent
> > > > (sendStrandEvent.js:28)
> > > >     at
> > org.apache.royale.jewel.beads.views.ComboBoxView.set__popUpVisible
> > > > (ComboBoxView.as:232)
> > > >     at
> > > >
> > > >
> > >
> >
> org.apache.royale.jewel.beads.controls.combobox.SearchFilter.org_apache_royale_jewel_beads_controls_combobox_SearchFilter_onListClick
> > > > (SearchFilter.as:129)
> > > >     at Function.goog.events.fireListener [as googFireListener]
> > > > (events.js:744)
> > > >
> > > > I think you need to solve the way you are trying. You can monkeypatch
> > the
> > > > code, but doing that will be very difficult to do this kind of fixes.
> > > > The best way is:
> > > >
> > > > 1.- have the source code building in your local (with maven and ant,
> > for
> > > > this I shared other times this script I use on Mac, that you can
> adapt
> > > for
> > > > you [1])
> > > > 2.- As you have the 3 repos working on your side you can change any
> > > library
> > > > and then do in the lib root folder : "mvn clean install
> > > -Poption-with-swf"
> > > > and then "ant" to build with both and check all is fine.
> > > > 3.- Then you can use a test project like TDJ or any other to try your
> > > > changes. For example if you are using maven you don't need to sync
> the
> > > > library since you get directly in you local repo and the test project
> > > will
> > > > use it in the next compilation with your changes.
> > > >
> > > > Thanks for trying to fix it and I'll wait for your thoughts and see
> if
> > > you
> > > > can go further :)
> > > >
> > > > [1]
> > > https://gist.github.com/carlosrovira/200753108de263fa43e80d3228213509
> > > >
> > > >
> > > > El mié., 14 oct. 2020 a las 0:57, Hugo Ferreira (<
> > hferreira...@gmail.com
> > > >)
> > > > escribió:
> > > >
> > > > > Hi,
> > > > >
> > > > > As mention previous, I found a bug on ComboBox + SearchFilter bead:
> > > > > https://github.com/apache/royale-asjs/issues/917
> > > > > This bug happens easly on my application because I saw with a
> > ComboBox
> > > > with
> > > > > many similar items but it also happens on Tour de Jewel (more
> > difficult
> > > > to
> > > > > reproduce because all the items are different)
> > > > >
> > > > > After I bring the SearchFilter bead to my project, I found a fix or
> > > > > workaround to this bug.
> > > > > I confirm that the end result works well, however I would like to
> > know
> > > > what
> > > > > do you think about this fix ?
> > > > >
> > > > > On SearchFilter.as, I added this on my side:
> > > > > public override function set list(value:List):void
> > > > > {
> > > > > super.list = value;
> > > > > COMPILE::JS
> > > > > {
> > > > > list.addEventListener(MouseEvent.CLICK, onListClick);
> > > > > }
> > > > > }
> > > > >
> > > > > private function onListClick(event:MouseEvent):void
> > > > > {
> > > > > comboView.popUpVisible = false;
> > > > > }
> > > > >
> > > > > If is OK, I can commit it.
> > > > >
> > > >
> > > >
> > > > --
> > > > Carlos Rovira
> > > > Apache Member & Apache Royale PMC
> > > > *Apache Software Foundation*
> > > > http://about.me/carlosrovira
> > > >
> > >
> >
> >
> > --
> > Carlos Rovira
> > Apache Member & Apache Royale PMC
> > *Apache Software Foundation*
> > http://about.me/carlosrovira
> >
>


-- 
Carlos Rovira
Apache Member & Apache Royale PMC
*Apache Software Foundation*
http://about.me/carlosrovira

Reply via email to