[futurebasic] Re: Accessing arrays

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

From: Jay Reeve <jktr@...>
Date: Wed, 27 May 98 08:53:26 +0100
>Okay, I have a ColorTable handle. One of the fields in it is the ctTable,
>which contains an array of ColorSpec records. How can I acces a ColorSpec
>record from the ColorTable handle?
>
>cTableHndl&..ctTable&(x) won't work.

Check out the XREF command. I haven't looked up the ColorTable record 
structure, but I'm assuming it's something like this:

REM No, this is not valid FB code!
DIM RECORD cTableHndl&
  DIM ctablestuff
  DIM moreCtablestuff
  DIM ctTable.ColorSpecSize(??)
DIM END RECORD
where the ctTable record is of dynamic size, changing according to the 
number of ColorSpecs. If so, something like this should work:

DIM ColorSpecArray&                    'Var will hold ptr to array
XREF ColorSpecArray.ColorSpecSize(10)  'This number (10) is irrelevant
err = FN HLOCK(cTableHndl&)
ColorSpecArray& = [cTableHndl&] + _ctTable  'add offset to make ptr

Now you can treat ColorSpecArray(x) as a normal array. When you're done 
with it, be sure to unlock the cTableHndl&.

By the way, once the DIM var&:XREF var(x) structure is set up, all you 
need to do to access a different table is put its pointer in the var&.

Hope that helps.
 0"0
 =J= a  y
  "