TabBar Shared on some cards only

This is the place to discuss anything relating to MobGUI

Moderators: heatherlaine, kevinmiller, robinmiller, malte, splash21

Post Reply
gizmoboyGAiiKM
Posts: 20
Joined: Thu Dec 08, 2011 12:20 pm

TabBar Shared on some cards only

Post by gizmoboyGAiiKM » Tue Jan 17, 2012 6:18 am

Hi folks, just evaluating LiveCode and mobGUI, and I have to say that MobGUI looks like it'll be the thing that makes LiveCode feasible for me (iOS development is the goal).

I do have a question about TabBars. I have an app design in which here are several different tab bars for different parts of the app.

I went through the video, and saw how one was setup as a "background" so that it was shared on all cards, but what's the recommended approach when you have a few tab bars, and each are shared across a few cards in a section of the app (say, Doctors, Patients, and Cases all have their own tab bars for sections relating to these entities)?

I created a tabBar and marked it as Shared Group, but not Background, and it mostly works except that I have pasted the group (tab bar and buttons) into 3 cards, and the "selected" button isn't being properly persisted from card to card. (They're either not sharing state, or I'm jumping out of the event flow before the touched button's changing its highlight).

The shared message handler for the touch evens on the grow is like this (for a set of cards relating to "Doctors", for example):

Code: Select all

on touchStart
   local destinationCard
      
   if (the uTabText of me) is "Home" then
      put "Home" into destinationCard 
   else
      put ("Doctor." & the uTabText of me) into destinationCard 
   end if
   
   if the name of this card is not destinationCard then
      lock screen for visual effect
      go to card destinationCard
      wait for 0 millisecs with messages
      unlock screen 
   end if
end touchStart
Any tips on best practices for this approach are appreciated!

gizmoboyGAiiKM
Posts: 20
Joined: Thu Dec 08, 2011 12:20 pm

Re: TabBar Shared on some cards only

Post by gizmoboyGAiiKM » Fri Jan 27, 2012 5:00 am

Are MobGUI users not very active here, or is this a really dumb question? :)

splash21
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 369
Joined: Sun Dec 19, 2010 1:10 am
Location: UK
Contact:

Re: TabBar Shared on some cards only

Post by splash21 » Wed Feb 01, 2012 11:30 am

Hi, gizmoboyGAiiKM. You can 'Place group' and 'Remove group' via the 'Object' menu in LiveCode. It's also possible by code (check out 'place' and 'remove' in the dictionary). This lets you share groups on only certain cards.

Hope this helps.

:)
LiveCode Development & Training : http://splash21.com

gizmoboyGAiiKM
Posts: 20
Joined: Thu Dec 08, 2011 12:20 pm

Re: TabBar Shared on some cards only

Post by gizmoboyGAiiKM » Wed Feb 01, 2012 6:04 pm

splash21 wrote:Hi, gizmoboyGAiiKM. You can 'Place group' and 'Remove group' via the 'Object' menu in LiveCode. It's also possible by code (check out 'place' and 'remove' in the dictionary). This lets you share groups on only certain cards.

Hope this helps.

:)
That worked beautifully. Thanks so much!

Post Reply

Return to “MobGUI”