Thank you very much Jeff and Dave for replying my post
- I feel so embarrassed for asking those questions. I
solved this problem by reading from the database
again. I didn't have to call CtlGetLabel anymore
(thank God)...

1. read from db:
recHandle = DmQueryRecord(gF,
eventP->data.popSelect.selection);

2. unpack:
UnpackFRecord(&recF, recFPacked);

3. write that "stupid" label - it cost me a lot of
time
CtlSetLabel(ctlP, recF.fname); 


--- Jeff Wheeler <[EMAIL PROTECTED]> wrote:
> Christy wrote:
> >> Here is my code for popSelect event. Could you 
> >> please help me to identify where the problem is:
> 
> [snippit removed]
> 
> Don't change the string returned by CtlGetLabel().
> In other words, don't do
> this:
> 
>   Char * lblP;
>   lblP = (Char*)CtlGetLabel(ctlP);
>   StrCopy(lblP, LstGetSelectionText(lstP,
> 
> CtlGetLabel returns a "const Char *", not a "Char
> *".  This is one clue that
> you shouldn't / can't change it.
> 
> Also, when you call CtlSetLabel, the string memory
> must stay in scope.
> Typically a global string or allocated string is
> used.  If you want to
> change the text of a label, do something like this.
> 
>   #define SOME_MAX_SIZE 32;
>   static Char s_LabelStr[SOME_MAX_SIZE];
>   StrCopy(s_LabelStr, "Some label text here");
>   CtlSetLabel(controlP, s_LabelStr);
> 
> Jeff
>  
> 
> 
> 
> 
> 
> --
> For information on using the Palm Developer Forums,
> or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.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