[futurebasic] Long Strings revisited

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

From: Sean -G3- <mclaughlin@...>
Date: Mon, 14 Jun 99 21:36:44 -0400
I'm now trying to do some stuff with a calender. There are 31 dates, each 
of which have their own pointer to a block of long string data. When the 
user clicks a date, the program simply displays the string.

I have a function to read edit field data into a long string, and to 
insert a long string into an edit field. I took Tedd's Long Strings and 
added a (gLongStringID) to all global variables. I made a test program to 
ensure that this works, and it did. I simply set the gLongStringID 
variable before I call a long string function.

This program gives me a Type 1 Error when I run it. The error goes away 
when I REM out this line:
current& = [textHandle&] + count + 2

Any help is appreciated.

My function which reads an edit field into a long string looks like this:

editFieldHandle& = TEHANDLE(gDate)
textHandle& = editFieldHandle&..teTextH&
length% = editFieldHandle&..teLength%
PRINT % (10,10) length% 'For debugging purposes only. Always returns "16"

'Save the handle state, then lock it
saveState% = FN HGETSTATE(textHandle&)
osErr% = FN HLOCK(textHandle&)

FOR count = 1 TO length%
'Get handle/pointer to byte, read it
current& = [textHandle&] + count + 2
char% = PEEK(current&)
FN putChar(char%)
NEXT

'Return the state of the handle
osErr% = FN HSETSTATE(textHandle&,saveState%)

The function which puts a long string into an edit field looks like this:

  gLongStringID = gDate
  current& = gStringH&(gLongStringID)
  
  'Save the handle state, then lock it
  saveState% = FN HGETSTATE(current&)
  osErr% = FN HLOCK(current&)
  
  'Get the long string size
  longStringSize = PEEK WORD ([current&])
  
  'Read the long string into the edit field
  EDIT$(2) = ""
  FN appendWithHandle(current&+2,longStringSize,2)
  
  'Return the state of the handle
  osErr% = FN HSETSTATE(current&,saveState%)