×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Jul 2008
    Posts
    11

    Angry SettingPage()->ExecuteLD () TERMINATES

    Dear All,
    I am trying to catch the "OK" or "Cancel" pressed events on a "CAknTextSettingPage"

    My application crashes as soon as it executes the
    SettingPage()->ExecuteLD ();


    I am not able to figure out the mistake.

    Can anyone help me please?
    Is there any other alternative ?

    You can find my .CPP and .H source code at the end of the mail.

    Is the following process correct ?

    1)I have derived a CMYtextsettingItem from CAknTextSettingItem and implemented its HandleSettingPageEventL () and EditItemL() functions.

    2)
    Code:
    CMYtextsettingItem::EditItemL()
    {
    CAknTextSettingPage* settPage = new (ELeave) CAknTextSettingPage( myIdentifier, iSettings.Edit1() );
            	    CleanupStack::PushL( settPage );
            	    SetSettingPage( settPage );
            	    SettingPage()->SetSettingPageObserver( this );
            	    SetUpStandardSettingPageL();
            	    SettingPage()->SetSettingTextL(SettingName());
            	    CleanupStack::Pop( settPage );
            //TERMINATES AS WHEN IT EXECUTES THE BELOW STATEMENT
            	    SettingPage()->ExecuteLD ();
            	    SetSettingPage( 0 );
    }
    3)
    Code:
    void  CMYtextsettingItem::HandleSettingPageEventL (CAknSettingPage *aSettingPage, TAknSettingPageEvent aEventType)
       	 {
       	 if (aEventType == EEventSettingOked)
       	         {
       	         //Handle  OK pressed here 
       	         }  
          }
    4) The derived calss CMYtextsettingItem is added to COSettingItemList in CreateSettingItemL() where COSettingItemList is derived from CAknSettingItemList

    Code:
    CAknSettingItem* COSettingItemList::CreateSettingItemL( TInt aId )
    	{
    	switch ( aId )
    		{
    	
    		case EOSettingItemListViewEdit1:
    			{
    			item = new CMYtextsettingItem( iSettings,aId, iSettings.Edit1() );
    			item->SetEmptyItemTextL( _L("any") );
    			return item;
    			}
    	
    		}
    	return NULL;
    	}
    SOURCE CODE


    COSettingItemList.CPP


    Code:
    / Constructor
    COSettingItemList::COSettingItemList( 
    		TOSettingItemListSettings& aSettings, 
    		MEikCommandObserver* aCommandObserver )
    	: iSettings( aSettings ), iCommandObserver( aCommandObserver )
    	{
    	
    	}
    /** 
     * Destroy any instance variables
     */
    COSettingItemList::~COSettingItemList()
    	{
    	}
    
    /**
     * Handle system notification that the container's size has changed.
     */
    void COSettingItemList::SizeChanged()
    	{
    	if ( ListBox() ) 
    		{
    		ListBox()->SetRect( Rect() );
    		}
    	}
    
    /**
     * Create one setting item
     */
    CAknSettingItem* COSettingItemList::CreateSettingItemL( TInt aId )
    	{
    	switch ( aId )
    		{
    	
    		case EOSettingItemListViewEdit1:
    			{
    			item = new CMYtextsettingItem( iSettings,aId, iSettings.Edit1() );
    			item->SetEmptyItemTextL( _L("any") );
    			return item;
    			}
    	
    		}
    	return NULL;
    	}
    	
    /**
     * Edit the setting item 
     */
    void COSettingItemList::EditItemL ( TInt aIndex, TBool aCalledFromMenu )
    	{
    	CAknSettingItem* item = ( *SettingItemArray() )[aIndex];
    	switch ( item->Identifier() )
    		{
    		}
    	
    	CAknSettingItemList::EditItemL( aIndex, aCalledFromMenu );
    	
    	TBool storeValue = ETrue;
    	switch ( item->Identifier() )
    		{
    		}
    		
    	if ( storeValue )
    		{
    		item->StoreL();
    		SaveSettingValuesL();
    		}	
    	}
    /**
     *	Handle the "Change" option on the Options menu. 
     *  */
    void COSettingItemList::ChangeSelectedItemL()
    	{
    	if ( ListBox()->CurrentItemIndex() >= 0 )
    		{
    		EditItemL( ListBox()->CurrentItemIndex(), ETrue );
    		}
    	}
    
    /**
     *	Load the initial contents of the setting items.
     */
    void COSettingItemList::LoadSettingValuesL()
    	{
    	}
    	
    /**
     *	Save the contents of the setting items.  
     */
    void COSettingItemList::SaveSettingValuesL()
    	{
    	
    	}
    /** 
     * Handle global resource changes, such as scalable UI or skin events (override)
     */
    void COSettingItemList::HandleResourceChange( TInt aType )
    	{
    	CAknSettingItemList::HandleResourceChange( aType );
    	SetRect( iAvkonViewAppUi->View( TUid::Uid( EOSettingItemListViewId ) )->ClientRect() );
    	
    	}
    				
    /** 
     * Handle key event (override)
     */
    TKeyResponse COSettingItemList::OfferKeyEventL( 
    		const TKeyEvent& aKeyEvent, 
    		TEventCode aType )
    	{
    	
    	if ( aKeyEvent.iCode == EKeyLeftArrow 
    		|| aKeyEvent.iCode == EKeyRightArrow )
    		{
    		return EKeyWasNotConsumed;
    		}
    	
    	return CAknSettingItemList::OfferKeyEventL( aKeyEvent, aType );
    	}
    				
    CMYtextsettingItem::CMYtextsettingItem( TOSettingItemListSettings& aSettings, TInt Identifier, TDes&  aText):
    							iSettings( aSettings ),
    							CAknTextSettingItem( Identifier,aText ), myIdentifier(Identifier)
    	    {
    	   
    	    }
    
    
    CMYtextsettingItem::~CMYtextsettingItem()
        	{
    	
        	}
    
    void CMYtextsettingItem::EditItemL(TBool aCalledFromMenu)
            {	
            CAknTextSettingPage* settPage = new (ELeave) CAknTextSettingPage( myIdentifier, iSettings.Edit1() );
            	    CleanupStack::PushL( settPage );
            	    SetSettingPage( settPage );
            	    SettingPage()->SetSettingPageObserver( this );
            	    SetUpStandardSettingPageL();
            	    SettingPage()->SetSettingTextL(SettingName());
            	    CleanupStack::Pop( settPage );
            	    // SettingPage()->ExecuteLD ();
            	    CAknSettingPage *  stgpage = SettingPage();
            	    TBool accepted =stgpage->ExecuteLD ();
            	    SetSettingPage( 0 );
            }
    
    void  CMYtextsettingItem::HandleSettingPageEventL (CAknSettingPage *aSettingPage, TAknSettingPageEvent aEventType)
       	 {
       	 if (aEventType == EEventSettingOked)
       	         {
       	         //Handle  OK pressed here 
       	         }  
          }
    Code:
    
    


    COSettingItemList.H file

    Code:
    class COSettingItemList : public CAknSettingItemList
    	{
    public:
    
    	COSettingItemList( 
    			TOSettingItemListSettings& settings, 
    			MEikCommandObserver* aCommandObserver );
    	virtual ~COSettingItemList();
    
    public:
    
    	// from CCoeControl
    	void HandleResourceChange( TInt aType );
    
    	// overrides of CAknSettingItemList
    	CAknSettingItem* CreateSettingItemL( TInt id );
    	void EditItemL( TInt aIndex, TBool aCalledFromMenu );
    	TKeyResponse OfferKeyEventL( 
    			const TKeyEvent& aKeyEvent, 
    			TEventCode aType );
    	
    public:
    	// utility function for menu
    	void ChangeSelectedItemL();
    
    	void LoadSettingValuesL();
    	void SaveSettingValuesL();
    	CMYtextsettingItem* item;
    private:
    	// override of CAknSettingItemList
    	void SizeChanged();
    
    private:
    	// current settings values
    	TOSettingItemListSettings& iSettings;
    	MEikCommandObserver* iCommandObserver;
    
    protected: 
    	
    	};
    
    class CMYtextsettingItem : public CAknTextSettingItem
    	{
    	public:
    
    	CMYtextsettingItem( TOSettingItemListSettings& aSettings, TInt Identifier, TDes&  aText);
        ~CMYtextsettingItem();
        	
         void  HandleSettingPageEventL (CAknSettingPage *aSettingPage, TAknSettingPageEvent aEventType);
        	
         TOSettingItemListSettings& iSettings;
         TInt myIdentifier;
    	protected:
    		void EditItemL( TBool aCalledFromMenu );
    		
    	};
    Code:
    
    
    Last edited by AS_r; 2008-07-01 at 01:59.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: SettingPage()->ExecuteLD () TERMINATES


  3. #3
    Registered User
    Join Date
    Jul 2008
    Posts
    11

    Re: SettingPage()->ExecuteLD () TERMINATES

    Hi wizard_hu_

    Sorry for that . I thought two are separate listings.

    Thanks for informing me .

  4. #4
    Registered User
    Join Date
    Jul 2008
    Posts
    11

    Re: SettingPage()->ExecuteLD () TERMINATES

    Hi all,

    I have a derived mytxtsettingItem class from CAknTextSettingItem for which I want to set the setting page .

    But I dont know from where I can call my page setting mytextsetttingpage function .I am using it to set pages to CAknTextSettingItem.

    In Dynamic Setting example which is provided with the SDK the
    CreateAndExecuteSettingPageL() is called by the framework for settting the CAknSliderSettingItem page.



    I want to know from where I can call the page setting function for "CAknTextSettingItem"




    I tried to call it from mytxtsettingItem::EditItemL() it gives BAFL 4 ERROR and terminates.

    Can anyone help me please!!!


    Code:
    mytextsetttingpage()
    {
    CAknTextSettingPage* dlg = new (ELeave) CAknTextSettingPage( aResourceID, aText );
    
    	SetSettingPage( dlg );
    	SettingPage()->SetSettingPageObserver(this);
    	SettingPage()->SetSettingTextL(SettingName());
         SettingPage()->ExecuteLD(CAknSettingPage::EUpdateWhenChanged);
    	SetSettingPage(0);
    
    }
    Thanks

  5. #5
    Regular Contributor
    Join Date
    Aug 2006
    Posts
    182

    SettingPage()->ExecuteLD () TERMINATES

    SDK says: "This panic is raised by the Read...() member functions and the Advance() member function of TResourceReader, when the current position in the resource buffer is moved beyond the end of the buffer."

    So re-build the resource file and see if it helps.

  6. #6
    Registered User
    Join Date
    Jul 2004
    Posts
    93

    Thumbs up Re: SettingPage()->ExecuteLD () TERMINATES

    SOLUTION!

    Everyone, this problem happens to all both my application and the settings page example (come with S60 3rd Ed FP2 Beta SDK). I look at all my applications done so far and found one with Slider but does not crash. Here is the differences and reason:

    1. I extended the slider class to create my own slider setting item.
    2. my extended slider class has override SettingTextL() and CreateBitmapL()
    3. CreateBitmapL() returns NULL. SettingTextL() return a customized text. So the settings page does not show a slider but my text. It is exactly same as Settings > General > Personalisation > Display > Power saver time-out

    Tested and verify that:

    1. add default slider, on exit, show "Application closed: [AppName] ALLOC: [memory address]". without slider, it's peaceful
    2. use extended slider, override CreateBitmapL() and return NULL. it's peaceful. override CreateBitmapL() but return CAknSliderSettingItem::CreateBitmapL(), same message

    Solution:

    1. MUST extend the default slider.
    2a. either UI use text (when the settings item is not actived), or
    2b. your class copy the bitmap address and delete it manually (untested because I don't know any variable to remember the bitmap, nor i count how many times "CreateBitmapL()" has called).

    Concern:

    1. I expected that CreateBitmapL() is not called once but everytime users change the value, plus everytime the screen resolution and them changed
    2. other side effect?

    Anyone with further findings please post and reply to this thread. Thanks a lot.


    Luke

Similar Threads

  1. No Panic is shown, program just terminates
    By mg_at_uni in forum Symbian
    Replies: 6
    Last Post: 2008-03-27, 12:45
  2. Replies: 3
    Last Post: 2008-02-17, 21:05
  3. Related to SettingPage
    By SymbianLover2007 in forum Symbian
    Replies: 2
    Last Post: 2007-09-03, 12:05
  4. Ringtone play terminates unexpectedly
    By skaran76 in forum Smart Messaging
    Replies: 2
    Last Post: 2006-11-02, 16:23
  5. RCall::HangUp terminates the app
    By lilovss in forum Symbian
    Replies: 1
    Last Post: 2005-07-14, 14:21

Posting Permissions

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