I managed to sort out my problem, thanks to helpful suggestions from
several people. Porting to CW was certainly a learning experience, but 
now my code is up and running in identical form to the GCC version. I
expected code bloat, but it's actually smaller than the original, and I am
using C++. :)

I had several interesting problems in my code, so maybe this information
below will save a few hours of someone else;

- My forms were not including everything I expected them to; this was
because I had modified the wrong version of resource.rsrc at some point
along the line. There was never a warning for missing or faulty resources,
but testing things out with Chris Antos' RCPALM utility helped me pinpoint
my problem (thanks Chris!). I also didn't know of the existance of that
utility when I started the port; I think I would have rather stuck with my
PilRC generated resources at least for the first version. Redoing them all
in Constructor was quite the undertaking.

- Constructor in CW R4 isn't happy handling images with 50% gray stipple
pattern. Why? I presume it's a bug with the bitmap RLE code; the image is
just plain wrong. I managed to convert my bitmap images *rather*
painlessly by using Copy Image in an image viewer (ACDC) and pasting with
edit in Constructor. 2-bit images failed to copy this way but using 4-bit
and above BMP files for the source worked fine.

- My code was accessing some resources expecting them to be linear in ID
arrangement (..Player1TypeList + i ) which had not happened automatically
when I created them in Constructor. The result was quite awkward; my code
that was setting up the form defaults was not checking for the object type
acquired with FrmGetObjectPtr() but instead casting this ruthlessly.
Asserting for the pointer type in a separate FrmGetFieldPtr() etc.
function, like suggested in Rhodes' Palm Programming book, is good for
catching this type of errors. For me it cascaded down to an "Invalid font"
error when I entered that form; I was boggled.

- In GCC, I was quite happily using standard library calls in C++. These
were not numerous, but I was relying on sprintf and va_list multi-variable
stuff to work. When switching to CW R4 I learned (the hard way) that the
C++ compiler does not include the Metrowerks' standard library (MSL).
Supposedly R5 does, but I wasn't patient enough to wait around, and ported
straight to R4.

A few questions still remain, though, which I try to sort out for myself
in the following few days;

- How to properly debug with POSE (I'll actually have to RTFM for this I
guess :).

- How to get the small icon done in CW (luckily a well discussed gotcha;
the information has scrolled past my eyes in the past few weeks, now I
just need to relocate it).

- Figure out the logic by which Constructor is capitalizing some of the
form object ID names and not others.

- Find if there's a decent IDE replacement for CW somewhere, or wait till
CW R6 is out. :) The R4 editor is in a word, hopeless.

All in all, I can recommend CW to others; getting GCC up and running in
the first place was definitely a bigger pain. R4 is not perfect, but it
works.


Cheers,

Jouni
--
Jouni Mannonen
SurRender3D.com

On Wed, 18 Aug 1999, Mandar Joshi wrote:

> 
> Try using FrmDrawForm() on frmOpenForm Event for the current active form.
> 
> 
> Mandar
> 
> Jouni Mannonen wrote:
> 
> > Having just converted a 3500+ line application from GCC to CodeWarrior R4
> > and re-doing all the forms with Constructor, I'm now facing a somewhat
> > obscure problem.
> >
> > The application installs correctly, with the proper icon and everything.
> > However, the first form appears blank, with the correct menu when I tap
> > the menu button. The menu does not do anything. The application does not
> > 'hang'; pressing the application button brings me back to the launcher.
> >
> > I use FrmGotoForm() to the first form (with correct ID) in my
> > StartApplication() code. I'm using C++, and I am not using any
> > standard library calls in the application. Link and compile
> > give no warnings at all.
> >
> > What gives? All ideas appreciated.
> >
> > Cheers,
> >
> > Jouni
> > --
> > Jouni Mannonen
> > SurRender3D.com
> 
> 

Reply via email to