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 › when to use toggle, bang , button and tab
Page Index Toggle Pages: 1
when to use toggle, bang , button and tab? (Read 764 times)
when to use toggle, bang , button and tab?
Oct 20th, 2009, 2:33pm
 
I am using 4 ControlP5 buttons to control which part of the interface of my program the user sees. When I then go through the program and use other buttons and sliders within these interfaces the 4 controlling buttons stop working properly. They just flash up the requested interface for a sec before returning to draw the one it just got stuck on. Why is that happening? Should I be using tabs instead? or toggle? From the examples on the ControlP5 page I don't quite get what the difference between all of them is.
Re: when to use toggle, bang , button and tab?
Reply #1 - Oct 20th, 2009, 9:11pm
 
hi there,
not sure if i can be of help regarding the flashing issues based on the info you provide. but here some info regarding tabs, buttons, bangs, toggles

Tab. a tab is a container for a set of controllers, activating a tab will hide any other tab and will only make controllers visible for the currently active tab. Only one tab can be active at a time. Tabs are displayed at the top of a window.

Button, Bang, Toggle do look very similar, but have different effects when used.
Button a button will trigger an event when released. You can assign values (int or float) to a button which can be accessed when a button event is broadcasted as a controlEvent.
Bang a bang is very similar to a button and might be obsolete by now. by default an event is triggered when pressed. The initial idea behind a bang is that it will trigger a function inside your main program without passing any values to that function - demonstrated in the bang example.
Toggle a toggle functions like a switch and has only 2 states instead of an assigned int/float value. a state can be true or false. When changing the state of a toggle this information will be passed to your program and can be accessed within the void controlEvent(ControlEvent theEvent) {} function.

best,
andreas
Re: when to use toggle, bang , button and tab?
Reply #2 - Oct 20th, 2009, 11:47pm
 
FYI, this is not really a syntax question, it belongs more to Other Libraries section where library authors can better see questions related to their work.
Re: when to use toggle, bang , button and tab?
Reply #3 - Oct 21st, 2009, 1:22am
 
so i should really be using 4 tabs to show different interfaces containing different buttons and sliders? Instead of using 4 buttons to control which of  the 4 interfaces is shown?
Page Index Toggle Pages: 1