Home » Community » Newbie corner » Accept example in Tutorial (don't understand Accept example in Tutorial)
Accept example in Tutorial [message #46809] |
Mon, 15 August 2016 15:10 |
roger
Messages: 9 Registered: August 2016
|
Promising Member |
|
|
I don't understand the example code for Accept() in the Tutorial at "19. Accepting and rejecting widgets":
GUI_APP_MAIN
{
TopWindow app;
app.SetRect(0, 0, 200, 20);
EditDate date;
app.Add(date.TopPosZ(0, 20).HSizePos());
app.Run();
if(app.Accept())
PromptOK("Correct date.&[* " + AsString(~date));
}
My first inclination is to understand that Accept() is a callback that is called when an APPLY or OK button is clicked; however the verbiage that followed suggested that it might only be a test mechanism to see if the current Value(s) are acceptABLE (which would "usually" be called by the Ultimate++ infrastructure before delivering a callback (when might it not be called?) - in addition to being available for the application programmer to call at any time to test the validity of current values).
Then there is executable code following "app.Run();" (where app is a TopWindow) in the example. I had assumed up to this point that the app.Run() method would never return (would only deliver callbacks) until the program closed, but the way this is coded, app.Run() would have to return before the app.Accept() could be called, and then app.Accept would execute as mainline code rather than as a callback. If the TopWindow is shutting down at this point, then when one clicks OK in the Gui18 window, the TopWindow would also disappear and the entire application would exit. Have I got this right? Could someone please explain?
|
|
|
Goto Forum:
Current Time: Wed Apr 30 14:41:16 CEST 2025
Total time taken to generate the page: 0.00803 seconds
|