LstGlueGetTopItem should do the checking and retrieving for you, shouldn't it?

-- Keith

At 4:27 PM -0600 2/28/02, Richard Bell wrote:
>Ok I got my function to work by defining ALLOW_ACCESS_TO_INTERNALS_OF_LISTS
>before including the Palmos headers.  I'd still like someone to tell me if
>there is a better/safer way to do this.  I want to maintain compatability
>with future Palm OS releases.
>
>Thanks again.
>Richard
>
>----- Original Message -----
>From: "Richard Bell" <[EMAIL PROTECTED]>
>To: "Palm Developer Forum" <[EMAIL PROTECTED]>
>Sent: Thursday, February 28, 2002 4:16 PM
>Subject: Problem with LstGetTopItem
>
>
>>  I'm using SDK 4.0 and made use of the call LstGetTopItem so I can store
>the
>>  top item of a list.  The call works fine if I'm using an OS 4.0 or higher
>>  device but fails on an OS 3.5 device.  I attempted to create a function
>that
>>  would detect the version and use the older method but it will not compile.
>>  I recieve the error:
>>
>>  Error: illegal use of incomplete struct/union/class 'ListType'
>>
>>  I've seen that error reported before here in the forum and know its
>related
>>  to me attempting to access the internals of a structure.  I'll be happy
>not
>>  to do it if someone can tell me how to generate a prc that will work on my
>>  3.5 devices as well as my 4.0.
>>
>>  And if I'm just doing something really stupid, I'm happy to accept that
>too.
>>
>>  Here is my attempt at a function to get around the problem:
>>
>>  Int16 MyLstGetTopItem(const FormType *frmP, UInt16 objIndex)
>>  {
>>  Int16 ret;
>>  Int32 requiredVersion;
>>  UInt32 romVersion;
>>
>>  // we can only use LstGetTopItem if the os is 4.0 or better
>>  requiredVersion = sysMakeROMVersion(4,0,0,sysROMStageRelease,0);
>>
>>  FtrGet(sysFtrCreator, sysFtrNumROMVersion, &romVersion);
>>
>>  if (romVersion < requiredVersion)
>>   { // we have to do it the hard way
>>   // and access the internal structures
>>   #undef DO_NOT_ALLOW_ACCESS_TO_INTERNALS_OF_STRUCTS
>>   ListType *pLst;
>>   pLst = (ListType *)FrmGetObjectPtr (frmP, objIndex);
>>   ret = pLst->topItem;
>>   #define DO_NOT_ALLOW_ACCESS_TO_INTERNALS_OF_STRUCTS
>>   }
>>  else
>>   {
>>   ret = LstGetTopItem ((ListType *)FrmGetObjectPtr(frmP, objIndex));
>>   }
>>
>>  return ret;
>>  }
>>
>>
>>  --
>>  For information on using the Palm Developer Forums, or to unsubscribe,
>please see http://www.palmos.com/dev/tech/support/forums/
>>
>
>
>--
>For information on using the Palm Developer Forums, or to 
>unsubscribe, please see 
>http://www.palmos.com/dev/tech/support/forums/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to