×

Discussion Board

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

    Question TOTALY LOST can one help me in finding the bug PLEASE

    Hi All,

    I have changed the DynamicSettingList example which is provided with SDK.
    In the example CAknSliderSettingItem is drived and slider setting page is set and excuted .


    I am doing a similar thing for CAknTextSettingItem to set and execute CAknTextSettingPage.
    It gives
    BAFL 4 ERROR when it executes the following statment.
    SettingPage()->ExecuteLD(CAknSettingPage::EUpdateWhenChanged);

    Documentation says that

    BAFL 4 " 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."


    But I cannot find any mistake in my source code .I am pasting the code below.
    I tried my best to find the bug , but couldnt get it.


    To execute the following code ,please replace the given files in the DynamicSettingList example of the SDK


    DynamicSettingListSlider.h
    Code:
    #include <aknsettingitemlist.h> 
    
    class CDynamicSettingListText : public CAknTextSettingItem
    	{
    public: // Constructor
    
    	CDynamicSettingListText(TInt aIdentifier, TDes &aText);
    
    	      //From base class
    	 void  HandleSettingPageEventL (CAknSettingPage *aSettingPage, TAknSettingPageEvent aEventType); 
    
    	 void EditItemL (TBool aCalledFromMenu);
    
               //To create and set page 
    	 void  MycreateAndExecuteSettxtpagL(TInt aResourceID, TDes &aText);
    	 
    	 TInt myIdentifier;
    	};
    DynamicSettingListSlider.cpp
    Code:
    #include "DynamicSettingListSlider.h"
    #include <akntextsettingpage.h> 
    
    //temp-need to remove this global.
    LIT(KTxtHelloWorld, "He");
    TBuf<8> tbufc(KTxtHelloWorld);
    
    // Constructor
    CDynamicSettingListText::CDynamicSettingListText(TInt aIdentifier, TDes &aText)
    		:CAknTextSettingItem( myIdentifier,aText ),myIdentifier(aIdentifier)
    			{
    			}
    _
    
    void CDynamicSettingListText::MycreateAndExecuteSettxtpagL(TInt aResourceID, TDes &aText)
    	{
    	CAknTextSettingPage* dlg = new (ELeave) CAknTextSettingPage( aResourceID, tbufc );
    
    	SetSettingPage( dlg );
    	SettingPage()->SetSettingPageObserver(this);
    	SettingPage()->SetSettingTextL(SettingName());
    	
    	//It gives BAFL 4 ERROR after exeuting this statment
      	SettingPage()->ExecuteLD(CAknSettingPage::EUpdateWhenChanged);
      	
    	SetSettingPage(0);
    	}
    
    void CDynamicSettingListText::HandleSettingPageEventL (CAknSettingPage *aSettingPage, TAknSettingPageEvent aEventType)
    	{
    	if (aEventType == EEventSettingOked)
    	   	         {//Handle  OK pressed 
    	   	         } 
    	}
    
    void   CDynamicSettingListText::EditItemL (TBool aCalledFromMenu) 
    	{
    	 MycreateAndExecuteSettxtpagL(myIdentifier, tbufc);
    	}


    DynamicSettingList.rss
    Code:
    NAME DYSE
    
    // INCLUDE FILES
    #include <eikon.rh>
    #include <eikon.rsg>
    #include <avkon.rh>
    #include <avkon.rsg>
    #include "DynamicSettingList.hrh"
    #ifdef EKA2
    #include <appinfo.rh>
    #endif
    
    //    Define the resource file signature 
    RESOURCE RSS_SIGNATURE { }
    
     //    Default Document Name
    RESOURCE TBUF r_default_document_name { buf=""; }
    
    //    Define default menu and CBA key.
    RESOURCE EIK_APP_INFO
        {
        menubar = r_dynamicsettinglist_menubar;
        cba = R_AVKON_SOFTKEYS_OPTIONS_EXIT;
        }
    
    #ifdef EKA2
    
    // r_internetemail_localisable_app_info
    RESOURCE LOCALISABLE_APP_INFO r_internetemail_localisable_app_info
    {
    	short_caption = "DynSetList";
    	caption_and_icon =
    	CAPTION_AND_ICON_INFO
    		{
    		caption = "DynamicSettingList";
    		};
    }
    #endif
    
      
    //   r_dynamicsettinglist_menubar
    //   Menubar for DynamicSettingList example
    RESOURCE MENU_BAR r_dynamicsettinglist_menubar
        {
        titles =
            {
            MENU_TITLE {menu_pane = r_dynamicsettinglist_menu;}
            };
        }
    
    //   r_dynamicsettinglist_menu
    //   Menu for "Options"
    RESOURCE MENU_PANE r_dynamicsettinglist_menu
        {
        items = 
            {
            MENU_ITEM {command = EAknSoftkeyExit;   txt = "Exit";}
            };
        }
    
    //   SETTING ITEM LIST
    RESOURCE AVKON_SETTING_ITEM_LIST r_entry_settings_list
    	{
    	title = "Example";
    	}
    	
    //   TEXT SETTING PAGE
    RESOURCE AVKON_SETTING_PAGE r_text_setting_page
        {
        type = EEikCtEdwin;
        editor_resource_id = r_name_edwin;
        }
        
    RESOURCE EDWIN r_name_edwin
        {
        width = 10;
        maxlength = KMaxTextLength;
        }
    
    //   TEXT SETTING PAGE
    RESOURCE AVKON_SETTING_PAGE r_text_setting_page2
        {
        type = EEikCtEdwin;
        editor_resource_id = r_name_edwin2;
        }
        
    RESOURCE EDWIN r_name_edwin2
        {
        width = 10;
        maxlength = KMaxTextLength;
        }

    DynamicSettingListAppview.cpp

    Code:
    // INCLUDE FILES
    #include <coemain.h>
    #include <DynamicSettingList.rsg>
    #include "DynamicSettingList.hrh"
    #include "DynamicSettingListAppView.h"
    #include "DynamicSettingListSlider.h"
    #include <eikfrlbd.h>
    
    // CONSTANTS
    _LIT(KEmptyText, "None");
    _LIT(KName, "Text");
    _LIT(KName5, "MYTEXT");
    
    // ================= MEMBER FUNCTIONS =======================
    // Constructor
    CDynamicSettingListAppView::CDynamicSettingListAppView()
        : iVolume(KDefaultVolume), iIp(KDefaultIp, KDefaultIpPort)
        {
        iDate.HomeTime();
        }
    
    // Destructor
    CDynamicSettingListAppView::~CDynamicSettingListAppView()
        {
        delete iItemList;
        }
    
    // ----------------------------------------------------
    // CDynamicSettingListAppView::ConstructL()
    void CDynamicSettingListAppView::ConstructL(const TRect& aRect)
        {
        // Create a window for this application view
        CreateWindowL();
    
        iItemList = new (ELeave) CAknSettingItemList;
        iItemList->SetMopParent(this);
        iItemList->ConstructFromResourceL(R_ENTRY_SETTINGS_LIST);
    
        LoadListL();
    
        iItemList->MakeVisible(ETrue);
        iItemList->SetRect(aRect);
        iItemList->ActivateL();
        iItemList->ListBox()->UpdateScrollBarsL();
        iItemList->DrawNow();
    
        // Set the windows size
        SetRect(aRect);
    
        // Activate the window, which makes it ready to be drawn
        ActivateL();
        }
    
    // ----------------------------------------------------
    // CDynamicSettingListAppView::Draw()
    void CDynamicSettingListAppView::Draw(const TRect& /*aRect*/) const
        {
        // Get the standard graphics context
        CWindowGc& gc = SystemGc();
    
        // Gets the control's extent
        TRect rect = Rect();
    
        // Clears the screen
        gc.Clear(rect);
        }
    
    // ----------------------------------------------------
    // CDynamicSettingListAppView::CountComponentControls()
    TInt CDynamicSettingListAppView::CountComponentControls() const
        {
        TInt count = 0;
        if (iItemList)
            count++;
        return count;
        }
    
    // ----------------------------------------------------
    // CDynamicSettingListAppView::ComponentControl()
    CCoeControl* CDynamicSettingListAppView::ComponentControl(TInt /*aIndex*/) const
        {
        return iItemList;
        }
    
    // ----------------------------------------------------
    // CDynamicSettingListAppView::OfferKeyEventL()
    TKeyResponse CDynamicSettingListAppView::OfferKeyEventL(    const TKeyEvent& aKeyEvent,
                                                                    TEventCode aType )
        {
        if(aType != EEventKey)
            {
            return EKeyWasNotConsumed;
            }
        else if(iItemList)
            {
            return iItemList->OfferKeyEventL( aKeyEvent, aType );
            }
        else
            {
            return EKeyWasNotConsumed;
            }
        }
    
    // ----------------------------------------------------
    // CDynamicSettingListAppView::LoadListL()
    // Loads the setting item list dynamically.
    
    void CDynamicSettingListAppView::LoadListL()
        {
        TBool isNumberedStyle = iItemList->IsNumberedStyle();
        CArrayPtr<CGulIcon>* icons = iItemList->ListBox()->ItemDrawer()->FormattedCellData()->IconArray();
    
    
        /* Text setting item */
        CAknTextSettingItem* item = new (ELeave) CAknTextSettingItem(1, iText);
        CleanupStack::PushL(item);
        item->SetEmptyItemTextL( KEmptyText );
        // The same resource id can be used for multiple text setting pages.
        item->ConstructL(isNumberedStyle, 1, KName, icons, R_TEXT_SETTING_PAGE, -1);
        iItemList->SettingItemArray()->AppendL(item);
        CleanupStack::Pop(item);
    
    
        CDynamicSettingListText* item5 = new (ELeave) CDynamicSettingListText(5, iText);
            CleanupStack::PushL(item5);
            item5->SetEmptyItemTextL( KEmptyText );
            // The same resource id can be used for multiple slider setting pages.
            item5->ConstructL(isNumberedStyle, 5, KName5, icons, R_TEXT_SETTING_PAGE2, -1);
                iItemList->SettingItemArray()->AppendL(item5);
                CleanupStack::Pop(item5);
    
    
        // Required when there is only one setting item.
        iItemList->SettingItemArray()->RecalculateVisibleIndicesL();
    
        iItemList->HandleChangeInItemArrayOrVisibilityL();
        }
    
    
    void CDynamicSettingListAppView::StoreSettingsL()
        {
        iItemList->StoreSettingsL();
        }
    // End of file

  2. #2
    Regular Contributor
    Join Date
    Dec 2007
    Location
    Banglore,India
    Posts
    64

    Re: TOTALY LOST can one help me in finding the bug PLEASE

    There's a problem with your resource file and not with your code.
    You haven't used appropriate resource

Similar Threads

  1. RecordStore bug on Series 60
    By ncerezo2 in forum Mobile Java General
    Replies: 21
    Last Post: 2009-11-26, 10:12
  2. E70 Lost RAM BUG
    By WeArab in forum General Development Questions
    Replies: 0
    Last Post: 2006-07-25, 09:35
  3. A bug: setColor with offscreen graphics - PLEASE, REPLY THIS TIME
    By palmcrust in forum Mobile Java General
    Replies: 11
    Last Post: 2003-12-04, 12:43
  4. Firmware bug or code bug displaying list on 3650
    By blackjack75 in forum Mobile Java General
    Replies: 2
    Last Post: 2003-09-24, 19:52
  5. Replies: 8
    Last Post: 2003-07-11, 12:56

Posting Permissions

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