Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
alertDialog bug with wacom tablet — Gideros Forum

alertDialog bug with wacom tablet

keszeghkeszegh Member
edited March 2020 in Bugs and issues
So the issue is that even though normally an alertdialog is 'above' everything and all touches are caught by it, if one uses a wacom tablet then the pen can click on anything on the screen when the dialog is active, which is a big problem for me (e.g. one can press the button that opens the dialog multiple times and so on).
please correct this, it causes severe issues in my app.
Tagged:

Comments

  • hgy29hgy29 Maintainer
    Seems like something difficult to fix, I am not even sure we can fix it. Without understanding what goes on internally, I think you should prevent it at your side: put a catch all and discard sprite on top of your scene whenever you open an alert dialog.

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
  • keszeghkeszegh Member
    edited March 2020
    that i can do, but new issues always pop up due to this (i think) same issue that pen triggers both a mouse and pen event (i believe this is also related to that, i will check later what type of event is the one which is triggered during an alertdialog). i have already 3 or 4 workaround for different aspects, but they are not 100% fault-free.

    in any case it would be great if you could check it out, perhaps it is not as hard as you think. thanks a lot.
  • keszeghkeszegh Member
    edited March 2020
    also for your suggested workaround, how would i modify the alertDialog class?
    do i need to add/remove this dummy sprite for every single alertdialog in my app separately in the onComplete event? that would be pretty dirty solution.
  • i tried the workaround this way, why doesn't it work?:
    AlertDialogOld=AlertDialog
    AlertDialog.eventCatcher=Sprite.new()
    AlertDialog.eventCatcher:setStopEventPropagation(Sprite.EVENTMASK_MOUSE+Sprite.EVENTMASK_TOUCH+Sprite.EVENTMASK_KEY)
     
    function AlertDialog:init(...)
      local alert=AlertDialogOld.new(arg)  
      stage:addChild(AlertDialog.eventCatcher)  
      function onComplete()
        alert:removeEventListener(Event.COMPLETE, onComplete, nil) 		    
        AlertDialog.eventCatcher:removeFromParent()
      end
      alert:addEventListener(Event.COMPLETE, onComplete, nil) 		      
      return alert
    end
  • then how would you change the AlertDialog class so that it puts an overlay sprite blocking touches while the dialog is open?
  • hgy29hgy29 Maintainer
    Not sure why it doesn’t work, but you can’t return something from ‘init’. You should use Core.class to subclass AlertDialog
  • maybe i'm getting stupid, but i cannot find out how one can override an init method that calls first the original method and then does something else. can you hint it?
  • this seems to work:
    AlertDialogOriginal=AlertDialog
    AlertDialog=Core.class(AlertDialogOriginal)
    AlertDialog.eventCatcher=Sprite.new()
    AlertDialog.eventCatcher:setStopEventPropagation(Sprite.EVENTMASK_MOUSE+Sprite.EVENTMASK_TOUCH+Sprite.EVENTMASK_KEY)
     
    function AlertDialog:init(title,message,cancelButton,button1,button2)
      stage:addChild(AlertDialog.eventCatcher)  
      function onComplete()
     
        self:removeEventListener(Event.COMPLETE, onComplete, nil) 		    
        AlertDialog.eventCatcher:removeFromParent()
      end
      self:addEventListener(Event.COMPLETE, onComplete, nil) 		        
    end
  • @hgy29 also i've checked and it's not too surprisingly the "penTablet" type event that is not caught during a dialog being open.
  • keszeghkeszegh Member
    edited March 2020
    i've realized that postInit is useful here so here is a somewhat more simple workaround:
    eventCatcher=Sprite.new()
    eventCatcher:setStopEventPropagation(Sprite.EVENTMASK_MOUSE+Sprite.EVENTMASK_TOUCH+Sprite.EVENTMASK_KEY)
     
    function TextInputDialog:postInit()
      stage:addChild(eventCatcher)  
      local function onComplete()    
        self:removeEventListener(Event.COMPLETE, onComplete, nil) 		    
        eventCatcher:removeFromParent()
      end
      self:addEventListener(Event.COMPLETE, onComplete, nil) 		        
    end
     
    function AlertDialog:postInit()
      stage:addChild(eventCatcher)  
      local function onComplete()    
        self:removeEventListener(Event.COMPLETE, onComplete, nil) 		    
        eventCatcher:removeFromParent()
      end
      self:addEventListener(Event.COMPLETE, onComplete, nil) 		        
    end

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.