BB___NOMAINWIN

=NOMAINWIN= toc

Description
> Instructs Just BASIC not to open a main window (MAINWIN).

Syntax

 * 1) NOMAINWIN

Hints
> This command is usually used when programming in a GUI environment. If you do **not** include a NOMAINWIN command, a main window will open along with your program window. //This is useful while your program is under development because it allows you to close a program that has stopped working or crashed//. If you include NOMAINWIN in a program, you must also use TRAPCLOSE handlers and an END statement for your program and all its windows to close properly.

> The main window will only close automatically when your program is running standalone (i.e.; as an .EXE program).

>> NOMAINWIN is a **compiler directive** and can only be disabled by commenting it out. There is no way to disable it through an IF..THEN construct. >> The main window will be suppressed, if you place a NOMAINWIN statement **anywhere** in your program listing

> If your program has statements to print to the mainwin, those statements will still be executed when your program runs, even if you include a NOMAINWIN. You won't see them because there is no mainwin to print to, but it could slow down the execution of your program. Commenting out those print statements will prevent them from being executed and increase the speed of your program.

Example
code format="lb" ' turn the main window off NOMAINWIN

' open a GUI window open "My Window" for window as #win

' trap closing the GUI window, which is mandatory
 * 1) win "trapclose [quit]"

' wait for user action wait

' event handler for closing the window [quit]

' close the window close #win

' terminate the program end code

Useful Functions
code format="lb" ' Place a useful function using this command here code