Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Xeldoren
Newbie


Joined: 19 Jan 2011
Posts: 2

PostPosted: Sat Jan 22, 2011 3:00 am   

Creating Buttons
 
Is it possible to create a button where if you click it once it opens and if you click again it closes a folder?

Or if not using a few buttons when you click one is closes the rest?
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Sat Jan 22, 2011 8:47 pm   
 
#Button

As far as making it so that it opens and closes in alternation, the easiest method is to simply make a tracking variable which, when you click the button is set to, say, 1, and when you click it again check to see if it's set to 1, then set it back to 0. What you end up with is a very common "toggle" if statement:

Code:

#IF (@isFolderOpen) {
isFolderOpen = 0
// Stuff to close folder here
} {
isFolderOpen = 1
// Stuff to open folder here
}
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net