[futurebasic] CASEs/ Tracked down problem to this...

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2006 : Group Archive : Group : All Groups

From: Russ Pagel <russp@...>
Date: Fri, 27 Jan 2006 21:26:10 -0600
Brian,

A few thoughts:

1.  You are using dataLine$ a few lines before you dim'ed it.  I'm not sure
if it's a problem but it's poor practice in any case.

2.  keyWord$ has not been dim'ed at all.  That's why the compiler thinks its
an unknown statement.

3.  restOfLine$ has not been dim'ed either.

4.  You probably already realized that:
' wnumx = VAL( restOfLine )
 '  wtx$  = MID$(restOfLine,3)
Failed to work because they refer to restOfLine  which is a different
variable than restOfLine$.

Hope this helps


> From: Brian Heibert <bheibert@...>
> Date: Fri, 27 Jan 2006 17:44:59 -0500
> Hi,
> 
> I have tracked down my problem to be in the FN (shown below)
> 
> and have tracked it down even further:
> Error: Unknown Statement: 'dataLine$'
> in file HBasic.proj:HBASIC.MAIN at line 476 in ParseEFLines
> €dataLine$€     = EDIT$( _cEdit, lineNum )
> Error: Unknown Statement: 'keyWord$'
> in file HBasic.proj:HBASIC.MAIN at line 478 in ParseEFLines
> €keyWord$€      = LEFT$(dataLine$,spacePosition-1)
> Error: Unknown Statement: 'restOfLine$'
> in file HBasic.proj:HBASIC.MAIN at line 479 in ParseEFLines
> €restOfLine$€   = MID$(dataLine$,spacePosition+1)
> 
> What do I need to do to fix this? It worked fine until I switched
> over to CASES
> 
> LOCAL FN ParseEFLines (efID as Long)
> dim wnum,wtit$
> dim rs$
> efHndl& = TEhandle( _cEdit )
> dataLine$     = EDIT$( _cEdit, lineNum )
> spacePosition = INSTR(1, dataLine$+" "," ")
> keyWord$      = LEFT$(dataLine$,spacePosition-1)
> restOfLine$   = MID$(dataLine$,spacePosition+1)
> FOR lineNum = 1 TO efHndl&..TEnLines%
> DIM efHndl&, dataLine$, lineNum
> DIM spacePosition
> SELECT UCASE$( keyWord$ )
> CASE "WIN#"
> ' wnumx = VAL( restOfLine )
> '  wtx$  = MID$(restOfLine,3)
> wnumx = RIGHT$(VAL(restOfLine),6)
> wtxt$ = RIGHT$(restOfLine,8)
> WINDOW wnumx, wtx$ // make the new window
> WINDOW _editor  // and return to editor window
> 
> CASE "PRINT"
> out$ = RIGHT$(restOfLine,6)
> WINDOW wnumx
> PRINT out$
> WINDOW _editor
> end select
> NEXT lineNum
> END FN