To use label to display variable text, it is usually my practice to input
the longest text to the label, such as "XXXXXXX ... ", say 20 char.
Then define global constant in the header file:
#define PRICE_LABEL_LEN    20

And initialize the label just after "FrmInitForm" and before FrmDrawForm,
with your initial value, say "$0.00".
Every time during change of control label, use StrNCopy() with
PRICE_LABEL_LEN to limit the string length.
It is dangerous to copy longer string by accident and that would cause crash
easily.


"Ted Pederson" <[EMAIL PROTECTED]> ??? news:[EMAIL PROTECTED]
???...
> For labels, it seems safer to use FrmCopyLabel(), but you are still
> limited to changing the text to a string that is the same or less length
> than the original string in the resource. Is this correct? Is there any
> way around this?
>
> On pg. 249 of the Bible, there is the snippet that changes the label of
> a popup trigger. It just goes ahead and does a StrCopy() and call
> CtlSetLabel(). How can this be safe?
>
> I would guess there will be enough space allocated for the popup
> trigger's label to hold any of the strings in the associated list. But
> if you are using LstSetListChoices(), as it says on pg. 249 that it
> would be ok to do, what if you allocated a new longer string in the list
> ? Wouldn't that cause problems?
>



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

Reply via email to