Situation: I have an app (on the P900) that synchronizes data between the PDA and an external database. This app displays a dialog to allow the user to change settings. This dialog has two buttons: OK and Cancel (with the default IDs). The Cancel button is the default button. When the user presses the OK button, the synchronization process starts:
button_id = dlg->ExecuteLD(dialog_resource);
if ( button_id == EEikBidOk )
{
// Start the sync process
}
No problem so far. However, when the user switches to another application while the dialog is shown, the dialog returns with button id EEikBidOk. Which causes the synchronization process to start...
I tried redefining the HandleForegroundEventL method, and set a flag when the application goes to the background, and only start the sync process when the application is in the foreground, but apparently this method gets called after the dialog returns...
Is there a way to detect if the dialog returned because the user actually pressed a button, or because the application was switched to the background?
-- arno