×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    61

    Unhappy Dragging CeikEdwin scroll bars crashes Nokia 5800 phone (but not emulator).

    I have a problem with Nokia 5800 (but not the 5th edition emulator) when when I try to drag the scroll bars in CEikEdwin control the phone crashes.

    I have a resource for creating editor control which is defined as follows:
    Code:
    RESOURCE EDWIN R_LOCATION_EDITOR
    {
        width = 512;
        lines = 2;
        maxlength = KMaxMessageLength;
        flags = EEikEdwinWidthInPixels |  EEikEdwinNoHorizScrolling | 
            EEikEdwinNoAutoSelection | EEikEdwinInclusiveSizeFixed | 
            EEikEdwinReadOnly;
        
        default_case = EAknEditorTextCase;
    
        allowed_input_modes = EAknEditorAllInputModes;
        default_input_mode = EAknEditorTextInputMode;
        avkon_flags = EAknEditorFlagForceTransparentFepModes | 
            EAknEditorFlagEnableScrollBars; 
        special_character_table = R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG;
    }
    The edwin control is part of the compound control and is created as follows:

    Code:
        //Create edit control for location information
        const CFont* cntFont = 	AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont);
    
        CEikEdwin* iEdwin = new (ELeave) CEikEdwin();
        CleanupStack::PushL(iEdwin);
        iEdwin->SetContainerWindowL(*this);
    
        TResourceReader reader;
        CEikonEnv::Static()->CreateResourceReaderLC(reader, R_LOCATION_EDITOR);
        iEdwin->ConstructFromResourceL(reader);
        //Cleanup resource reader pushed by CreateResourceReaderLC
        CleanupStack::PopAndDestroy();
        
        ipLocationEdt =  iEdwin;
        CleanupStack::Pop(iEdwin);
    	
        ipLocationEdt->SetFocus(EFalse);
        ipLocationEdt->SetReadOnly(ETrue);
        ipLocationEdt->SetObserver(this);
        ipLocationEdt->SetMopParent(this);
        ipLocationEdt->SetBorder(TGulBorder::ESingleBlack);
        ipLocationEdt->SetAlignment(EAknEditorAlignCenter);
    
        Components().AppendLC(ipLocationEdt);
        CleanupStack::Pop(ipLocationEdt);
        
        //Fill in the status bar with location information;
        //Get contact location information
        //Get the location string
        HBufC* pTxt = <some text>
        CleanupStack::PushL(pTxt);
        ipLocationEdt->SetTextL(pTxt);
        CleanupStack::PopAndDestroy(pTxt);
        
        //Create sroll bars
        CEikScrollBarFrame* pFrame = 
            ipLocationEdt->CreatePreAllocatedScrollBarFrameL();
    
        //Taken from 5th edtion documenation
        if( AknLayoutUtils::DefaultScrollBarType( iAvkonAppUi ) ==
            CEikScrollBarFrame::EDoubleSpan )
        {
            // window-owning scrollbar, non-remote, vertical, non-horizontal
            pFrame->CreateDoubleSpanScrollBarsL( ETrue, EFalse, ETrue, EFalse );
            pFrame->SetTypeOfVScrollBar( CEikScrollBarFrame::EDoubleSpan );
        }else
        {
            pFrame->SetTypeOfVScrollBar( CEikScrollBarFrame::EArrowHead );
        }
        pFrame->SetScrollBarVisibilityL( 
                CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto );
    Then when the size of the compound control is set I set the size of the editor as follows:
    Code:
    EXPORT_C void CLocationCtrlBase::SizeChanged(void)
    {
        if(!iSize.iHeight || !iSize.iWidth || !ipLocationEdt)
            return;
        
        //Set the height of the edwin control
        TSize locationSz = ipLocationEdt->Size();
        if(locationSz.iHeight > iSize.iHeight)
            return;
        
        TRect locationRc = Rect();
        locationRc.SetHeight(locationSz.iHeight);
        locationRc.Move(0,iSize.iHeight - locationSz.iHeight);
        
        CEikScrollBarFrame* pFrame = ipLocationEdt->ScrollBarFrame();
        if(pFrame)
        {
            TInt scrlWidth = pFrame->ScrollBarBreadth(CEikScrollBar::EVertical);
            if(!scrlWidth)
                scrlWidth = CEikScrollBar::DefaultScrollBarBreadth();
            locationRc.SetWidth(iSize.iWidth - scrlWidth );
        }
        ipLocationEdt->SetRect(locationRc);
        
        //Set the height of the map control
        TRect mapRc=Rect();
        mapRc.SetHeight(iSize.iHeight - locationRc.Height());
        ipGMap->SetRect(mapRc);
    }
    Now – all this works fine (without crashing) in the emulator. When I stick in on the phone and try to drag the scroll bar then the phone crashes. I tried running the phone with TRK and this is the error I am getting:
    Thread [Thread id: 495] (Suspended: Signal 'Exception 100' received. Description: Thread 0x1ef has panicked. Category: Form; Reason: 300.)

    Does anyone have any idea what I am missing? Thanks.

  2. #2
    Registered User
    Join Date
    Aug 2007
    Posts
    41

    Re: Dragging CeikEdwin scroll bars crashes Nokia 5800 phone (but not emulator).

    Hi!
    Try to create not pre-allocated scrollbar frame, i.e. callCreateScrollBarFrame() instead of CreatePreAllocatedScrollBarFrame().
    Also you could try to set your own observer for the created scrollbar frame (CEikScrollBarFrame::ScrollBarFrameObserver()). Then in your implementation of the MEikScrollBarObserver::HandleScrollEventL() try to analyse call for the EEikScrollThumbDragVert event. Possibly scrollBar pointer would be NULL for some reason... Or something like this. Anyway try to play around.
    Last edited by Damavik; 2009-02-27 at 14:01.

  3. #3
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    61

    Re: Dragging CeikEdwin scroll bars crashes Nokia 5800 phone (but not emulator).

    Thanks for the reply Damavik. I will evetually have to try something like that. I was rather hoping for a bit simplier solution considering that most of the code that I've posted was taken from samples I found on this site and in Symbian's documentation. I'll wait for a bit longer and and see if someone would come up with something else. (Unless it's a bug in the new phone and needs to be reported.)

  4. #4
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    61

    Re: Dragging CeikEdwin scroll bars crashes Nokia 5800 phone (but not emulator).

    By the way Damavik - CreateScrollBarFrame() is not a public function so it can not be used so I am back to square one.

  5. #5
    Regular Contributor
    Join Date
    Jul 2007
    Location
    Dublin
    Posts
    240

    Re: Dragging CeikEdwin scroll bars crashes Nokia 5800 phone (but not emulator).

    Hi, Following is code snip from 'Developing Series 60 Application'... Hope it would help you.

    Code:
    #define KUrlWidth 176
    #define KUrlNumberLines 1
    #define KMaxUrlLength 256
    
    RESOURCE EDWIN r_plaintexteditor_urleditor
       {
       width = KUrlWidth;
       lines = KUrlNumberLines;
       maxlength = KMaxUrlLength;
       flags = EEikEdwinWidthInPixels;
       avkon_flags = EAknEditorFlagNoT9;
       default_case = EAknEditorLowerCase;
       allowed_case_modes = EAknEditorUpperCase | EAknEditorLowerCase;
       numeric_keymap = EAknEditorPlainNumberModeKeymap;
       allowed_input_modes = EAknEditorTextInputMode | EAknEditorNumericInputMode;
       default_input_mode = EAknEditorTextInputMode;
       special_character_table = R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG;
       }
    
    void CPlainTextEditorContainer::ConstructL(const TRect& aRect)
       {
       CreateWindowL();
       iEditor = new (ELeave) CEikEdwin;
       iEditor->SetContainerWindowL(*this);
       TResourceReader reader;
       iCoeEnv->CreateResourceReaderLC(reader, R_PLAINTEXTEDITOR_URLEDITOR);
       iEditor->ConstructFromResourceL(reader);
       CleanupStack::PopAndDestroy(); // reader
       iEditor->SetFocus(ETrue);
       SetRect(aRect);
       ActivateL();
       }
    
    TKeyResponse CPlainTextEditorContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
       {
       if (iEditor)
          {
          return iEditor->OfferKeyEventL(aKeyEvent, aType);
          }
       else
          {
          return CCoeControl::OfferKeyEventL(aKeyEvent, aType);
          }
       }
    -Datha

  6. #6
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    61

    Re: Dragging CeikEdwin scroll bars crashes Nokia 5800 phone (but not emulator).

    Hi Datha_k - I think you missunderstood the problem. There is no problem with scrolling on S60 3rd edition series. I have the editor resource and main code which work fine. The problem occures on the actual device (5800). In the best case senario the application just crashes. In the worst case the phone reboots itself. I tries creating my own scroll bar frame including trapping scroll event. It looks like the problem is with the editor. I suspect the editor's code has null devision somewhere. I looks like a bug to me but at the moment I am trying to find a way round it.

Posting Permissions

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