> From: Kapil Konde
>
> But again in form event handler thare comes switch statements for various
> form events I want to avoid them....
>
Hey, that's what C programming is all about! The OS sends various events to
your handler, and your handler has to respond to some of them and pass the
others on. You can use a switch statement or a bunch of if statements.
Delphi has a great method of dealing with this for Windows programs - you
just define event handlers for each of the events you want to handle and the
compiler invisibly creates a big switch statement for you that actually
calls the event handlers. Even then, there really is just a big switch
statement somewhere.
Basically, any event driven architecture requires a big switch statement to
handle all the events that come in.
The only alternative I can think of is to use function pointers and create
some way to directly call the appropriate function based on the event.
However, deciding which function to call is probably going to require a big
switch statement. Maybe you could directly generate the appropriate
function pointer from the event number, using a sparse array...
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/