[futurebasic] Re: OS X Word Finder

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2002 : Group Archive : Group : All Groups

From: Ken Shmidheiser <kshmidheiser@...>
Date: Tue, 5 Nov 2002 10:13:37 -0500
In reference to OS X Word Finder:

These two modified functions enable proper forward/reverse button 
handling and will prevent the return of empty lines in the earlier 
code.

Concerning Word Finder, Chip G. wrote:

>This is a very neat utility. Now if it could just spit out a
>definition for said words.  ;)

A dictionary/thesaurus may be a longer term project as I begin to 
better understand the tools available in OS X and its BSD 
underpinnings.

Best,

Ken

local fn ForwardReverse( whichWay as str15 )
dim as integer i, a, b, nlines
dim as handle  efH

a = 0 : b = 0

appearance button 2

select case whichWay
case "reverse" : gDirection--
case "forward" : gDirection++
end select

if gDirection =<  1 then gDirection =  1
if gDirection => 16 then gDirection = 16

if gDirection =  1 then a =    1 : b =  499 : appearance button -2
if gDirection =  2 then a =  500 : b =  999
if gDirection =  3 then a = 1000 : b = 1499
if gDirection =  4 then a = 1500 : b = 1999
if gDirection =  5 then a = 2000 : b = 2499
if gDirection =  6 then a = 2500 : b = 2999
if gDirection =  7 then a = 3000 : b = 3499
if gDirection =  8 then a = 3500 : b = 3999
if gDirection =  9 then a = 4000 : b = 4499
if gDirection = 10 then a = 4500 : b = 4999
if gDirection = 11 then a = 5000 : b = 5499
if gDirection = 12 then a = 5500 : b = 5999
if gDirection = 13 then a = 6000 : b = 6499
if gDirection = 14 then a = 6500 : b = 6999
if gDirection = 15 then a = 7000 : b = 7499
if gDirection = 16 then a = 7500 : b = 8000

gC = ""
for i = a to b
long if len(dictStr(i)) > 1
gC += dictStr(i) + chr$(13)
xelse
exit for
end if
next i

edit$(10) = #gC
       efH = tehandle(10)

IF efH != 0 then nlines = efH..teNLines%

long if nlines < 500
gDirection = gDirection
appearance button -3
xelse
appearance button 3
end if

gC = ""

edit field 0

end fn

local fn HandleWords
dim as integer i, numWords

gDirection = 0

numWords = fn GetWord

long if numWords < 500
for i = 0 to numWords
long if len(dictStr(i)) > 1
gC += dictStr(i) + chr$(13)
xelse
exit for
end if
next i
appearance button -2
appearance button -3
edit$( 10 ) = #gC
kill dynamic dictStr
gC = ""
xelse
for i = 0 to 500
long if len(dictStr(i)) > 1
gC += dictStr(i) + chr$(13)
xelse
exit for
end if
next i
appearance button 3
edit$(10) = #gC
gC = ""
gDirection = 1
end if

end fn