Android back button (Solved)

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
EddieLee
Posts: 118
Joined: Thu Oct 25, 2018 1:06 pm

Android back button (Solved)

Post by EddieLee » Wed Sep 02, 2020 12:42 pm

Hi all,

I have a cd “homepage” and a cd “editpage”. There’s a code in the card script on my cd “editpage” that states:

Code: Select all

On backkey 
Go to cd “homepage”
End backkey 
So what I’m trying to do now is when the user clicks on the back button in cd “editdishes” I do not want the preopencard handler of cd “homepage” to run, or I only want parts of the code to run. Is there any script that I can write on the preopencard handler that let livecode know that it just came from Backkey handler of cd “editpage”?
Last edited by EddieLee on Thu Sep 03, 2020 7:49 am, edited 1 time in total.
Eddie :D

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Android back button

Post by jmburnod » Wed Sep 02, 2020 1:38 pm

Hi EddieLee,
Yes, you have to store the name of the closed cd into a variable or customprop and use this on your preopencard message.
Something like that:

backs btn script

Code: Select all

global gMyPrevCD
on mouseup
   put the short name of this cd into gMyPrevCD
end mouseup
homepage script

Code: Select all

global gMyPrevCD
on preopencard
   if gMyPrevCD = “editdishes” then -- gMyPrevCD is the name of a global variable
      
   else
     -- do something
   end if
   put empty into gMyPrevCD -- don't forget to reset variable
end preopencard
Best regards
Jean-Marc
https://alternatic.ch

Klaus
Posts: 14194
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Android back button

Post by Klaus » Wed Sep 02, 2020 1:46 pm

Just use RECENT CARD!

Code: Select all

on preopencard
   if the short name of recent cd = “editdishes” then
     ## Do this
   else
     ## Do something else
   end if
end preopencard

EddieLee
Posts: 118
Joined: Thu Oct 25, 2018 1:06 pm

Re: Android back button

Post by EddieLee » Thu Sep 03, 2020 7:49 am

Hi all,

Thanks everyone for your help! Totally forget about the recent card codes T.T
Eddie :D

Post Reply