Hi Hugo,

sorry, but this way of sharing code is not the best for us to interact.
If I copy and override on my file, I get lots of errors and also its
unformatted, so to review it I should invest a lot of time formatting it
and see where the email is adding bad characters.

You can use paste.apache.org [1] so we can solve this problem as soon as
possible.
but for next ones I think the best is to create a Pull Request (PR) in
github, so we can review it and integrate more easily [2].

Thanks and sorry for the trouble, but these days I'm without much time so I
can't afford it.

Best

Carlos

[1] https://paste.apache.org/
[2] https://github.com/apache/royale-asjs/issues



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

> Hi Carlos,
>
> I was able to replicate the issue on TDJ apply the fix and saw the issue
> goes away.
> BUT I had to clean everything and rebuild everything (I even put a console
> log to be sure that I was testing updated version).
> I thought that was normal.
>
> Thank you for point me out about the remove listener.
>
> Here the full source code updated file:
>
>
> ////////////////////////////////////////////////////////////////////////////////
> //
> //  Licensed to the Apache Software Foundation (ASF) under one or more
> //  contributor license agreements.  See the NOTICE file distributed with
> //  this work for additional information regarding copyright ownership.
> //  The ASF licenses this file to You under the Apache License, Version 2.0
> //  (the "License"); you may not use this file except in compliance with
> //  the License.  You may obtain a copy of the License at
> //
> //      http://www.apache.org/licenses/LICENSE-2.0
> //
> //  Unless required by applicable law or agreed to in writing, software
> //  distributed under the License is distributed on an "AS IS" BASIS,
> //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> //  See the License for the specific language governing permissions and
> //  limitations under the License.
> //
>
> ////////////////////////////////////////////////////////////////////////////////
> package org.apache.royale.jewel.beads.controls.combobox
> {
> import org.apache.royale.events.Event;
> import org.apache.royale.jewel.beads.controls.combobox.IComboBoxView;
> import
> org.apache.royale.jewel.beads.controls.textinput.SearchFilterForList;
> import org.apache.royale.jewel.beads.views.ComboBoxView;
> import org.apache.royale.jewel.supportClasses.textinput.TextInputBase;
>     import org.apache.royale.jewel.List;
>     import org.apache.royale.events.MouseEvent;
>
> /**
> *  The SearchFilter bead class is a specialty bead that can be used with
>      *  a Jewel ComboBox to filter options as we type
> *
> *  @langversion 3.0
> *  @playerversion Flash 10.2
> *  @playerversion AIR 2.6
> *  @productversion Royale 0.9.5
> */
> public class SearchFilter extends SearchFilterForList
> {
> /**
> *  constructor.
> *
> *  @langversion 3.0
> *  @playerversion Flash 10.2
> *  @playerversion AIR 2.6
> *  @productversion Royale 0.9.5
> */
> public function SearchFilter()
> {
> }
>
>         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
>         {
> list.removeEventListener(MouseEvent.CLICK, onListClick);
>             comboView.popUpVisible = false;
>         }
>
> private var comboView:IComboBoxView;
>
> override protected function textInputKeyUpLogic(input:Object):void
> {
> if(!list) return;
>
> // first remove a previous selection
> if(list.selectedIndex != -1)
> {
> var tmp:String = input.text;
> list.selectedItem = null;
> input.text = tmp;
> }
>
>             if (!comboView.popUpVisible)
>                 comboView.popUpVisible = true;
>
> // fill "list" with the internal list in the combobox popup
> //list = comboView.popup.view.list;
>
> applyFilter(comboView.textinput.text.toUpperCase());
>
> ComboBoxView(comboView).autoResizeHandler(); //as we filter the popup list
> will be smaller, and we want to reposition
> }
>
> override protected function selectItem(item:Object):void
> {
> // Select the item in the list if text is the same
> // we do at the end to avoid multiple selection (if there's more than one
> matches)
> // in that case, select the first one in the list
> // if(item != null)
> // list.selectedItem = item;
> }
>
> override protected function onBeadsAdded(event:Event):void{
> listenOnStrand('dismissPopUp', removeListListeners);
> listenOnStrand('popUpOpened', popUpOpenedHandler);
> listenOnStrand('popUpClosed', popUpClosedHandler);
>
> comboView = event.target.view as IComboBoxView;
>             if (comboView)
> {
>                 var _textInput:TextInputBase = comboView.textinput as
> TextInputBase;
>                 if (_textInput) {
> COMPILE::JS
> {
>                     _textInput.element.addEventListener('focus',
> onInputFocus);
>                     }
>             }
>             }
> }
>
> override protected function onInputFocus(event:Event):void{
>             if (!comboView.popUpVisible)
>                 comboView.popUpVisible = true;
> }
>
> protected function popUpOpenedHandler():void {
> // fill "list" with the internal list in the combobox popup
> list = comboView.popup.view.list;
> }
>
> protected function popUpClosedHandler():void {
> list = null;
> }
> }
> }
>
>
>
> --
> Sent from: http://apache-royale-development.20373.n8.nabble.com/
>


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

Reply via email to