I'm having a frustrating time with a form at the moment. I'm using Carbide c/c++ 1.2 with s60 sdk 3rd edition fp1. I want a form in my application that records some info then does some stuff when the user presses 'Ok'.
I'm using Carbide c++ and I used the form template (add new S60 UI design -> choose 'form'). It adds a view and a form to the project.
In the autogenerated part of DoActivateL() of the view it creates the form, adds it to the control stack and displays it:
The problem is I'm getting a Cone 44 panic when the user presses either 'ok' or 'back' in the form. According to the docs this panic is thrown by the destructor of the form - CCoeControl - when it detects that it is being destructed but it is still in someone's control stack.
if ( iInfoForm == NULL )
CInfoForm* form = CInfoForm::NewL( this );
form->SetMopParent( this );
form->ExecuteLD( R_INFO_FORM_INFO_FORM );
AppUi()->AddToStackL( *this, form );
iInfoForm = form;
I don't want the app to exit when this form closes so in the ui designer I set 'exit application on close' to false.
There's an option in the designed called 'modeless' which according to the help says that if it's set to true then the form will not be added to the control stack. Regardless of the setting here (true or false) the form is always added to the control stack.
You know I'd refer to the form examples but I can't find any! I've looked in s60 3rd ed fp1 and s60 2nd ed and there's no mention of CAknForm in any of the examples. I've looked at the form article on the forum nokia wiki but it doesn't say anything about this particular problem.
My (probably ignorant) opinion is that forms always destroy themselves and should never be added to a control stack. Am I correct here? Any suggestions folks?
Oh and there's this cryptic carbide autogenerated comment in OkToExitL() of my form:
I wonder does anyone know what this magical code is?
// The 'exit application on close' property automatically adds code to exit the
// application when the right soft key is pressed. If this property is set to false,
// and AddToStackL has been called on the Form object (e.g., it was not shown as a dialog),
// code must be added manually to avoid a panic when exiting the application.