Navigating cards using buttons in a background group.

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
Tom4c
Posts: 8
Joined: Mon Feb 07, 2011 4:44 pm

Navigating cards using buttons in a background group.

Post by Tom4c » Mon Feb 07, 2011 7:03 pm

Hello,

I'm trying to set up a window (stack) with a navigation bar of 3 buttons down the left hand side, allowing me to change between the stack's cards. I have created the buttons (1,2,3), the button's group, and the cards(1011,1012,1013). I have made the group "behave like a background". For the button code I have used

Code: Select all

go card ID 101n
where n is the card number. Buttons 2 and 3 work happily, but the first button refuses to call card 1. I have deleted and recreated the button, but this makes no difference. The button is identical in code and construction to buttons 2 and 3. Does card 1011 have any special properties? Do I need to close a card before I open the next?!

Many thanks for any help.

doc
Posts: 148
Joined: Fri Jun 09, 2006 4:30 pm

Re: Navigating cards using buttons in a background group.

Post by doc » Mon Feb 07, 2011 7:17 pm

Hi Tom,
I ran into the same issue here on my end... never noticed that before one way or another, so I don't know why.
...but this should work for ya:

Code: Select all

on mouseUp
   --go to card "Card1"  --->Does not work
   
   go to card 1 --->This is okay
   -- or
   go to the first card --->This is okay
end mouseUp
-Doc-

Edit to note:
My cards all use distinctive names as Klaus described below. Added a sample file for clarity.
Attachments
SampleButtons.zip
(767 Bytes) Downloaded 244 times
Last edited by doc on Mon Feb 07, 2011 7:23 pm, edited 1 time in total.

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

Re: Navigating cards using buttons in a background group.

Post by Klaus » Mon Feb 07, 2011 7:17 pm

Hi Tom,

question is, does that card really have the ID 1011???
You can check this in the "Inspector" for that card!

And what do you mean by: ...first button refuses to call card 1?
You mean clicking that button does not take you to your "first" card?
What does happen instead? Do you get any error?

I would recommend to give your cards meaningful NAMES and use these for navigation.

Hint, when you "go" to a card, there is no need to "close" the one you left!


Best

Klaus

Tom4c
Posts: 8
Joined: Mon Feb 07, 2011 4:44 pm

Re: Navigating cards using buttons in a background group.

Post by Tom4c » Mon Feb 07, 2011 7:50 pm

Hi Guys,

Thanks for the quick posts - much appreciated! I've since renamed the cards using the "Property Inspector" and used the card names in the button code, rather than call the card ID. This now works perfectly.

How did this happen? I guess I must have edited the name of the card at some point, incrementing its number?! That's a hard mistake to spot. In the "Application browser", and the "Property Inspector > Selection menu > Inspect > Card", the given card names are the names (which originally default to the IDs), not the official card IDs. The official card ID can only be viewed in the title bar of the "Property Inspector". I recreated a stack from scratch and repeated the process, which seems to have worked fine.

Many thanks once again,

Tom.

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

Re: Navigating cards using buttons in a background group.

Post by Klaus » Tue Feb 08, 2011 12:05 pm

Hi Tom,

please check the stacks here:
http://www.runrev.com/developers/lesson ... nferences/
Great resources!


Best

Klaus

Post Reply