Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Problem with Back Key and native popup windows...
Started by d.mach Nov 06 2019 12:54 AM

2 replies to this topic
native popup back key events

Best Answer d.mach , 06 November 2019 - 05:40 AM

thanks for your help. I already had this kind of "solution" BUT it wasn't working because I don't get a key event for the key listener when closing the popup with the device Back button.

 

I now found out why this is happening: The native popup was showing two buttons which also are using an onComplete listener. I now found out using the devices back button is activating the onComplete listener instead the key listener. So I just wrote my function call in the onComplete listener of the native popup and now it is working fine.

 

:)

[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

d.mach

[GLOBAL: userInfoPane.html]
d.mach
  • Contributor

  • 918 posts
  • Corona SDK

I have the following problem:

 

When showing a native popup window and then using the BACK key on device the popup is closed BUT I don't get inside the listener for the BACK key with this first click! This means I don't know where to access this kind of "event" for closing the popup by using the BACK key.

 

Runtime:addEventListener( "key", _G.onKeyEvent )

 

The function _G.onKeyEvent is not getting accessed when closing the native window by using the BACK key.

 

My problem is the following:

 

I show a native window with some information. A user now can use the BACK key on device to close the button. He also can click on a shown button on screen. With the last option the game starts normally. When using the device BACK key just the window disappears BUT I don't know how to check the event, so I can start the game.

 

Any help, ideas? All help welcome!!!

 



[TOPIC: post.html]
#2

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Corona Geek

  • 1,030 posts
  • Corona SDK

I would create a variable, like isPopupOpen = true/false, and then check in a key event listener if the popup is open when back button is pressed and then do whatever it is that you need to do.



[TOPIC: post.html]
#3

d.mach

[GLOBAL: userInfoPane.html]
d.mach
  • Contributor

  • 918 posts
  • Corona SDK

  Best Answer

thanks for your help. I already had this kind of "solution" BUT it wasn't working because I don't get a key event for the key listener when closing the popup with the device Back button.

 

I now found out why this is happening: The native popup was showing two buttons which also are using an onComplete listener. I now found out using the devices back button is activating the onComplete listener instead the key listener. So I just wrote my function call in the onComplete listener of the native popup and now it is working fine.

 

:)




[topic_controls]
[/topic_controls]

Also tagged with one or more of these keywords: native, popup, back, key, events