Description
Event handler of button widjet
Syntax
Boolean eventButton(id)
Parameters
id : id of button widjet
return value : 1 (if button clicked )
Usages
eventButton(1)
Examples in arduino
#include "AppGosu.h"
AppGosu app;
void setup() {
app.start();
app.setDelayCmd(20); // max speed 20ms
myStart();
}
void loop() {
} // end of loop
//---------------------------------------------------------
void serialEvent() {
app.serialMessage();
EventLoop();
}
void EventLoop() {
if( app.btConnected()) { // for auto starting
myStart();
}
// user event code here
if( app.eventButton(1)) { // event handler
app.background(0,0,0);
app.text("button 1 clicked", 100,400);
}
}
//---------------------------------------------------------
void myStart(void) {
// user starting code here
app.clearAll();
app.background(0,0,0);
app.textSize(50);
app.fill(255,255,255);
app.text("-- event Button --", 50, 50);
// make button
app.button("button 1",10,100,150, 80, 1);
}
by AppGosu
-----------------------------------------
No comments:
Post a Comment