From: "Vesselin Bontchev" <[EMAIL PROTECTED]>
> One of the forms of my application displays a list of entries. I want,
when the user taps on one of the displayed entries, to pop up a new form,
containing more information about that entry.
>
> Somebody else suggested to me to stuff a custom event in the event queue
and intercept that event in the popup form's handler. It is not quite clear
to me how to do this ...
>
This isn't too hard to do, but custom events aren't gauranteed to arrive
(since they will be eaten by any OS window the user happens to pop
up at the wrong time) and so should only be used under situations where
you know that isn't possible (or where you don't care if some events
never arrive).  It also doesn't seem appropriate from a design point
of view because the value isn't an event that is raised and reacted to,
it's a property the second form will need in order to function.

The solution I chose might have been influenced by a history in C++
OO applications - which is to give the second form a Set method that
stores the value.  You still need a variable, but it's hidden inside the .c
file that implements that form (oh yeah, I also follow the rule of one
C file for each form) rather than being global to the app. Only the Set
method is exposed in the header (.h) file.

With this you don't have a global variable sitting in some application
header completely separate from the code that implements either form
- the variable is inside the form that needs to use it.  You could just
as easily define the variable within the second form and declare it
extern in the header, but I prefer the Set function (is my C++
showing?).

Chris Tutty


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

Reply via email to