Page 1 of 1

Navbar widget highlight on app reopen

Posted: Fri Sep 23, 2016 7:11 am
by jekyllandhyde
I have grouped the navigation bar widget that functions well.... That is until I press the home button on the iPhone which closes the app. On app reopen I use the following code:

Code: Select all

 --this displays last card when a user re-starts the App
on preOpenStack   
put specialfolderpath("documents") & "/lastplace" into thefile
   if there is not a file thefile then
      put empty into URL ("file:" & thefile)
   else
      put URL ("file:" & thefile) into thelastPlace
      go card id theLastPlace
   end if
end preOpenStack
The problem is that the navigation bar widget that is highlighted when the card opens is always the same one, in my case from card "1" of the stack. This although the correct "saved" card is showing. So I have a mismatch between card shown and icon highlighted. It corrects itself after clicking another icon.

Not sure how to resolve this? thx.

Re: Navbar widget highlight on app reopen

Posted: Wed Sep 28, 2016 4:18 am
by jekyllandhyde
Solved my own problem, if you have the same here's a fix:

Code: Select all

on preopencard
   set the hilitedItem of widget "navbar" of group "navgroup" to 3
end preopencard
Just set the hilitedItem of the widget to the number corresponding to whichever card you are opening. Now you can return to a card after shutting down the app and have the appropriate icon highlighted.

Re: Navbar widget highlight on app reopen

Posted: Wed Nov 09, 2016 9:31 pm
by Batninja
Very helpful, many thanks for your code - maybe this should be in the blog post about the Navigation Bar widget or the comments anyway.

Re: Navbar widget highlight on app reopen

Posted: Mon Nov 14, 2016 12:17 pm
by peter-b
I've filed a bug report about this issue: http://quality.livecode.com/show_bug.cgi?id=18842