×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    24

    construct from resource files

    Hi guys,
    I am having problem in constructing a button from a resource file. Here is the code. Does anyone help me out?

    iButton = new (ELeave) CEikCommandButton();

    RFs aFileSession; // a handle to file server session
    aFileSession.Connect();

    RResourceFile* aResourceFile;
    _LIT(KRssFile,"Z:\\System\apps\\button\\button.rsc");

    aResourceFile->OpenL(aFileSession,KRssFile); //I AM GETTING A "USER BREAKPOINT..." ERROR AT THIS LINE

    aResourceFile->ConfirmSignatureL(0);
    HBufC8* dataBuffer=aResourceFile->AllocReadLC(R_MY_BUTTON);
    TResourceReader reader;
    reader.SetBuffer(dataBuffer);
    iButton->ConstructFromResourceL(reader);

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167
    Hi

    What sort of error you get ?
    Have you made empty ErrRd file in your emulator bootdata folder, so error notes will show correctly ?

    Anyway, why can't you define the resource in your apps own resource file, then you wouldn't need to load it in the first place and propably would solve your problem in easiest possibly way.

    yucca

  3. #3
    Registered User
    Join Date
    May 2004
    Posts
    24
    Thanks for your suggestion. Actually I was able to get it with the following code:

    iButton = new (ELeave) CEikCommandButton();

    TResourceReader reader;
    iEikonEnv->CreateResourceReaderLC(reader,R_MY_BUTTON);
    iButton->ConstructFromResourceL(reader);

    iButton->SetContainerWindowL(*this);


    But I couldnt get what you said abt ErrRd file. Can you explain it in detail and where can i find that file?

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,167

Posting Permissions

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