Help me please ! Error with TCallBack !Thanks very much!

Login to reply to this topic.
Mon, 2005-08-15 05:42
Joined: 2005-06-21
Forum posts: 107
Help me please! I don't know what error I have.This is my error:
-----------------------------------------------  Error ------------------------------------------------------
"GameDemoAppView.cpp":     Could not find a match for 'TCallBack::TCallBack(void,CGameDemoAppView * const)' in function CGameDemoAppView::StartTimer() at line 81
---------------------------------------------------------------------------------------------------------------

This is my source :

------------------------------------------- Source --------------------------------------------------------

/* Copyright (c) 2002, Nokia. All rights reserved */

#include <eikenv.h>
#include <fbs.h>

#include "GameDemoAppView.h"
#include "multibitmap.mbg"

// Standard construction sequence
CGameDemoAppView* CGameDemoAppView::NewL(const TRect& aRect)
    {
    CGameDemoAppView* self = CGameDemoAppView::NewLC(aRect);
    CleanupStack::Pop(self);
    return self;
    }

CGameDemoAppView* CGameDemoAppView::NewLC(const TRect& aRect)
    {
    CGameDemoAppView* self = new (ELeave) CGameDemoAppView;
    CleanupStack::PushL(self);
    self->ConstructL(aRect);
    return self;
    }

CGameDemoAppView::CGameDemoAppView()
    {
   // no implementation required
    }

CGameDemoAppView::~CGameDemoAppView()
    {
   // no implementation required
    }

void CGameDemoAppView::ConstructL(const TRect& aRect)
    {
    // Create a window for this application view
    CreateWindowL();

    // Set the windows size
    SetRect(aRect);

    // Load in the bitmap images from the multi bitmap file
    iImage1 = iEikonEnv->CreateBitmapL( KMultiBitmapFilename,EMbmMultibitmapImage1 );
    iImage2 = iEikonEnv->CreateBitmapL( KMultiBitmapFilename,EMbmMultibitmapImage2 );

    flag = 1;

    // Ham khoi tao thoi gian
    iPeriodicTimer = CPeriodic::NewL( CActive::EPriorityStandard );

    // Activate the window, which makes it ready to be drawn
    ActivateL();
    }

TInt CGameDemoAppView::Period(TAny* aPtr )
{
    if(flag == 0)
    {
       flag = 1;
       ( static_cast<CGameDemoAppView*>( aPtr ) )->GetImage(iImage1,1,1);
       //Returning a value of TRUE indicates the callback should be done again
        return 1;
    }
    else
    {
        flag = 0;
        ( static_cast<CGameDemoAppView*>( aPtr ) )->GetImage(iImage2,1,1);
        // Returning a value of TRUE indicates the callback should be done again
        return 1;
    }
}


void CGameDemoAppView::StartTimer()
{
        // If the timer is not already running, start it
        if ( !iPeriodicTimer->IsActive() )
        {
             iPeriodicTimer->Start( 1,1,
                   TCallBack(CGameDemoAppView::Period, this ) );     // MY ERROR
         }

}


void CGameDemoAppView::GetImage(CFbsBitmap* iImage,int dx,int dy) const
{
  CFbsBitmap* maskBitmap = new ( ELeave ) CFbsBitmap();
  CleanupStack::PushL( maskBitmap );
  User::LeaveIfError( maskBitmap->
              Load( KMultiBitmapFilename,EMbmMultibitmapImage1 ));

  TRect bmpPieceRect(TPoint(0,0),iImage->SizeInPixels());

  CWindowGc& gc = SystemGc();
  gc.BitBltMasked(TPoint(dx,dy),iImage,bmpPieceRect,maskBitmap,ETrue);
  CleanupStack::PopAndDestroy();
}

// Draw this application's view to the screen
void CGameDemoAppView::Draw(const TRect& /*aRect*/) const
    {
      GetImage(iImage1,1,1);
    }


Thanks very much!Please Help me!------------------------------------------------- doctinh113114-------------------------------------------------

Mon, 2005-08-15 06:25
Joined: 2004-12-03
Forum posts: 192
Re: Help me please ! Error with TCallBack !Thanks very much!
Period function has to be static (or friend-function) - not a member
Thu, 2005-08-18 07:36
Joined: 2005-06-21
Forum posts: 107
Re: Help me please ! Error with TCallBack !Thanks very much!
Thanks very much! I can do that!
  • Login to reply to this topic.