> From: Todd Cary
>
>  With the code below, nothing happens.  What am I missing?
>
> begin
> ...
>   PopupIndex := FrmGetObjectIndex(Form, PopuptriggerVariety);
>   Control := ControlPtr(FrmGetObjectPtr(Form, PopupIndex));
>   if Control <> nil then
>   begin
>     FrmCustomAlert(AlertError, 'Got Control ptr', '', '');
>     //Nothing happens to the control!!
>     CtlSetLabel(Control, 'Test');
>   end else
>     FrmCustomAlert(AlertError, 'Control ptr = nil', '', '');
> ...
> end;
>

Try using a global pChar for the label.  CtlSetLabel does *not* make a copy
of the label, so you have to make sure the label exists as long as the
control is being displayed.  I don't remember where Delphi stores hardcoded
strings, but its possible that it goes out of scope as soon as the function
ends, and that would make it appear like CtlSetLabel() did nothing.


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

Reply via email to