Liberty BASIC Help Online

The NOMAINWIN command
 
When a Liberty BASIC program is run, a simple text window called the mainwin appears.  It can be used to display text and to ask the user for input.  To suppress the mainwin, a nomainwin statement is used:
 
    nomainwin   'don't open a mainwin
    menu #draw, "Draw", "Draw now", [drawNow]
    open "No man's land, er... nomainwin" for graphics as #draw
    print #draw, "trapclose [quit]"
    wait
[drawNow]
    print #draw, "cls ; home ; down ; north"
    for x = 1 to 100
        print #draw, "turn 122 ; go "; str$(x*2)
    next x
    print #draw, "flush"
    wait
[quit]
    confirm "Do you want to quit Buttons?"; quit$
    if quit$ = "no" then wait
    close #draw
    end
 
The mainwin can be used when a program is under development.  If a program locks up or crashes, it can still be closed by clsoing the mainwin.  It is important that a program have trapclose handlers for all of its windows when the nomainwin command is used, otherwise the program may still be running with no way to close it.  All programs should finish executing with an END statement (like the example above) to ensure that programs actually do clean up by themselves.
 
If a program continues running with no way to close it, it may be ended by clicking on the Run menu on the Liberty BASIC editor and selecting Kill BASIC Programs. 


Copyright (C) 2003 Shoptalk Systems
Liberty BASIC - http://www.libertybasic.com/