> I'm reading Palm OS Programming Bible. There is the following
instructions:
> ================
> CtlSetLabel( ctl, LstGetSelectionText( list, 1 ) );
> CtlSetLabel( ctl, "This is a bad idea" );
> ================
> In the book, it said that the 2nd item of 'list' will be overwritten by
> "This is a bad idea".  However, to my understanding, the 1st instruction
> will copy the pointer of 2nd item of 'list' to 'ctl'. Then the 2nd
> instruction will copy the pointer (to"This is a bad idea") to 'ctl'. I
don't
> understand why the 2nd item of 'list' would be overwritten.
>
> Please give some advice and tell me what's wrong with my concept.

you have mis-read what he is saying :)

when you have a pop-up list, you normally have both a control
and a list resource. when you make the second call, it will not
over-write the list contents - however, it will make the user
see that the option they selected is "This is a bad idea"
(which, may not be in the list)..

to overwrite the contents of the 'list' - you would need to
modify the pointer of strings (stringlist) and call the
LstSetSelectionText() API call.

try the examples.. and, you'll see what i mean.

it is sometimes good to use this technique to have a pop-up
list that says "Select Item", and, the list contains a bunch
of items - when the user selects it, the "Select Item" goes
away, and, everyone is happy.

---
Aaron Ardiri                           [EMAIL PROTECTED]
CEO - CTO                                              +46 70 656 1143
Mobile Wizardry                         http://www.mobilewizardry.com/



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

Reply via email to