×

Discussion Board

Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    Apr 2004
    Location
    Finland
    Posts
    10

    BAFL 15 in CCknViewButton construction

    Hi,

    I'm trying to use CCknViewButton in Series 90 application. I have followed the example in View Button API Specification Document, but I keep having BAFL panic 15 when calling method ConstructFromResourceL.

    My .rss looks like this:

    RESOURCE CONTROLS r_thingie_buttons
    {
    controls=
    {
    CMBUT
    {
    behavior = EEikButReportOnPointerDown;
    layout = EEikCmdButTextBottomPictureTop|EEikCmdButExcessToSecond;
    txt = "Play";
    bmpfile = "z:\\system\\apps\\graphics\\myimages.mbm";
    bmpid = EMbmMyimagesMyimage2;
    bmpmask = EMbmMyimagesMyimage2_mask;
    }
    };
    }



    The AppView tries to create the control in method ConstructL like this:

    CCknViewButton::TType buttonType = CCknViewButton::EType4;
    TResourceReader resourceReader;

    // Set button's position and size.
    TPoint playButtonPosition(100, 100);
    TSize playButtonSize(50, 50);

    // Create a resource reader, indicating the button's id.
    iCoeEnv->CreateResourceReaderLC(resourceReader, R_THINGIE_BUTTONS);

    // Create the containing array.
    iViewButtons = new(ELeave) CArrayPtrFlat<CCknViewButton>(1);

    // Deterrmine the number of buttons.
    iButtonTotal = resourceReader.ReadUint16();

    // Read in view button.
    CCknViewButton* viewButton = CCknViewButton::NewL();
    CleanupStack::PushL(viewButton);

    // Set the highlight.
    TUint32 highlightType = CCknViewButton::EHighlightNone;
    highlightType = CCknViewButton::EHighlightNone;
    viewButton->SetHighlightType(highlightType);

    // Set button type.
    buttonType = CCknViewButton::EType4;
    viewButton->SetType(buttonType);

    // Make the view, the containing and observing control.
    viewButton->SetContainerWindowL(*this);
    viewButton->SetObserver(this);

    // Read view button from resource.
    // This is where this panics.
    viewButton->ConstructFromResourceL(resourceReader);

    // Set size and place.
    viewButton->SetExtent(playButtonPosition, playButtonSize);

    // View button is ready to be drawn.
    viewButton->ActivateL();

    // Store the view button's address.
    iViewButtons->AppendL(viewButton);

    CleanupStack::Pop(viewButton);

    // Pop and destroy the resource reader.
    CleanupStack::PopAndDestroy();

    // Set the focus.
    iFocusedControl = (*iViewButtons)[0];


    I have heard some rumours that saving the resource file in unicode and then taking away the two letters that appear in the beginning of the file when viewing it with the IDE should help, but it didn't.

    Also I noticed that if I add field "helptxt" in the resource (it was there in the example) like this:

    RESOURCE CONTROLS r_thingie_buttons
    {
    controls=
    {
    CMBUT
    {
    behavior = EEikButReportOnPointerDown;
    layout = EEikCmdButTextBottomPictureTop|EEikCmdButExcessToSecond;
    txt = "Play";
    helptxt="Play help";
    bmpfile = "z:\\system\\apps\\graphics\\myimages.mbm";
    bmpid = EMbmMyimagesMyimage2;
    bmpmask = EMbmMyimagesMyimage2_mask;
    }
    };
    }


    , I get BAFL panic 4 at the same method ConstructFromResourceL. I know the definitions of both of those panics, but I don't know which one is closer to the correct solution or what is actually causing them.


    Thanks in advance for any ideas,
    -janine
    Last edited by -janine; 2004-07-20 at 08:15.

  2. #2
    Regular Contributor
    Join Date
    Jan 2004
    Location
    Braunschweig, Germany
    Posts
    345
    Hi -janine,

    I cannot help you much with S90 problems but I can give you a hint what might cause the BAFL 15 panic.

    Adding resources in the .rss file causes the resource compiler to assign new numbers to all the resource definitions. They are written to the *.rsg file. You have to recompile all the sourcefiles which include this file to load any resources. This should happen automatically but at least the Codewarrior IDE does not alway do that. So when I get this kind of error, I recompile all the source files and in most cases the error is gone.

    Regards,
    Bernd

  3. #3
    Registered User
    Join Date
    Apr 2004
    Location
    Finland
    Posts
    10
    Hi Bernd,

    Thank you for the tip. Unfortunately that wasn't the case this time, but it is good to know that, since I'm quite new with Codewarrior.

    It is very possible that this issue is not Series 90 related, so all tips are more than welcome.


    Regards,
    -janine

  4. #4
    Regular Contributor
    Join Date
    Jan 2004
    Location
    Braunschweig, Germany
    Posts
    345
    Hi -janine,

    I think it has no direct relation to the Seris 60 because there are no buttons.

    The line
    iButtonTotal = resourceReader.ReadUint16();
    looks suspicious to me. It seems to me that the ConstructFromResourceL(resourceReader); starts to read at the wrong position. But I'm no real expert with resources and it might be perfectly valid.

    Regards,
    Bernd

  5. #5
    Registered User
    Join Date
    Apr 2004
    Location
    Finland
    Posts
    10
    That actually was the problem. I corrected it as ReadUint8(), and it works fine.

    Thanks alot!
    -janine

Posting Permissions

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