|
Below is an example of what the syntax structure looks like in an MiniBASIC source code file.
'the
lines program
'displays
random lines forever using the WINDOW class
##NOCONSOLE
DIM win as window
DIM w,h,size as int
DIM rcWin as RECT
'open a
window and add a menu
win.Open(0,0,400,300,WS_OVERLAPPEDWINDOW|WS_VISIBLE|CENTERED|BUFFERED,0,"Lines",NULL,&mainwindow)
win.BeginMenu()
win.MenuTitle("Options")
win.MenuItem("Clear",0,1)
win.BeginPopup("Line
Size")
win.MenuItem("1",0,2)
win.MenuItem("2",0,3)
win.MenuItem("3",0,4)
win.EndPopup()
win.MenuItem("Quit",0,5)
win.EndMenu()
'get
the client size of the window so we know
'how
long the lines can be
rcWin = win.GetClientRect()
w = rcWin.right - rcWin.left
h = rcWin.bottom - rcWin.top
size = 1
'draw
the lines every 10 millesceonds
win.StartTimer(10)
'process
messages until somebody closes us
do
ProcessMessages
until win.GetHandle() = 0
end
'this
is the handler subroutine for the window
func mainwindow(WINDOW wnd),int
SELECT wnd.Message
CASE WM_SIZE
'someone
sized the window so get the client size again
rcWin = wnd.GetClientRect()
w = rcWin.right - rcWin.left
h = rcWin.bottom - rcWin.top
CASE ID_CLOSE
'stop
the timer and close the window
wnd.StopTimer()
wnd.Close()
CASE WM_TIMER
'draw
10 random lines every 10 millesconds
for
x = 1 to 10
wnd.Line(rnd(w),rnd(h),rnd(w),rnd(h),RGB(rnd(255),rnd(255),rnd(255)))
next
x
CASE ID_MENUPICK
SELECT
wnd.menunum
CASE 1
wnd.DrawRect(0,0,w,h,RGB(255,255,255),RGB(255,255,255))
CASE 2
CASE& 3
CASE& 4
wnd.SetLineStyle(LSSOLID,wnd.menunum - 1)
size = wnd.menunum - 1
CASE 5
wnd.Close()
Return 1
ENDSELECT
CASE WM_INITMENU
wnd.CheckMenuItem(2,size = 1)
wnd.CheckMenuItem(3,size = 2)
wnd.CheckMenuItem(4,size = 3)
ENDSELECT
RETURN 0
ENDF
|
|
 |
|
 |
 |
|
Who's Online |
|
We have 9 guests online |
|
 |
|
 |
|