Page 1 of 1

PostPosted: Thu Mar 22, 2007 4:11 pm
by Woofin
OK, I've got a mainForm that has a Gadget (displaying a rectangle) and a label. The mainForm has an onpenup() event handler that displays the pen coordinates in the label. I run it several times and it works as expected. So far so good.

Then I make some minor changes, say, in the gadget (e.g. changing the colour of the rectangle) and run it and the form no longer displays anything after loading. Anything that would change the appearance of the controls (gadgets, labels, etc) on the form have no effect. When I add an alert to the events I see that they're indeed being fired, but nothing refreshes on the form display.

I've been through this now several times - at least 5 to be exact. I create a project and start building it and everything works fine... then all of a sudden (at no particular point that I can discern) it'll stop updating the form display when running. It reacts to events and will display alerts, but it won't refresh/display/paint any controls.

I've recreated my project from scratch several times now, going carefully each time to be sure I'm not breaking anything. I can post code if it would help, but the problem seems to be something else... has anyone else ever encountered this or might be able to explain what the heck is happening? I'm going crazy trying to figure this out!

Ok, here's a sample from one of my mainForm's:
// mainform.oc

handler mainForm.onopen() {

handler btnA.onselect() {

handler gadMap.onpenup() {
lblStatus.text = "PenUp at " + event.x + "," + event.y;
gadSprite.gadget.visible = false;
gadSprite.gadget.x = event.x;
gadSprite.gadget.y = event.y;
gadSprite.gadget.visible = true;

This code may work if you try it - it did for me at first. Then it stopped working and I cannot make it work again. It just stops working, for no apparent reason. Any ideas/suggestions?

PostPosted: Thu Mar 22, 2007 6:04 pm
by Woofin
Here are the steps to recreate the problem (I think)... can someone please try it and let me know what happens?

1. Start the Palm Simulator
2. Run OrbForms
3. Create a new barebones project. I called mine "Test1".
4. Add a label to the form; call it "lblStatus"
5. Open mainForm.oc and code as follows:
// mainform.oc

handler mainForm.onopen() {

handler mainForm.onpenup() {
lblStatus.text = "Pen: " + event.x + "," + event.y;

6. Run the project. As you click on the running form you see the pentap location displayed. So far, so good.
7. Go back to OrbForms and insert a new gadget file called "gadTest1.oc".
8. Code the gadget as follows:
struct myGadget {
UIGadget gadget;

void onopen();
void ondraw();
void redraw();
Draw map;

void myGadget.onopen() {

void myGadget.ondraw() {

void myGadget.redraw() {
map.rect(0, 1, 1, map.nw, map.nh, 0);

9. Add a gadget to the form in the Form Designer and from the Gadget Type dropdown, select "myGadget".
10. Run the project again. In the Palm Simulator, click anywhere you like, including on or off the gadget... the lblStatus is never updated with the pen position. But if you add an alert to the onpenup() event you'll see that it does indeed fire. It just doesn't update the text.
11. Go back to OrbForms and remove the gadget from the form and rerun it, it runs fine again.

So... why does having the gadget on the form make the form display not work? Is it because the gadget is drawing in hi-res mode? There are no events attached to the gadget, and it is sized reasonably small (60w x 60h). What is the conflict?

PostPosted: Tue Apr 10, 2007 4:17 am
by dewey
I think was is more likely is that the pen event is not getting to the form when the gadget is on screen. The gadget will eat the pen events if you click within it. If you click outside it, the form SHOULD be getting events.