[futurebasic] Re: [FB] Edit Fields, Strings

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : May 1999 : Group Archive : Group : All Groups

From: Sean -G3- <mclaughlin@...>
Date: Tue, 25 May 99 22:03:14 -0400
>The variable "[gStringH&]" _is_ the handle the data block and what you
>want. You have to understand the difference between handles and pointers.
>
>The get and put character at a time in my long strings (from memory) is
>only because you don't know in advance how many characters you are going to
>need in your long strings. As such, I build the long string a character at
>a time. If you want to build faster, then determine how many characters you
>want at a time OR figure how many characters are in the buffer you receive
>and then set the blockmove.

Thanks, but I couldn't get much to work. I don't work much with 
memory-related stuff, I ususually just let FB handle it for me. Until I 
learn how to do what you are doing in your code, I just use this (heres a 
demo):

DIM gStringArrayLength
DIM gStringArrayDepth
DIM gStringArray$(50)
END GLOBALS

CLEAR LOCAL
LOCAL FN buildTransString(x$)
  DIM length, totalLength, lengthLeft, temp$
  
  length = LEN(x$)
  totalLength = length + gStringArrayLength
  lengthLeft = 256 - gStringArrayLength
  
  LONG IF totalLength>256
    temp$ = gStringArray$(gStringArrayDepth) + LEFT$(x$,lengthLeft)
    gStringArray$(gStringArrayDepth) = temp$
    
    INC(gStringArrayDepth)
    gStringArrayLength = length-lengthLeft
    temp$ = RIGHT$(x$,gStringArrayLength)
    gStringArray$(gStringArrayDepth) = temp$
    
  XELSE
    
    temp$ = gStringArray$(gStringArrayDepth) + x$
    gStringArray$(gStringArrayDepth) = temp$
    gStringArrayLength = totalLength
    
  END IF
END FN

WINDOW 1

DO
  INPUT temp$
  FN buildTransString(temp$)
UNTIL temp$="quit"

pointer& = @gStringArray$(0)
PRINT PSTR$(pointer&)

DO
  HANDLEEVENTS
UNTIL gProgramEnds