×

Discussion Board

Results 1 to 15 of 15
  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    27

    Angry Forms NOT working

    Hi!

    I'm trying to develop a simple application that shows a form, but when i call form->ExecuteLD() my application crashes ("Application Closed")

    my .rss is defined as follows:
    Code:
    RESOURCE TBUF256 r_edit_prompt1
    {
    	buf = "Name";
    }
    
    RESOURCE DIALOG r_myform_form_dialog
    {
    	flags = EEikDialogFlagNoDrag | 
    			EEikDialogFlagFillAppClientRect |
    			EEikDialogFlagNoTitleBar |
    			EEikDialogFlagWait |
    			EEikDialogFlagCbaButtons;
    
    			
    	buttons = R_AVKON_SOFTKEYS_OPTIONS_BACK;
    	form = r_myform_form;	
    }
    
    // r_myform_form is defined as :
     
    RESOURCE FORM r_myform_form
    	{
    	flags = EEikFormEditModeOnly;
    	items =
    		{
    		DLG_LINE
    			{
    			type=EEikCtEdwin;
    			prompt=r_edit_prompt1;
    			id=EMyFormCtrlIdEdwin01; // defined in .hrh
    			control=EDWIN 
    				{
    				width=KMaxLength; 
    				maxlength=KMaxLength;
    				};
    			}
    		};
    	}
    .hrh
    Code:
    /* Copyright (c) 2004, Nokia. All rights reserved */
    
    #ifndef __GUICONTROLS_HRH__
    #define __GUICONTROLS_HRH__
    
    // GUIControls enumerate command codes
    enum TGUIControlsIds
        {
        EGUIControlsCommand1 = 1,  // start value must not be 0
        EGUIControlsShowForm1
        };
    
    enum TMyFormDialogControlIds
    {
        EMyFormCtrlIdEdwin01
    };
    
    #define KMaxLength 50
    
    #endif // __GUICONTROLS_HRH__
    the CMyForm class:
    (cpp)

    Code:
    #include "CMyForm.h"
    #include <avkon.rsg>// R_AVKON_FORM_MENUPANE
    #include <avkon.hrh> // Commands
    #include <eikedwin.h> // CEikEdwin
    #include <eikmenup.h> // CEikMenuPane
    
    CMyForm::CMyForm()
    {
    }
    
    CMyForm::~CMyForm()
    {
    }
    
    void CMyForm::ConstructL()
    {
    	CAknForm::ConstructL();
    }
    
    CMyForm *CMyForm::NewL()
    {
    	CMyForm *self = new (ELeave) CMyForm;
    	CleanupStack::PushL(self);
    	self->ConstructL();
        CleanupStack::Pop();
    
    	return self;
    }
    
    
    TBool CMyForm::SaveFormDataL()
    {	
    	CEikEdwin* nameEditor = static_cast <CEikEdwin*> (ControlOrNull(EMyFormCtrlIdEdwin01));
    	if (nameEditor)
    	{
    		HBufC* name = nameEditor->GetTextInHBufL();
    		if (name)
    		{
    			// public: TBuf<KMaxLength> text1;
    			text1.Copy((const TDesC &)name);
    		
    			delete name;
    		}
    	}
    
    	return ETrue;
    }
    
    void CMyForm::LoadFormValuesFromDataL()
    {	
    	CEikEdwin* nameEditor = static_cast <CEikEdwin*> (ControlOrNull(EMyFormCtrlIdEdwin01));
    	if (nameEditor)
    	{
    		HBufC* name = text1.AllocLC();
    		nameEditor->SetTextL(name);
    		CleanupStack::PopAndDestroy(name);
    	}
    }
    
    
    void CMyForm::DoNotSaveFormDataL()
    {
    	LoadFormValuesFromDataL();
    }
    
    
    void CMyForm::PreLayoutDynInitL()
    {
    	CAknForm::PreLayoutDynInitL();
    	LoadFormValuesFromDataL();
    }
    
    
    void CMyForm::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
    {
    	CAknForm::DynInitMenuPaneL(aResourceId,aMenuPane);
    	
    	if (aResourceId == R_AVKON_FORM_MENUPANE)
    	{
    		aMenuPane->SetItemDimmed(EAknFormCmdLabel, ETrue);
    		aMenuPane->SetItemDimmed(EAknFormCmdAdd, ETrue);
    		aMenuPane->SetItemDimmed(EAknFormCmdDelete, ETrue);
    	}
    }
    in appui.cpp
    Code:
    void CGUIControlsAppUi::HandleCommandL( TInt aCommand )
    {
        switch( aCommand )
        {
            [...] // Omitted for clarity
            case EGUIControlsShowForm1:
        	{
            		CMyForm *theForm = CMyForm::NewL();
            		TInt ret = theForm->ExecuteLD(R_MYFORM_FORM_DIALOG);
            		delete theForm;
            		
            		//TInt ret = iAppView->theForm->ExecuteLD(R_MYFORM_FORM_DIALOG);        	
        	}
        	break;
        	
            default:
                Panic( EGUIControlsUi );
                break;
        }
    }
    Where i'm wronging?
    The emulator just crashes.

    Thanks in advance
    P.S: I'm using Carbide V1.3 with s60_2nd_fp3 sdk

  2. #2
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: Forms NOT working

    try to get the panic, if emulator itself crashes, then try on device and get the panic number !

    how to see panic ? see wiki
    Amit Kankani
    Nokia Developer Champion

  3. #3
    Regular Contributor
    Join Date
    Feb 2006
    Location
    India,Pune
    Posts
    311

    Re: Forms NOT working

    Quote Originally Posted by XDnl View Post
    Hi!

    .......The emulator just crashes.

    Thanks in advance
    P.S: I'm using Carbide V1.3 with s60_2nd_fp3 sdk
    Please observe the error code and
    Observe its reason on this

    Regards,
    Parag Purkar

  4. #4
    Registered User
    Join Date
    Jun 2008
    Posts
    27

    Re: Forms NOT working

    Quote Originally Posted by amitkankani View Post
    try to get the panic, if emulator itself crashes, then try on device and get the panic number !

    how to see panic ? see wiki
    Hi to all, thanks for reply.


    I tried what you suggested and i got the following panic code:

    EMULATOR: EIKON-DIALOG 3

    After that, I've maked the .sis (THUMB) and i've installed it on my N70 (memory card)... well, when i select "Show the form"... it just works!!! I can see (and edit too) and editbox...

    How the hell is possible?!?! I'm getting even more confused...


    P.S: I've noticed that when the form is showed, if i choose "back" (right softkey) or "save" (Options->Save) my application closes, but without any panic code (no messages are displayed)...

    Please observe the error code and
    Observe its reason on this
    mmmh... i got "EIKON-DIALOG 3" so the code is 3, right?
    KErrCancel -3 The operation was cancelled

  5. #5
    Regular Contributor
    Join Date
    Feb 2006
    Location
    India,Pune
    Posts
    311

    Re: Forms NOT working

    If it is related with "EIKON-DIALOG 3" then Use different offsets in your .hrh file
    e.g
    enum TGame
    {
    EChess,
    ECricket,
    EFootball
    };


    use it as ..

    enum TGame
    {
    EChess = 0x8000,
    ECricket,
    EFootball
    };

    I have faced this type of problem longback ...lets try it!!!

    All the best!!!

    Regards,
    Parag Purkar



    Regards,
    Parag Purkar

  6. #6
    Registered User
    Join Date
    Jun 2008
    Posts
    27

    Re: Forms NOT working

    Quote Originally Posted by parag_purkar View Post
    If it is related with "EIKON-DIALOG 3" then Use different offsets in your .hrh file
    I've modified the .hrh as follows:
    Code:
    /* Copyright (c) 2004, Nokia. All rights reserved */
    
    #ifndef __GUICONTROLS_HRH__
    #define __GUICONTROLS_HRH__
    
    // GUIControls enumerate command codes
    enum TGUIControlsIds
        {
        EGUIControlsCommand1 = 1,  // start value must not be 0
        EGUIControlsShowForm1
        };
    
    enum TMyFormDialogControlIds
    {
        EMyFormCtrlIdEdwin01 = 0x8000
    };
    
    #define KMaxLength 50
    
    #endif // __GUICONTROLS_HRH__
    Now i get: "CdlEng 7"
    which corresponds to: KErrTotalLossOfPrecision -7 This error arises when converting from an internal 96-bit real representation to a TReal32; the exponent of the internal representation is so small that the 32-bit real cannot contain it. ???

    p.s. i've tried several numbers (such as 0x60, etc...) but i get the same error :(
    p.s.2: I googled for "CdlEng 7" and I read that this problem occours only in 176x208, but not in 240x320 or 352x416... i've tried this and it's true... my application doesn't panic on 240x320 or 352x416... could this be a bug of nokia's library??
    Last edited by XDnl; 2008-07-09 at 13:44.

  7. #7
    Nokia Developer Champion
    Join Date
    Oct 2006
    Location
    Bangalore, India
    Posts
    1,572

    Re: Forms NOT working

    mmmh... i got "EIKON-DIALOG 3" so the code is 3, right?
    KErrCancel -3 The operation was cancelled
    no error code is not 3, but "EIKON-DIALOG 3"
    There are many categories of errors and here it is EIKON-DIALOG's 3 error code...

    so it is not KerrCancel but "EIKON-DIALOG 3"
    Amit Kankani
    Nokia Developer Champion

  8. #8
    Regular Contributor
    Join Date
    Feb 2006
    Location
    India,Pune
    Posts
    311

    Re: Forms NOT working

    Hi Xdnl ,

    Below is the link for CdlEng 7

    Search on form Link


    Regards,
    Parag

  9. #9
    Registered User
    Join Date
    Jun 2008
    Posts
    27

    Re: Forms NOT working

    Thanks for your help... i think there's nothing much to do... it's an internal bug... however i still can run my app with an higher resolution... now i have some questions:

    In my sourcecode:
    Code:
    {
        switch( aCommand )
        {
            [...] // Omitted for clarity
            case EGUIControlsShowForm1:
        	{
            	// If i always create a new instance of the  form, the information
                    // about the editbox (CMyForm::text1) is  lost...  why the 
                    // examples do this?
                    CMyForm *theForm = CMyForm::NewL();
                    TInt ret = theForm->ExecuteLD(R_MYFORM_FORM_DIALOG);
    
                    // Should I delete the form?
                    // If i do it, my app crashes "KERN-EXEC 3" (when I press back and without saving)
                    // But if i don't do it, there is a memory leak, right?
                    // Maybe i must add something into the destructor?
                    delete theForm;
        	}
        	break;
        	
            default:
                Panic( EGUIControlsUi );
                break;
        }
    }
    I tried to don't allocate and destroy the form for each call, but this way, my application crashes at the second time i open the form...
    Last edited by XDnl; 2008-07-09 at 14:48.

  10. #10
    Registered User
    Join Date
    Jun 2008
    Posts
    27

    Re: Forms NOT working

    I don't know why, but my browser doesn't show my post correctly, so i post it again:

    Thanks for your help... i think there's nothing much to do... it's an internal bug... however i still can run my app with an higher resolution... now i have some questions:

    In my sourcecode:
    Code:
    {
        switch( aCommand )
        {
            [...] // Omitted for clarity
            case EGUIControlsShowForm1:
        	{
            	// If i always create a new instance of the  form, the information
                    // about the editbox (CMyForm::text1) is  lost...  why the 
                    // examples do this?
                    CMyForm *theForm = CMyForm::NewL();
                    TInt ret = theForm->ExecuteLD(R_MYFORM_FORM_DIALOG);
    
                    // Should I delete the form?
                    // If i do it, my app crashes "KERN-EXEC 3" (when I press back and without saving)
                    // But if i don't do it, there is a memory leak, right?
                    // Maybe i must add something into the destructor?
                    delete theForm;
        	}
        	break;
        	
            default:
                Panic( EGUIControlsUi );
                break;
        }
    }
    I tried to don't allocate and destroy the form for each call, but this way, my application crashes at the second time i open the form (KERN-EXEC 3)...

  11. #11
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,694

    Re: Forms NOT working

    You should not delete the form, ExecuteLD deletes the object itself.
    Note that every Symbian SDK contains a section called "Essential idioms", it is not too long, and it really contains useful stuff (for example naming conventions).
    You can either search for it (you can include the quotes too), or directly navigate to it: usually "Symbian OS x.y / Symbian OS guide / Essential idioms" is its path in the SDK Help.

    And a tip for forms: you can test your form resource via using CAknForm directly. After the resource works, you can start implementing the class.

  12. #12
    Registered User
    Join Date
    Jun 2008
    Posts
    27

    Re: Forms NOT working

    Quote Originally Posted by wizard_hu_ View Post
    You should not delete the form, ExecuteLD deletes the object itself.
    Ok, but there is a thing that i don't understand: in the example
    C:\Symbian\8.1a\S60_2nd_FP3\Series60Ex\form, the class aknexformsaveform have many TBufs which are used to store data when the form is closed... if the ExecuteLD() function destroys the form each time, that variables will be lost too, right? In aknexformview.cpp there is a normal ExecuteLD() call... I've found another example that stores data in another class, external to the form... i think this is more logical... but i wonder why the form example use that technique... it shouldn't work...
    edit: I've tried the form example and it just doesn't save data :P... i think i've understood now...

    Quote Originally Posted by wizard_hu_ View Post
    Note that every Symbian SDK contains a section called "Essential idioms", it is not too long, and it really contains useful stuff (for example naming conventions).
    You can either search for it (you can include the quotes too), or directly navigate to it: usually "Symbian OS x.y / Symbian OS guide / Essential idioms" is its path in the SDK Help.
    I didn't know this.. i'll read that section...

    Quote Originally Posted by wizard_hu_ View Post
    And a tip for forms: you can test your form resource via using CAknForm directly. After the resource works, you can start implementing the class.
    I don't understand. What do you mean with "you can test your form resource via using CAknForm directly."??
    I'm sorry but i'm a beginner with Symbian...

    Thanks
    Last edited by XDnl; 2008-07-09 at 21:45.

  13. #13
    Regular Contributor
    Join Date
    Mar 2007
    Location
    "On a b'ful lil palnet called EARTH belongs wid Galaxy named MilkyWay in Universe"
    Posts
    402

    Post Re: Forms NOT working

    Well.. I am not sure.. But Emulator Screen size also creates crash problem sometime. In 2nd Edition FP3 240x320 have some issue with Form, try to check in 176x208,,,,
    ===With Symbian===
    "Something Has Survived..!!!"

  14. #14
    Registered User
    Join Date
    Jun 2008
    Posts
    27

    Re: Forms NOT working

    Quote Originally Posted by Nitin SuperByte View Post
    Well.. I am not sure.. But Emulator Screen size also creates crash problem sometime. In 2nd Edition FP3 240x320 have some issue with Form, try to check in 176x208,,,,
    yes... emulator have problems with forms (application panics), but at 176x208... i have solved this problem simply changin' the resolution...

    wizard_hu_: I think you mean that isn't necessary to implement Save/Load routines until resource works, right?

    I've resolved all problems, now... thanks to all for helping me!

  15. #15
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,345

    Smile Re: Forms NOT working

    It is good that you made it working, you can also check this Wiki article: Forms in Symbian C++

    Kiran.
    Nokia Developer Wiki Moderation team

Similar Threads

  1. work with forms data at form run time
    By palple in forum Symbian
    Replies: 1
    Last Post: 2008-04-03, 04:32
  2. FindControl Inside FORMS in Resource.
    By cleanupstack in forum Symbian User Interface
    Replies: 1
    Last Post: 2008-02-17, 14:47
  3. series 40 problem with forms and httpconnection
    By sakura7 in forum Mobile Java General
    Replies: 4
    Last Post: 2007-06-27, 11:46
  4. problem with Views and Forms.
    By abhicreation in forum Symbian User Interface
    Replies: 3
    Last Post: 2007-05-24, 11:48
  5. Replies: 2
    Last Post: 2006-03-11, 09:29

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×