Loading...
Processing Forum
Recent Topics
All Forums
Screen name:
hansbaer
hansbaer's Profile
2
Posts
1
Responses
0
Followers
Activity Trend
Last 30 days
Last 30 days
Date Interval
From Date :
To Date :
Go
Loading Chart...
Posts
Responses
PM
Show:
All
Discussions
Questions
Expanded view
List view
Private Message
[G4P] Read out GTimer
[1 Reply]
02-Jun-2013 08:34 AM
Forum:
Contributed Library Questions
Hey!
Got another Question regarding the library:
I made a GTimer like that, which works just fine:
void setup() {
timerInt = new GTimer(this, this, "timerInt_Action", 1000);
int sec = Integer.valueOf(secInt.getText());
int min = Integer.valueOf(minInt.getText());
int interval = (min * 60 + sec) * 1000;
timerInt.setInterval(interval);
timerInt.start();
}
void timerInt_Action(GTimer source) {
println("Timer down");
}
Now, my question is, is there a way to read out the current Countdown?
For example, if i made another Timer which ticks every second and prints me the current state of the above timer?
Tried that:
void timerCounterdown_Action(GTimer source) {
println(Integer.valueOf(timerInt);
}
Didn't work, of course.
Is there any way to read it out? Hope i made myself clear somehow.
[G4P] Check state of options or checkboxes
[3 Replies]
01-Jun-2013 06:49 PM
Forum:
Contributed Library Questions
First of all:
Thanks for that awesome library and the builder tool. Really helped me to grab a foothold in the whole processing business. :)
The only thing i can't get working are the checkboxes and option groups.
To explain what my problem is, i made a simple example program with the GUI builder:
Main Tab:
// Need G4P library
import g4p_controls.*;
int bgcolor=100;
public void setup(){
size(480, 320, JAVA2D);
createGUI();
customGUI();
// Place your setup code here
}
public void draw(){
background(bgcolour);
}
// Use this method to add additional statements
// to customise the GUI controls
public void customGUI(){
}
gui Tab:
public void checkbox1_select(GCheckbox source, GEvent event) { //_CODE_:checkbox1:537084:
println("checkbox1 - GCheckbox event occured " + System.currentTimeMillis()%10000000 );
if (checkbox1 == true) {
bgcolor=1;
}
else bgcolor = 230;
} //_CODE_:checkbox1:537084:
// Create all the GUI controls.
// autogenerated do not edit
public void createGUI(){
G4P.messagesEnabled(false);
G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
G4P.setCursor(ARROW);
if(frame != null)
frame.setTitle("Sketch Window");
checkbox1 = new GCheckbox(this, 176, 147, 120, 20);
checkbox1.setTextAlign(GAlign.LEFT, GAlign.MIDDLE);
checkbox1.setText("checkbox text");
checkbox1.setOpaque(false);
checkbox1.addEventHandler(this, "checkbox1_select");
}
// Variable declarations
// autogenerated do not edit
GCheckbox checkbox1;
Well, it didn't work. I just want to read the state of the checkbox (or option). I got the Textfield working with getText() and setText(), getValue() didn't work either.
Any advice here?
Thanks in advance!
«Prev
Next »
Moderate user : hansbaer
Forum