WINDOW command

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
GPB-Wannabe
Newbie
Posts: 2
Joined: Fri Feb 15, 2019 2:47 am

WINDOW command

Post by GPB-Wannabe »

Hello

I have bought this book "The Basic Design of Two-Stroke Engines" where the code for several programs are listed.
I have "recreate" one of the programs form the text book, however QB64 is not keen about the WINDOW command. Please refer to the code below.
I tried to lookup WINDOW command in QB64 WIKI, but I'm a complete novice (PRINT "Hello world!" stage)...
Any help would be greatly appreciated.
Thanks.

REM The Basic Design of Two-Stroke Engines - ISBN: 1-56091-008-9
REM Prog.6.2
REM A TUNED EXHAUST PIPE PROGRAM FOR A TWO STROKE ENGINE
REM Page 608
WINDOW 1
WINDOW 2,"CLICK BOX",(201,50)-(400,450),1
PRINT "SELECT BY BUTTON"
WINDOW 3,"CURRENT DATA",(10,50)-(200,450),1
WINDOW 4,"DATA INPUT",(400,50)-(600,450),1
WINDOW 5,"ACTION BOX",(10,400)-(600,450),1
WINDOW 6,"EXHAUST TYPE",(400,50)-(600,450),1
WINDOW 1
100 INPUT"NEW DATA OR FILE DATA (TYPE N OR F)?";D$
IF D$="N" THEN GOTO 110
IF D$="F" THEN GOSUB FILED
110 WINDOW 3
CLS
GOSUB CURRENTDATA
WINDOW 2
BUTTON 1,1,"BORE",(5,25)-(100,45),3
BUTTON 2,1,"STROKE",(5,45)-(100,65),3
BUTTON 3,1,"CON-ROD",(5,65)-(100,85),3
BUTTON 4,1,"EXHAUST TIMING",(5,85)-(200,105),3
BUTTON 5,1,"NUMBER OF PORTS",(5,105)-(200,125),3
BUTTON 6,1,"WIDTH OF EACH PORT",(5,125)-(200,145),3
BUTTON 7,1,"TOP CORNER RADIUS",(5,145)-(200,165),3
BUTTON 8,1,"BOTTOM CORNER RADIUS",(5.165)-(200,185),3
BUTTON 9,1,"DOWN PIPE DIAMETER",(5,185)-(200,205),3
BUTTON 10,1,"MID-SECTION DIAMETER",(5,205)-(200,225),3
BUTTON 11,1,"RPM",(5,225)-(200,245),3
BUTTON 12,1,"EXHAUST TEMPERATURE",(5,245)-(200,265),3
BUTTON 13,1,"EXHAUST TYPE?",(5,265)-(200,285),3
BUTTON 30,1,"RUN",(5,325)-(100,350),3
BUTTON 31,1,"QUIT",(5,350)-(100,375),3
ACTIVITY=DIALOG(0)
WHILE ACTIVITY<>1:ACTIVITY=DIALOG(0):WEND
BUTTONPUSHED=DIALOG(1)
IF BUTTONPUSHED=30 THEN GOTO 130
REM Page 609
IF BUTTONPUSHED=31 THEN GOTO 556
ON BUTTONPUSHED GOSUB BORE,STROKE,CONROD,EXTIMING,PORTNO,PORTWID,TOPR,BOTTOMR,DOWNDIA,MIDDIA,SPEED,EXTEMP,EXHTYPE
GOTO 110
130 WINDOW 1
CLS
PI=3.1415927#

--||--

556 END
EXHTYPE:
WINDOW 6
LOCATE 1,1:PRINT "CLICK WHICH TYPE"
LOCATE 2,1:PRINT "OF EXHAUST APPLICATION"
BUTTON 1,1,"MOTOCROS",(5,85)-(200,105),3
BUTTON 2,1,"ENDURO",(5,105)-(200,125),3
BUTTON 3,1,"GP ROAD RACE",(5,125)-(200,145),3
ACTIVITY=DIALOG(0)
WHILE ACTIVITY<>1:ACTIVITY=DIALOG(1):WEND
BUTTONPUSHED=DIALOG(1)
ON BUTTONPUSHED GOSUB MOTOX,ENDUR,GPROAD
RETURN
MOTOX:
EXH$="MOTOCROS PIPE"
EXK=.65
RETURN
ENDUR:
EXH$="ENDURO PIPE"
EXK=.7
RETURN
GPROAD:
EXH$="GRAND PRIX PIPE"
EXK=.6
RETURN
SUBPRINT:
CLS
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Re: WINDOW command

Post by burger2227 »

Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
GPB-Wannabe
Newbie
Posts: 2
Joined: Fri Feb 15, 2019 2:47 am

Re: WINDOW command

Post by GPB-Wannabe »

Thanks for the answer :)
Unfortunately, the only thing I could find was "WINDOW [ [ SCREEN] (x1!, y1!) - (x2!, y2!)]"... and I couldn't find anything about the way the author has used the WINDOW command:
WINDOW 1 ---> is this the same as the SCREEN command ?
WINDOW 2,"CLICK BOX",(201,50)-(400,450),1 ---> 2,"CLICK BOX" acc. to QB64 WIKI [ SCREEN] is the only parameter that can be used ?
Have the parameters for the WINDOW command been changed since 1990? or has the commands been diff. from Macintosh to IBM PC at that time? The author used a Macintosh II :)
Thanks.
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Re: WINDOW command

Post by burger2227 »

Join the QB64.org forum and get some better code from the members. That WIKI page got messed up somehow. Tell them to fix it...
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Post Reply