on backKey issue with card names

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

on backKey issue with card names

Post by sphere » Wed Aug 16, 2017 10:04 am

Hello,

it seem that on backKey handler only works good if you use card numbers and not the name of the card.

So in the stack script i have the handler:

Code: Select all

on backKey
   if the number of this card is "16" then
      go to card"home"
      else
if the number of this card is "2" then
   pass backKey
else
go to the previous card
end if
end if
end backKey
But i wanted is: if the name of this card is "ohnotagain" then....(i copy the name of the card to the script so there is no typo)

But this seems not to work correct at all, although it would be much clearer instead of the card number, even more when you need to put in a card in between, a card nr could change
In this case it does what it wants and goes to a card which you actually want to be hidden at al times(for example your image references)

Is it only supposed to work with the card nr or is it a bug?
Or is it suppossed to be on every card instead of only the stack script?

Thanks!

Klaus
Posts: 13820
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: on backKey issue with card names

Post by Klaus » Wed Aug 16, 2017 11:41 am

Dag mijnheer,

well we have "the name of xyz" and "the SHORT name of xyz" and you need to use the latter!
the name of this cd -> card "name of this cd"
the SHORT name of this cd -> name of this cd

Try this and note the good readability of the SWTICH control structure in comparison to nested IF THEN ELSE IF etc... 8)

Code: Select all

on backKey
   switch the short name of this cd
      case "go home"
         go cd "home"
         break
      case "ohnotagain"
         pass backkey
         break
      default
         go prev
         break
   end switch
end backKey
Best

Klaus

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: on backKey issue with card names

Post by sphere » Wed Aug 16, 2017 3:04 pm

Hallo Hern Klaus,

das wirkt ganz gut!

Great!
Thanks for pointing to this, i did not think about this switch/case function outside a dropdown btn

Freundlichen gruessen,
der nachbarn aus Holland :)

Klaus
Posts: 13820
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: on backKey issue with card names

Post by Klaus » Wed Aug 16, 2017 3:09 pm

Graag gedaan!

Und nicht schlecht für den Anfang... :D

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: on backKey issue with card names

Post by sphere » Wed Aug 16, 2017 3:18 pm

Ich hab funf jahre in Deutschland gewont, hier uber die grenze.
Und wir haben menge deutsche kunde auf dem job.
Ja das geht ein bishen, die leute verstehen mich....hoffe ich 8) :lol:

Klaus
Posts: 13820
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: on backKey issue with card names

Post by Klaus » Wed Aug 16, 2017 3:28 pm

Ah, I see! I grew up in Emmerich, near s'Heerenberg.
That's where I got my poor dutch language abilities :D

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: on backKey issue with card names

Post by sphere » Wed Aug 16, 2017 3:43 pm

Haha great!
Yes, that's were i lived too in Emmerich, on the side towards the border to Netterden.
Had a good time there :)

Klaus
Posts: 13820
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: on backKey issue with card names

Post by Klaus » Wed Aug 16, 2017 3:59 pm

The world is a village!
Take care! :D

sphere
Posts: 1145
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: on backKey issue with card names

Post by sphere » Wed Aug 16, 2017 4:09 pm

Thx! You too !

Post Reply

Return to “Android Deployment”