Hi, two general issues, on a terrific library.
1). I noticed if I have some G4P controls, like toggle buttons or sliders, or whatever, and also the sketch has some static elements I’m drawing in draw(), like rectangles etc, the static elements load instantly and the G4P controls load about half a second later when I launch the sketch.
I’d like to either eliminate the G4P control draw latency, or alternately, delay drawing the static elements until the G4P controls render.
Otherwise, it’s a little jarring to have most of the interface load, and then controls appearing later. And this is for an app with customers, and it’d be great to have everything load at once, even if delayed.
2). Seems like no matter what I do, at random times, a sketch will suddenly crash when I’m using the GUI Builder. Then, no matter what I do, the sketch is permanently ruined. So I’ve taken to saving often, and when this happens, going to the previous version. But it would be great to have a way to get back to a useable version when this happens. Or better yet, have it not happen at all. Makes me very nervous to use the tool at all, although I think it’s great.
TIA for any insights or ideas.
Mike
Here’s the main sketch code:
// Need G4P library
import g4p_controls.*;
import processing.serial.*;
int LightGray = 209;
int DarkGray = 45;
int AppWidth = 800;
int AppHeight = 600;
public void setup(){
size(800, 600, JAVA2D);
createGUI();
customGUI();
}
public void draw(){
background(100);//230
//Large BG rect
noStroke();
fill(DarkGray);
rect(35, 60, 730, 490, 10);
}
// Use this method to add additional statements
// to customise the GUI controls
public void customGUI(){
}
Here’s the G4P gui code:
/* =========================================================
* ==== WARNING ===
* =========================================================
* The code in this tab has been generated from the GUI form
* designer and care should be taken when editing this file.
* Only add/edit code inside the event handlers i.e. only
* use lines between the matching comment tags. e.g.
void myBtnEvents(GButton button) { //_CODE_:button1:12356:
// It is safe to enter your event code here
} //_CODE_:button1:12356:
* Do not rename this tab!
* =========================================================
*/
public void ddlPortsClick(GDropList source, GEvent event) { //_CODE_:ddlPorts:819097:
println("ddlPorts - GDropList >> GEvent." + event + " @ " + millis());
} //_CODE_:ddlPorts:819097:
public void imgTogConnectClick(GImageToggleButton source, GEvent event) { //_CODE_:imgTogConnect:873837:
println("imgTogButton1 - GImageToggleButton >> GEvent." + event + " @ " + millis());
} //_CODE_:imgTogConnect:873837:
public void imgBtnLogoClick(GImageButton source, GEvent event) { //_CODE_:imgBtnLogo:943362:
println("imgBtnLogo - GImageButton >> GEvent." + event + " @ " + millis());
} //_CODE_:imgBtnLogo:943362:
public void imgBtnRefreshPortsClick(GImageButton source, GEvent event) { //_CODE_:imgBtnRefreshPorts:847314:
println("imgBtnRefresh - GImageButton >> GEvent." + event + " @ " + millis());
} //_CODE_:imgBtnRefreshPorts:847314:
public void sldScenePicker_Change1(GCustomSlider source, GEvent event) { //_CODE_:sldScenePicker:226604:
println("custom_slider1 - GCustomSlider >> GEvent." + event + " @ " + millis());
} //_CODE_:sldScenePicker:226604:
public void imgTogButton1_click1(GImageToggleButton source, GEvent event) { //_CODE_:imgTogButton1:324411:
println("imgTogButton1 - GImageToggleButton >> GEvent." + event + " @ " + millis());
} //_CODE_:imgTogButton1:324411:
// Create all the GUI controls.
// autogenerated do not edit
public void createGUI(){
G4P.messagesEnabled(false);
G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
G4P.setMouseOverEnabled(false);
surface.setTitle("MusioTech Editor V1.0");
ddlPorts = new GDropList(this, 542, 21, 164, 105, 4, 10);
ddlPorts.setItems(loadStrings("list_819097"), 0);
ddlPorts.setLocalColorScheme(GCScheme.SCHEME_15);
ddlPorts.addEventHandler(this, "ddlPortsClick");
lblPortStatus = new GLabel(this, 542, 43, 167, 16);
lblPortStatus.setTextAlign(GAlign.RIGHT, GAlign.MIDDLE);
lblPortStatus.setText(" ");
lblPortStatus.setOpaque(false);
imgTogConnect = new GImageToggleButton(this, 711, 18, "plugToggle4.png", "plugToggle4-over.png", 2, 1);
imgTogConnect.addEventHandler(this, "imgTogConnectClick");
imgBtnLogo = new GImageButton(this, 636, 561, 130, 30, new String[] { "Main-Red-Blue-white.png", "Main-Red-Blue-white.png", "Main-Red-Blue-white.png" } );
imgBtnLogo.addEventHandler(this, "imgBtnLogoClick");
imgBtnRefreshPorts = new GImageButton(this, 737, 19, 25, 24, new String[] { "Refresh-Up2.png", "Refresh-Over2.png", "Refresh-Up2.png" } );
imgBtnRefreshPorts.addEventHandler(this, "imgBtnRefreshPortsClick");
sldScenePicker = new GCustomSlider(this, 717, 157, 292, 36, "grey_blue");
sldScenePicker.setTextOrientation(G4P.ORIENT_LEFT);
sldScenePicker.setRotation(PI/2, GControlMode.CORNER);
sldScenePicker.setLimits(1, 1, 8);
sldScenePicker.setNbrTicks(8);
sldScenePicker.setNumberFormat(G4P.INTEGER, 0);
sldScenePicker.setOpaque(false);
sldScenePicker.addEventHandler(this, "sldScenePicker_Change1");
imgTogButton1 = new GImageToggleButton(this, 56, 453, "Rainbow-Icon-toggle9.png", 2, 1);
imgTogButton1.addEventHandler(this, "imgTogButton1_click1");
}
// Variable declarations
// autogenerated do not edit
GDropList ddlPorts;
GLabel lblPortStatus;
GImageToggleButton imgTogConnect;
GImageButton imgBtnLogo;
GImageButton imgBtnRefreshPorts;
GCustomSlider sldScenePicker;
GImageToggleButton imgTogButton1;