"Evgeny Rokhlin" <[EMAIL PROTECTED]> wrote:

> Supposing I want 2 versions of my program.
> version 2 has a button on the main form, and a popup form with some
> functionality show when you press it.
> version 1 has none.
> Everything else is nearly the same.
> I would like to keep it a single project, because most of the code is the
> same (so, the bugs too - want to check them once, not twice).
> Can I somehow manage it like this
> 
> #ifdef VERSION_1
> // Make the button invisible and ignore occasional taps????    Or smth else?
> #endif
> 
> #ifdef VERSION_2
> // Process pressing the button, use FrmGotoForm, FrmSetEventHandler,  and so
> on
> #endif

Yes, that would work, and I don't think it would be any less stable 
than having two separate versions (if you do it right :-) From your 
description, it sounds like version 2 is a superset of version 1. If 
that is true, then you won't even need the #ifdef VERSION_1. Simply 
make the button unusable in Constructor or your PilRC source file, 
whichever you are using. Then for VERSION_2 make it usable with 
FrmShowObject.

This one conditional should be all it takes to make your app work. If 
you want to reduce the size of the VERSION_1 app, you could wrap the 
VERSION_2 button event handling and the form handler in conditionals.

Also, a button that is unusable will never generate a ctlSelect event, 
and thus there will be nothing to ignore.

--
Roger Chaplin
<[EMAIL PROTECTED]>

-- 
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