it really help a lot, thanks, but i have define ALLOW_ACCESS_TO_INTERNALS_OF_LISTS in my .h file, the error repeate again, there is somthing i done wrong?
ÔÚÄúµÄÀ´ÐÅÖÐÔø¾Ìáµ½: >From: Logan Shaw <[EMAIL PROTECTED]> >Reply-To: "Palm Developer Forum" <[email protected]> >To: "Palm Developer Forum" <[email protected]> >Subject: Re: access ListType member lead to compile error? >Date:Mon, 19 Sep 2005 23:18:04 -0500 > >å?é£?wrote: >> in one cpp file, i want to set the hasScrollBar to false, >> so i type such codes: >> >> #include <List.h> >> ... >> >> ListType *pList; >> pList = (ListType*)FrmGetObjectPtr(...); >> pList->attr.hasScrollBar = false; >> >> and got error: >> >> .cpp:77: invalid use of undefined type `struct ListType' >> /PalmDev/sdk-5r4/include/Core/UI/List.h:66: forward declaration of `struct >> ListType' >> make: *** [PhraseViewForm.o] Error 1 >> >> what cause such error? it seems that other could access >> the internal structure of ListType from previous posts > >Look at the List.h header file. If you're using the same version >as me, you'll see something like this: > > typedef struct ListType > #ifdef ALLOW_ACCESS_TO_INTERNALS_OF_LISTS > { > UInt16 id; > /* other fields left out so this message isn't too long */ > } > #endif > ListType; > >This seems to be a clever way to make the list's fields "private", >like private class members in C++ for example. In the OS code, >they define that constant, and it comes out of the C preprocessor >as a regular struct declaration. In application code, that constant >isn't normally defined, and it comes out as a forward declaration. > >If you think Palm is serious about ever changing the structure of >lists as they have warned, then the safe thing to do would probably >be to eliminate the scrollbar making sure that LstGetNumberOfItems() >is never bigger than LstGetVisibleItems(). That doesn't have to >make your life too difficult, because a list's contents is an array >of Char pointers anyway, so you can do something like this to change >the top item: > > const Int16 itemcount = 6; > Char *items[itemcount] = > { "so", "many", "things", "on", "my", "list" }; > > Int16 topitem = whatever(); > LstSetListChoices (listptr, items + topitem, itemcount - topitem); > >Hope that helps. > > - Logan > >-- >For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/ > -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
