Hi,


I'm noticing some real differences between the Palm emulator (emulating a Palm Vx) and the real hardware.

The most obvious thing is that forms aren't drawn properly -- you see the previous form "through" the pop up form, as if the background of the form isn't being drawn before the new form is drawn over it. And some events seem to be in a different order, so I my application gets unexpected things happening and dies.

Works fine on the real thing, and on the OS 5 simulator.

I'm doing things in a slightly non-standard way. I'm writing the app in C++, and trying to avoid using globals and "proper" C++. PalmOS makes this hard.

In particular, I do not use FrmDispatchEvent(), but use FrmHandleEvent() directly, keeping track of which form is currently active so I can call the right event handler before resorting to FrmHandleEvent(). Since the Address Book application uses this technique for it's pop up window, I assume it's not too much of a bad thing.

Why no register handlers? Well, there's no way of telling which form the handler refers to without using a separate handler for each form. I can't see a way of passing in a pointer to this handler... the handler function obviously doesn't do one, and there's no "user area" I can use in the FormType. So I'd have to do FrmGetActiveForm and look it up in a static table to find the right object to handle it.


Calls... for every single form in the program, including the main form displayed when the app starts, I do this:


FrmPopupForm(FormID);
Event loop: Wait for frmLoadEvent
FrmInitForm(FormID);
FrmSetActiveForm(Form);

Then... if my app doesn't know the right handler to call for the currently open form, it calls

::FrmHandleEvent(::FrmGetActiveForm(), &event);

(but I call FrmDrawForm() and say I handled it for frmUpdateEvent and frmOpenEvent in all my form handlers)

To close the form, I do

FrmEraseForm(mForm);
FrmDeleteForm(mForm);


Is this a really bad way of doing things?


Thanks for any suggestions,

Ben





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

Reply via email to