the visible

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
jon
Posts: 52
Joined: Sat Apr 14, 2007 11:44 am

the visible

Post by jon » Sat Aug 04, 2012 2:26 pm

Hello all,
I have been trying for days to sort a problem out, I hope you can advise, I'm at the hobbyist/begginner level. I have learnt much trying to solve this but alas not the problem i need solving.

I have a group of buttons (within another group) one one card, I'm trying to make something happen when the last visible button is clicked
(each button clicked sets it's own visible to false)

That is to say if any one of the buttons is visible then nothing should happen.
Thank you for any advice.
Regards Jon
I dare not shake the dew drop from a rose lest I disturb the stars.

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

Re: the visible

Post by Klaus » Sat Aug 04, 2012 2:45 pm

Hi Jon,

1. welcome to the forum!
2. check these great resoiurces:
http://www.runrev.com/developers/lesson ... nferences/
3. Maybe call something like this handler in every "mouseup" script of your buttons, right AFTER hiding the buttons.
Like this:

Code: Select all

on mouseup
  ## your actions here...
  hide me
  check_if_all_buttons_are_invisible
end mouseup
## You can of course use a shorter name for the handler :D

Code: Select all

command check_if_all_buttons_are_invisible
  
  ## We need to cycle through all buttons and check their state:
  put the num of btns of grp "your group here..." into tNum
  repeat with i = 1 to tNum
    
    ## Any button visible? Then exit the handler!
    if the visible of btn i of grp "your group here..." then
      exit check_if_all_buttons_are_invisible
    end if
  end repeat
  
  ## All buttons are invisible, do your thing now :-)
  your_final_handler_here
end check_if_all_buttons_are_invisible
Hint: You may notice that I did not check "if the visible... = TRUE then..."
If we omit this, then the (quite optiimistic) engine will presume we want to check for true!
Saves some typing :D

Best

Klaus

jon
Posts: 52
Joined: Sat Apr 14, 2007 11:44 am

Re: the visible

Post by jon » Sat Aug 04, 2012 2:56 pm

Hi Klaus
Thanks for a very quick and helpfull response, I will try it out. :( so simple when I look at your code )
thanks again, Jon
I dare not shake the dew drop from a rose lest I disturb the stars.

Post Reply