Mobile Apps: SubStacks vs. Cards for Tabs

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
DevBoyLars
Posts: 216
Joined: Wed Feb 27, 2013 9:04 pm

Mobile Apps: SubStacks vs. Cards for Tabs

Post by DevBoyLars » Sat Apr 20, 2013 7:36 pm

Hi there,
the most Apps (such as WhatsApp) have a TabBar.

So I'm using mobGUI to handle the different screen-resolutions and get the look of the OS's.

My question is: Should I build a SubStack or a Card for every Tab in my TabBar? What would be the difference?

david.silmanBUSrUeQ
Posts: 44
Joined: Thu Jul 19, 2012 1:49 pm

Re: Mobile Apps: SubStacks vs. Cards for Tabs

Post by david.silmanBUSrUeQ » Wed Apr 24, 2013 1:23 pm

Hi DevBoyLars

For the most part there wouldn't be a difference, I haven't used mobGUI myself, but we are developing for mobile, stacks and cards look the same on mobile, the only difference would be that using substacks you could swap tabs in and out more easily by removing the stack or adding in a new stack, whereas can't be moved around like that.
Using substacks would also give you an extra layer in the message path

To simplify, for the most part and from a display point of view I can't see any difference, so it's up to your personal preference.

Hope this helps

David

DevBoyLars
Posts: 216
Joined: Wed Feb 27, 2013 9:04 pm

Re: Mobile Apps: SubStacks vs. Cards for Tabs

Post by DevBoyLars » Wed Apr 24, 2013 6:20 pm

OMG David!!!! You saved my a..s :D

Substacks solved my big problem with mobGUI now (I used cards instead of substacks, for every tab, before and if the user switched between these cards, he could see how mobGUI reconstructed the screen to the devices screen-resolution). Now I I'm using a substack for every tab it works perfect!!! I'm sooo glad :D

But I still don't understand why it works with a substack, but now with cards (it confused me, because a substack got a card too)

This works:

--MainStack
--Card (first tab the user sees)
--Substack1
---Substack1_card
--Substack2
---Substack2_card



This not:

--MainStack
--Card1
--Card2

dave_probertGA6e24
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 328
Joined: Mon Dec 05, 2011 5:34 pm
Contact:

Re: Mobile Apps: SubStacks vs. Cards for Tabs

Post by dave_probertGA6e24 » Wed Apr 24, 2013 11:54 pm

Think of Stacks as the Window Frame and the Cards as the Window Contents. You can change the contents inside a frame, or you can completely replace the frame (stack) - but it would still need content (card). It's a simplified analogy, but probably the easiest to think about.

Also you cant add a button to a stack directly - only to a card.

That's why the substacks have cards.

Hope that helps,
Dave
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.

DevBoyLars
Posts: 216
Joined: Wed Feb 27, 2013 9:04 pm

Re: Mobile Apps: SubStacks vs. Cards for Tabs

Post by DevBoyLars » Thu Apr 25, 2013 11:43 am

Thank you :)

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Mobile Apps: SubStacks vs. Cards for Tabs

Post by Dixie » Thu Apr 25, 2013 11:55 am

DevBoyLars...

It might be better to use groups within the tab structure... ie when you click on tab 1 ... show group 1 and hide the other groups... then everything is on one card. .. I mention it because that is the method I usually emply when having to use tabs...

Dixie

DevBoyLars
Posts: 216
Joined: Wed Feb 27, 2013 9:04 pm

Re: Mobile Apps: SubStacks vs. Cards for Tabs

Post by DevBoyLars » Thu Apr 25, 2013 12:04 pm

So you put everything on one card and only show the appropriate group for the selected tab?

Why this could be better than a substack for every tab?

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

Re: Mobile Apps: SubStacks vs. Cards for Tabs

Post by Dixie » Thu Apr 25, 2013 2:00 pm

DevBoyLars...

I have attached a 'very simple' stacks that uses groups in 'tabs', as it were...
I think that for me it is easier to manage groups than have different substacks and cards all over the place...:-) I am not saying that this is the 'definitive' way to go about using tabs... it is down to your personal preference...

Dixie
Attachments
groupsInTabs.zip
(1.53 KiB) Downloaded 323 times

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Mobile Apps: SubStacks vs. Cards for Tabs

Post by jacque » Thu Apr 25, 2013 7:02 pm

DevBoyLars wrote:So you put everything on one card and only show the appropriate group for the selected tab?

Why this could be better than a substack for every tab?
Lots of reasons, the main one being code maintenance. In general, you only want one copy of a script or handler for any particular action. Substacks will require duplication of code or objects in most cases; at the very least you'll need duplicates of the tab button itself. It becomes a nightmare to keep all the scripts and objects in synch.

Another reason to avoid substacks for tab use is the flash you get when you switch windows. You can "go to stack x in this window" to overcome that, but it's still overhead.

The usual way to manage a tab button is by showing/hiding groups, or by going to different cards that share the same tab button as a background group. I don't use MobGUI but in general, if you are seeing objects redrawn when you go to a new card, you need to put all the scripts into a preOpenCard handler. If you've already done that, then lock the screen when you close the previous card. If MobGUI is interfering with the screen redraws, then I suggest using the show/hide groups method. You'll save yourself a lot of headaches down the road.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

DevBoyLars
Posts: 216
Joined: Wed Feb 27, 2013 9:04 pm

Re: Mobile Apps: SubStacks vs. Cards for Tabs

Post by DevBoyLars » Thu Apr 25, 2013 9:06 pm

Dixie wrote:DevBoyLars...

I have attached a 'very simple' stacks that uses groups in 'tabs', as it were...
I think that for me it is easier to manage groups than have different substacks and cards all over the place...:-) I am not saying that this is the 'definitive' way to go about using tabs... it is down to your personal preference...

Dixie
Thank you, that helps me to understand it much better :)

Why do you "lock screen" on start? What does it do?

DevBoyLars
Posts: 216
Joined: Wed Feb 27, 2013 9:04 pm

Re: Mobile Apps: SubStacks vs. Cards for Tabs

Post by DevBoyLars » Thu Apr 25, 2013 9:09 pm

Could it be, that it is a little bit slower (App start, just about 1 second on my iPhone 5) to use all tabs on one card, instead substacks for each tab?

Maybe, because the App doesn't have to load all graphics at start, if it uses substacks?

DevBoyLars
Posts: 216
Joined: Wed Feb 27, 2013 9:04 pm

Re: Mobile Apps: SubStacks vs. Cards for Tabs

Post by DevBoyLars » Thu Apr 25, 2013 9:36 pm

It's true: I tested it!

Same App, same features, same graphics - everything exactly the same, but one with one card and groups and one with substacks for every tab:

Start-Time on iPhone 5:

Groups: 2,4
Substacks: 1,3s


That's much in my opinion!

Any idea, why it needs over 1 second more with groups? -.-

Post Reply