We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › click button to show next button - beginner asks
Page Index Toggle Pages: 1
click button to show next button - beginner asks (Read 599 times)
click button to show next button - beginner asks
Jun 13th, 2009, 7:04am
 
hey guys!

I've just gotten into processing and I probably have a really simple question for you.

I would like to make a Object on which i can click to show four other objects. Each of those object should be able to be activated meaning for example if its a white cirlce it should show a white stroke in order for the user to see that he can do something with it. So basically:

one button, you click on it, you see 4 other buttons vertically aligned on which you can click.

i found a explanations on buttons but it didn't cover my problem. For commented scripts i would be very thankful, because I'm eager to lern and really wanna get what is done. Thanks in regards.
Re: click button to show next button - beginner asks
Reply #1 - Jun 14th, 2009, 8:30am
 
hey guys. please, I'm stuck here and this is for a project I'm doing. Can anyone please post a code example so that I can try to understand and use it?
Re: click button to show next button - beginner asks
Reply #2 - Jun 14th, 2009, 8:36am
 
Take a look at the multiList button of the ControlP5 library.
http://www.sojamo.de/libraries/controlP5/
Re: click button to show next button - beginner asks
Reply #3 - Jun 16th, 2009, 9:32pm
 
What I do is to have a hidden property in my button class and a button.display() method to display the button. If I add several lines to make the four button hidden in setup() and then enable them(hidden=false) once the first button is clicked, I will see the four buttons.

Here's my sample class:

class buttons
{
 public String label;
 public boolean hidden=false;

 public void hide()
 {
   hidden=true;
 }

 public void unhide()
 {
   hidden=false;
 }
 public void display()
 { // if (!hidden) draw the button}
}

I create 5 buttons b0-b4 and call b1.hide() ... and b4.hide().
In the code that is executed when b0 is pressed I run b1.unhide() ... b4.unhide(). Just make sure when a button is hidden(hidden=true), it doesn't display and does nothing even if it's pressed. Good luck.

In draw() I call b0.display() ... b4.display().
Re: click button to show next button - beginner asks
Reply #4 - Jun 17th, 2009, 8:39am
 
I think the the G4P library has some like that.
http://gui4processing.lagers.org.uk/distribution/web/index.html
Page Index Toggle Pages: 1