Warning: You cannot define widgets as global variable. This is rather host platform dependent technical issue rather than deliberate decision.
The code might run OK on some platforms, but crash on others. Means, just do not do it...
This applies for application static Ctrl's as well. Problem is that Ctrl's may initialize/instantiate only *after* the GUI framework has finished loading and initializing. static or global Ctrl's are usually instantiated before, permanently breaking the GUI init sequence.
Solution: use a static method to return an internal static Ctrl.
EditString& MyApp::GetEditString()
{
static EditString _;
return _;
}
Or even better: the Upp Single<> template
EditString& es = Single<EditString>();
|