> At 11:04 2002-12-2 -0500, you wrote: >>Greetings, >> >>When I select the trigger to display my category list, the trigger text >>corrupts when the trigger is highlighted. The category list seems to >>display okay, but when it closes the trigger text is then blank if the >>category was not changed. If the category was changed then the new >>category is displayed, but only until the trigger is selected again, at >>which time the text corrupts again. > > Are you passing a pointer to a locally allocated string in your call to > CtlSetLabel? You can't do that, since the OS may redraw the trigger later > in the program's run, and if your string buffer was on the stack, it will > likely be used for some other purpose at that time. >
Actually I'm using the code example from the Address app example code: // Set the label of the category trigger. ctl = ToolsGetFrmObjectPtr(frmP, ListCategoryTrigger); CategoryGetName (AddrDB, CurrentCategory, CategoryName); CategorySetTriggerLabel (ctl, CategoryName); That's right out of AddrList.c, PrvListInit() function, and the same thing I'm doing in my code as well. The string comes from the database's info block that was established when the database was created. > Make sure you only pass a pointer to a global string, a string constant, > or > memory allocated using one of the system memory allocation routines. If > you pass a dynamically allocated string, you'll also need to free that > string when the form is closed. > > Good to know for other controls, I'll tuck that away in my chest of good tips. But I don't think this is related to the problem I'm having? !@#$%^ While sitting here typing this it just hit me. You are correct, the CategoryName in the Address app is defined in global scope, and mine is a local variable in the function... Would this be the problem? Crap, I can't test it until I get home! Great, now I get to sit here all day in anticipation. You know, why isn't that documented better? Or is it that obvious to everyone but me? I'll bet that is the problem, 100%!! Crap crap crap. Thanks for the insight! Matthew -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
