forward/back buttons

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
Scott Richardson
Posts: 34
Joined: Mon May 08, 2006 7:02 pm

forward/back buttons

Post by Scott Richardson » Tue Aug 31, 2010 4:33 pm

I have a stack of a dozen cards or so that the user navigates through by clicking "forward" and "back" buttons (on the card in a separate sub-stack). What is the most efficient way to disable the forward button in the sub-stack when the user reaches the last card in the main stack (and disable the back button when the user is at the first card)? As it is now, if the user is at the beginning and clicks "back" it takes him to the last card in the main stack. Instead, it would be good if the button "greyed out" or triggered a beep, but didn't go to the last card. I'm sure there is some good way to do this with the if-then structure, but I am not sure how to approach it. I would appreciate any suggestions — you guys are always a great help.

Scott

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

Re: forward/back buttons

Post by Klaus » Tue Aug 31, 2010 4:40 pm

Hi Scott,

use an close-/opencard handler in the first/last card!

Like this for the last card:

Code: Select all

on opencard
  disable btn "next" of cd N of stack "you navi stack here"
  ## or wherever you button resides
end opencard

on closecard
  enable btn "next" of cd N of stack "you navi stack here"
  ## or wwerever you button resides
end opencard
Same for the first card accordingly. You get the picture :D


Best

Klaus

Scott Richardson
Posts: 34
Joined: Mon May 08, 2006 7:02 pm

Re: forward/back buttons

Post by Scott Richardson » Tue Aug 31, 2010 7:16 pm

Thanks Klaus! I was thinking from the wrong direction. I hadn't been thinking of scripting the card at all, just the button. Your idea is very efficient. I have already adapted it to my test stack and will soon use it on the real thing.
Thanks so much.
Scott

Post Reply