You define pForm as the active form. Is it possible that the frmOpenEvent is meant for a non-active form? The form ID is within the event structure, if you want to check.
Tim "Tony Janke" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Does anyone know why frmOpenEvent is executed twice per form? Once when opened and again when closing. Maybe I shouldn't ask why, I do know that FrmGotoForm generates a frmOpenEvent and frmLoadEvent. My application, upon opening a form, initializes fields within the form by retrieving data from the bluetooth virtual serial port. The problem I am having is that this data is requested twice when it only needs to be once. Is there some other place I can put this function so that the ONLY time the data is retrieved is when the form is open? I have a temporary workaround by doing the following (where Refresh2 is a global variable that is set to TRUE in the previous form): static Boolean HardwareFormHandleEvent(EventType* pEvent) { Boolean handled = false; FormType* pForm = FrmGetActiveForm(); FieldType* FieldPtr; UInt32 numBytes = 0; Err err; if(Refresh2 == true) { WriteTextToField(GetDeviceName(), 1007); // Executed only ONCE if called from here Refresh2 = false; } switch (pEvent->eType) { case ctlSelectEvent: switch (pEvent->data.ctlSelect.controlID) { case 1005: // Edit Device Name FrmPopupForm(1702); Refresh = true; handled = true; break; case 1006: // Edit Pin # Refresh = true; FrmPopupForm(1703); handled = true; break; case 1004: // Upgrade Device Refresh = true; FrmPopupForm(1701); handled = true; break; case 1014: // Done FrmGotoForm(ModeForm); handled = true; break; default: break; } case frmOpenEvent: FrmDrawForm(pForm); handled = true; break; default: break; } return handled; } I realize there has to be a better solution than this. thanks, ~Tony -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
