> From: Andrew Ball [mailto:[EMAIL PROTECTED]]
> So now that we've figured out that I'm doing this the wrong
> way, what would you suggest as the "normal" solution?
> Something more like (which is what's currently working for me):
>
> pTriggerLabel = LstGetSelectionText (lst, ... );
> CtlSetLabel (ctl, pTriggerLabel);
But this is exactly what the OS does by default if you don't return true
from your popSelect handler. So none of this is needed. Try removing it
and see if it still works. And see the OS source.
> and not worry about allocating memory for anything?
> Or allocate a buffer [...] as a global?
The default behavior is all you need, as long as the list contains static
strings that won't change while the form is loaded. That's why it's safe to
get a pointer to a string inside the list and give it to the trigger. The
OS default behavior assumes this case.
But if you get fancy and change the string list in the list object later
(via LstSetListChoices) or if you don't have strings in the list at all
(using a draw callback) -- then you need to override the default trigger
setting behavior. Then you'd need to allocate a heap buffer, or just have a
static one, or (my suggestion) implement the whole form as a C++ class and
make the text buffer a data member of the class, to avoid polluting global
space.
-slj-