Such a simple solution eluded me. Thank you very much for all the help! ~Tony
>>> [EMAIL PROTECTED] 4/15/2005 5:38:04 AM >>> If I understand this, you're saying frmOpenEvent is called twice, but the second time with the formID 1800 (as opposed to 1700 the first time), right? So why can't you check the formID, and only if it's 1700, do the initialization? The code to initialize a form should go in in the frmOpenEvent response. If you want to use separate event handler for each form, you may have to use something other than FrmGotoForm--not sure on this one. What happens if you set the event handler of the new form to a different reoutine directly after the FrmGotoForm line? Does the first reoutine still recieve frmOpenEvent but with formID = 1800? Tim "Tony Janke" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Tim- The frmOpenEvent inside HardwareFormHandleEvent is to open a specific form (in this case 1700). This form is the active form when called from the previous form so open event works correctly. The problem is that when you call frmGotoForm, it changes the active form to the next in line (say 1800 for example). So when you call frmOpenEvent again, the line of code executing FrmDrawForm(pForm) will draw the next form (1800) instead of 1700, but it also executes any command inside the case frmOpenEvent:. When you execute FrmGotoForm, is there a way to ONLY close the current form without executing frmOepenEvent in the same event handler? Maybe it would be simpler to pose this question: If I want to perform some action ONLY 1 time on 1 form, where would I put the function call? In my if(Refresh2 == true) loop, in frmOpenEvent, or ????? thanks, ~Tony >>> [EMAIL PROTECTED] 4/14/2005 11:33 AM >>> 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/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/ -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
