> From: Dave Lippincott [mailto:[EMAIL PROTECTED]]
> I've got a form that pops up a list using LstPopupList. The
> custom draw routine of the list calls FrmGetActiveForm to help
> determine the list format. On a Palm or POSER with OS 3.1 or less,
> FrmGetActiveForm(called in the draw callback) returns the correct
> form ID. With OS 3.3 or 3.5, FrmGetActiveForm (still in the draw
> callback) returns NULL.
Why not change the approach slightly: instead of calling FrmGetActiveForm
during each call of the draw callback, just fetch its value once before
LstPopupList and then retrieve the value in the draw callback. This would
be more efficient and would avoid the problem of the behavior being
(apparently) different across OS versions.
I know of two ways to do that. The quick'n'dirty way is to use a global
variable. Set it before LstPopupList and read it in the callback. Should
work fine but if you consider using a global in this case to be a hacky
solution, then...
...pass the cached form value via the list object itself. When you use a
draw callback, the 'itemsText' parameter to LstSetListChoices doesn't
actually need to be text, but can be any 32-bit cookie you want, as long as
the draw callback knows what to do with it. So you could pass your form
pointer here, which then gets passed as a parameter to the draw callback.
Or this could be the address of a little structure that contains whatever
other state information is required by the draw callback. (I often use this
for the 'this' pointer of a C++ object that encapsulates the form.)
-slj-
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palm.com/devzone/mailinglists.html