BackKey: best way to use it
Posted: Thu Sep 17, 2020 10:27 am
In my standalone I have several "Return" buttons that navigate to the previous card, while holding a script that, for example, save new settings or else.
For example, in card B there is a button "return" that go to card A after having saved something and set some stuff on card A before showing.
Coming from iOS I didn't realise how Android users count on the physical Backkey of their device.
I am now trying to find the best way to implement this all over my stack.
As I understand the
must be put on each card script. Since the code (1) is already on the mouseUp script of the button ("return"),I would like to hold this script in a single place, without duplicating it. I was wondering if the script below (that works) is the best way to do it (without having to put a
Card B script:
Btn "return" script:
For example, in card B there is a button "return" that go to card A after having saved something and set some stuff on card A before showing.
Coming from iOS I didn't realise how Android users count on the physical Backkey of their device.
I am now trying to find the best way to implement this all over my stack.
As I understand the
Code: Select all
on BackKey
...(1) eventually do something, like saving and going to previous card
--do not pass otherwise the standalone exits
end backer
(that doesn't sound the best way since I have already "send" and "cancel" all over the standalone.send "Mouseup" to btn return of card B
Card B script:
Code: Select all
On Backkey
set the FireBackKey of btn "return" of this card to empty
end Backkey
Code: Select all
On Mouseup
put true into gSetting
set the backcolor of rect "X" of card "A" to red
go card "A"
End Mouseup
SetProp FireBackKey
Mouseup
end FireBackKey