[futurebasic] Help!

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : August 2005 : Group Archive : Group : All Groups

From: Brian Heibert <bheibert@...>
Date: Sat, 20 Aug 2005 20:50:26 -0500
Something is wrong with this code I keep on getting errors
Can someone point me to what's wrong?

Brian

_HBAS = 1
_cEdit = 1
RESOURCES "HBASIC.rsrc"
dim cmd$
sysz = SYSTEM(_sysvers)
long IF sysz <1030
beep
CALL PARAMTEXT("","","","")
controlNum%=FN ALERT(133,0)
END
end if



#define FMFontFamily as SInt16


toolbox fn FMGetFontFamilyFromName(Str255 iName) = FMFontFamily


Local fn BuildXCBAS
dim as Str255              s
dim as ControlFontStyleRec tfs
dim as WindowAttributes    wa
dim as Rect                r
'~'<
wa = _kWindowCloseBoxAttribute¬
      _kWindowCollapseBoxAttribute

SetRect(r, 0, 0, 640, 480)// Optional FB auto-centre
//SetRect(r, 55, 129, 695, 609)// w: 640 h: 480
appearance window -_HBAS,¬
                   "HBASIC", @r,¬
                   _kDocumentWindowClass, wa
def SetWindowBackground(_kThemeActiveDialogBackgroundBrush, _zTrue)
'~'<
SetRect(r, 3,-1, 625, 480)
s = ""
edit field _cEdit, s, @r, _framed_noDrawFocus, _leftJust
edit text #_cEdit, fn FMGetFontFamilyFromName("Lucida Grande"), 13

SetRect(r, 625,-2, 640, 481)
scroll button -_cEdit,0,0,0,0, @r, _scrollOther

appearance window _HBAS
end fn

APPLE MENU "About HBASIC..."
MENU 1,0,1, "File"
EDIT MENU 2
MENU 3,0,1,"Command"
MENU 3,1,1,"/RRun..."
MENU 3,2,1, "/KCompile..."

LOCAL FN LoadStr$(ID)
txt$ = ""
rHndl& = FN GETRESOURCE(_"STR ",ID)
LONG IF rHndl&
FOR i = 1 TO numLines
   lineStr = EDIT$( efID, i )
LONG IF lineStr = "TIME"
t$ = TIME$
LONG IF VAL(t$) <12
t$ = STR$(VAL(t$)-12) + RIGHT$(t$,6) + "PM"
xelse
t$ = t+" AM"
end if
PRINT t$
END IF

   spacePosition = INSTR( 1, lineStr, " " )
   LONG IF spacePosition > 0
     keyword = LEFT$( lineStr, spacePosition - 1 )
     restOfLine = MID$( lineStr, spacePosition + 1 )
   XELSE
      keyword = ""
     restOfLine = ""
END IF

   SELECT keyword

CASE "BEEP"
       BEEP
CASE "PRINT"
TEXT font%
       PRINT  restOfLine
CASE "UCASEPRINT"
       PRINT UCASE$(restOfLine)
   CASE "LCASEPRINT"
      DEF LCASE( restOfLine )
      PRINT restOfLine
CASE ""
beep
Msg1$ = FN LoadStr$(I28)

CALL PARAMTEXT(Msg1$,"","","")
controlNum%=FN CAUTIONALERT(128,0)

CASE "MSGBOX"
beep
CALL PARAMTEXT(restofLine,"","","")
controlNum%=FN ALERT(129,0)
CASE "CAUTIONALERT"
beep
CALL PARAMTEXT(restofLine,"","","")
controlNum%=FN ALERT(132,0)
CASE "UCASEALERT"
CALL PARAMTEXT(UCASE$(restofLine),"","","")
controlNum%=FN ALERT(129,0)
CASE "LCASEALERT"
DEF LCASE(restOfLine)
CALL PARAMTEXT(restOfLine,"","","")
controlNum%=FN ALERT(129,0)
CASE "INTRANDOMALERT"
DIM rndm$
RANDOMIZE TIMER
c=INT(RND(VAL(restofLine)))
rndm$ = STR$(c)
CALL PARAMTEXT("Output: "+rndm$,"","","")
controlNum%=FN ALERT(129,0)
CASE "RANDOMALERT"
RANDOMIZE TIMER
c=RND(VAL(restofLine))
rndm$ = STR$(c)
CALL PARAMTEXT("Output: "+rndm$,"","","")
controlNum%=FN ALERT(129,0)

CASE "RANDOM"
RANDOMIZE TIMER
a=RND(VAL(restofline))
PRINT a
CASE "INTRANDOM"
RANDOMiZE TIMER
b=INT(RND(VAL(restofline)))
PRINT b

CASE "VAL"
PRINT VAL(restofline)

CASE "VALDIALOG"
CALL PARAMTEXT(VAL(restofLine),"","","")
controlNum%=FN ALERT(129,0)
CASE "INPUT"
   CALL PARAMTEXT(restofLine,"","","")
   controlnum%=FN ALERT(130,0)

CASE "PRINTSTR$"
stx$ = restOfLine
print stx$

CASE "CHR$"
sty = VAL(restofline)
print chr$(sty)

CASE "PRINTCHR$"
sty = VAL(restofline)
print chr$(sty)

CASE "PAUSE"
DELAY VAL(restofline)

CASE "ENDPAUSE"
TIMER END
DELAY END
CASE "DEFRESOURCER"
DEF CREATERESFILE (restofline)
CASE "WIN"
wl = VAL(restofline)
WINDOW #wl


DO
DEF FN doDialogX
ON DIALOG FN doDialogX
HANDLEEVENTS
UNTIL 0
END SELECT
END SELECT
NEXT i
END FN


LOCAL FN doDialogX
dim as long evnt, id

evnt = dialog(0)
id = dialog(evnt)

select case( evnt )
case _wndClose
window close #wl
case _btnClick
select( id )
case 1 :  window close #wl

end select
end select

end fn


LOCAL FN aboutbox
RESOURCES "HBASIC.rsrc"
begin enum 2
_About
end enum

begin enum 1
_cPict
_cStat
_cStat1
_cStat2
_cPush
end enum

dim as Str255              s
dim as ControlFontStyleRec tfs
dim as WindowAttributes    wa
dim as Rect                r
dim as Boolean           @ bool
'~'<
wa = _kWindowCollapseBoxAttribute¬


//SetRect(r, 0, 0, 410, 250)// Optional FB auto-centre
SetRect(r, 311, 310, 721, 560)// w: 410 h: 250
appearance window -_About,¬
                   "About", @r,¬
                   _kDocumentWindowClass, wa
def SetWindowBackground(_kThemeActiveDialogBackgroundBrush, _zTrue)
'~'<
SetRect(r, 27, 20, 143, 98)
appearance button _cPict,¬
                   _activeBtn, 1000,,,, @r,¬
                   _kControlPictureNoTrackProc

SetRect(r, 192, 41, 356, 60)
s = "HBASIC 1.0"
edit field _cStat, s, @r, _statNoFramed, _leftJust
edit text #_cStat, fn FMGetFontFamilyFromName("Lucida Grande"), 13

SetRect(r, 151, 68, 349, 87)
s = "Version 1.00 by Brian Heibert"
edit field _cStat1, s, @r, _statNoFramed, _leftJust
edit text #_cStat1, fn FMGetFontFamilyFromName("Lucida Grande"), 13

SetRect(r, 151, 98, 376, 117)
s = "© Copyright 2005 Heibert Software"
edit field _cStat2, s, @r, _statNoFramed, _leftJust
edit text #_cStat2, fn FMGetFontFamilyFromName("Lucida Grande"), 13

SetRect(r, 200, 165, 262, 185)
appearance button _cPush,¬
                   _activeBtn,,,,¬
                   "OK", @r,¬
                   _kControlPushButtonProc
bool = _zTrue
def SetButtonData(_cPush, _kControlEntireControl,  
_kControlPushButtonDefaultTag, SizeOf(Boolean), bool)


appearance window _About
def fn doClose


end fn

local fn doClose
dim as long evnt, id
evnt = dialog(0)
id = dialog(evnt)
select case (evnt)
case _btnClick
select (id)
case _cPush
window close #2
end select
end select
end fn





local fn DoDialog
dim as long evnt, id

evnt = dialog(0)
id = dialog(evnt)

select case( evnt )
case _wndClose
window close #2
select( id )
case 1 :  gFBQuit = _zTrue

case _btnClick
select( id )
case 1 :
window close #2
case 2

case _cPush
window close #2
end select

end select
end select
end fn


LOCAL FN HandleMenu
dim menuNum, menuItem
menuNum  = menu( _menuID )
menuItem = menu( _itemID )
if menuNum = 3 and menuItem = 1 then fn parseEFLines(1)
if menuNum = _applemenu and menuitem = 1 then fn aboutbox
end fn

FN HandleMenu
fn BuildXCBAS

ON MENU FN HandleMenu

DO
handleevents
until gFBQuit