sequential vs events driven
Hey guys,
To all you language developers out there:
In the construction of Bxbasic, since Bxbasic has been up to this point
a Console mode, sequentially driven compiler/interpreter, I've never
had to be bothered about event handling.
i.e.: mouse roll-over, on-click, on-button, etc.
From those of you who are familiar with GUI and event driven models,
I'd like to know just how you are dealing with coding event handlers.
Related to Bxbasic, up to now, I've never done any GUI, event driven coding.
At this moment, I'm working on some GUI stuff, so that I can incorporate
some "Windows" specific GUI to Bxbasic.
One of the things I've uncovered and am toying with, is the notion that
I may not need two distinct compilers/interpreters to handle Console
mode -vs- GUI mode operation.
What I mean by that is, by using a single scripting engine that is
capable of handling both Console mode and GUI mode scripts, I may be
able to construct a single compiler/interpreter. As opposed to a distinct
Console mode engine and a seperate GUI mode engine.
That is, instead of requireing the user to select whether they want to
build a Console mode or GUI mode application, they simply make that
distinction by opening a GUI window or not, within the script.
Assuming that a standard console is the default method.
Or..., conversely,
if GUI is the default method, by not making a window visible at the start,
either a console can be opened or a GUI window can be made visible.
I have already constructed a test platform, whereby a console app can open
a GUI window. And, I know that a GUI window has the ability to open a
Console Mode window, (stdin/stdout and all).
And, I can open both, simultaniously, sending stdout to the console and
displaying text and graphics to the GUI window.
The issue I have to resolve is Windows events.
Programming in C/C++, generally WinProc() handles the events aspect.
Programming a Console mode engine is pretty straight forward, you simply
read-in what the next command is and execute it.
Example: from Bxbasic: function parser():
void parser()
{
switch(token)
{ case 1: /* LET */
parse_let();
break;
case 2: /* CLEAR */
clr_vars();
break;
case 3: /* LOCATE */
locate();
break;
case 4: /* PRINT */
parse_print();
break;
case 5: /* GOTO */
go_to();
break;
case 6: /* BEEP */
beep();
break;
case 7: /* CLS */
cls();
break;
<snip>
The question becomes; in a GUI mode engine, how do you test for events
and handle event messages ?
Those of you who are constructing GUI engines, are you dealing with
and handling events ?
Or, are you programming GUI in a sequential manner ?
Your input is greatly appreciated.
Steve
<cc: other forums as well>