[futurebasic] Re: [FB] Updated : Crash when finding position in handle FB4.4.3 PPC

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 2009 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Thu, 24 Sep 2009 09:06:39 +1200
PZ wrote:

> I am getting a crash with no error message from when looking for  
> positions
> in a handle of clipboard text. Anything obvious to the better  
> educated?
>
> ListHndl& = FN GetClipBoard (_"TEXT")

long if ( ListHndl& ) // GetClipBoard worked

> hndlSize&=FN GETHANDLESIZE(ListHndl&)

long if ( hndlSize& ) // there's some text

> startChar&=0

//FOR tpos&=1 TO hndlSize&
for tpos& = 0 to hndlSize& - 1 // characters are at offsets 0 to  
hndlSize& - 1

>  temp&= [ListHndl&] + tpos&   '**CRASHES here**
>  value% = PEEK (temp&)
>  LONG IF value%=13      'entry must end with a CR to show
>   numChars&=tpos&-startChar&
>   tempStr$=FN lsMid$(ListHndl&,startChar&,numChars&)
>   tempStr$ = tempStr$ +  CHR$(13)  'ADD RETURN for list in ef
>   IF LEN(tempStr$)>0 THEN CALL TEINSERT(@tempStr$+1,LEN(tempStr$),EF&)
>   startChar&=tpos&+1
>  END IF
> NEXT tpos&

end if
end if

> EDIT FIELD #_ClipSearEdit1
> edtLen&=WINDOW(_efTextLen)          'find end of text
> SETSELECT edtLen&, edtLen&          'put cursor at end

Robert P.