All G4P controls are draw immediately after the draw() method so they appear on top of everything. This is done automatically by the library.
The createGU() method is created by GUI Builder and creates all the G4P controls, this method should only be executed once which is why it appears in setup()
I would like to be able to have graphics (say a gui widget of my own creation) be drawn above the G4P GUI,
Like have the library update the gui before the draw() loop executes, i.e. update gui then call draw();
as opposed to calling draw() and then updating the gui.
I could have my program register a mouse handler that overrides the G4P library when there is graphics over the G4P widgets.
I see in the library that this is the draw() method.
@madscientist
The code you provide above will not change when the G4P controls are drawn. It also contains redundant code and a logic error which will cause unpredictable results.
In fact the code inside the G4P draw() method does not and cannot determine when the method is executed. Rather G4P uses a Processing library callback to execute this method after its own draw() method.
You would create a class to represent your widget. The class would need a method to draw/render itself and that method would have to be ‘registered’ with processing (usually done in the widget’s constructor. Finally to make it appear over the G4P controls the widget would have to be created after the G4P controls.
Personally I have not tried this but it should work.