语言

Menu
Sites
Language
Changing Bitmap image of a footerItem when pressed

Hi all

i am working on an application and need to implement a bitmap change when footer item is pressed.

actually i am playing a file and want to change the bitmap from play to pause.

functionally it is working fine,,,but the bitmap of footeritem is not getting changed

hope i am clear

 

in On_Initialising() i am setting bitmap of footerItem like this:

Bitmap* pBitmapNormal = pAppResource->GetBitmapN(L"Pause.jpg");

                                
footerItemPlayPause.SetBackgroundBitmap(FOOTER_ITEM_STATUS_NORMAL,pBitmapNormal);

isplaying = false;                                  //isplaying is the flag i am checking in on_actionperformed()

in On_ActionPerformed() under this case i am changing it like this but it is not working.

  if(!isplaying)
        {
            AppResource *pAppResource = Application::GetInstance()->GetAppResource();
            Bitmap* pBitmapPressed = pAppResource->GetBitmapN(L"Play.jpg");
        
           
            footerItemPlayPause.SetBackgroundBitmap(FOOTER_ITEM_STATUS_NORMAL,pBitmapPressed);
           
           
            StartAudio(ID_NEW_FOOTER_ITEM_PLAY_PAUSE);
            isplaying  = true;

        }
        else
        {
            AppResource *pAppResource = Application::GetInstance()->GetAppResource();
            Bitmap* pBitmapPressed = pAppResource->GetBitmapN(L"Pause.jpg");
           
            footerItemPlayPause.SetBackgroundBitmap(FOOTER_ITEM_STATUS_NORMAL,pBitmapPressed);
            Draw();
           
            Stop(ID_NEW_FOOTER_ITEM_PLAY_PAUSE);
            isplaying = false;
        }

 

the functionality is working fine,,,from play to pause,,,,,,but bitmap image is not getting changed...

Please help....!!!!

 

 

编辑者为: Brock Boland 17 3月, 2014 原因: Paragraph tags added automatically from tizen_format_fix module.

响应

8 回复
what about calling footerItemPlayPause.RequestRedraw(true) or footerItemPlayPause.Invalidate(true) after SetBackgroundBitmap!!
Ravender Singh Dahiya
thanks Nour but we cannot call RequestRedraw and other member functions of Control class by footerItem object...i called it through footer object,,,but still its not working...with footer object when i do: pFooter->AddItem(*footerItemPlayPause); it adds one more footer item and changes the bitmap,,,but i want to change it in same footer item,,, what can be done???
Pavel Pertsev
footerItemPlayPause.SetBackgroundBitmap(FOOTER_ITEM_STATUS_NORMAL,pBitmapPressed); footer->SetItemAt(0, footerItemPlayPause);
Ravender Singh Dahiya
thanks Pavel footer->SetItemAt is working fine... but the problem is when i drew my form in app On_initialising then i used footerItemPlayPause.SetBackgroundBitmap(FOOTER_ITEM_STATUS_NORMAL,pBitmapNormal); and now when i am again using it in On_acionperformed and changing thee image of this same footerItem, it is not working....no showing any change..the image remains the same..... the surprising thing is footerItemPlayPause.SetIcon(FOOTER_ITEM_STATUS_NORMAL,pBitmapPressed); is working but not SetbackgroundBitmap
Ravender Singh Dahiya
why SetIcon is working and SetBackgroundBitmap not working?
Pavel Pertsev
Simple answer is you're doing it wrong. Try footerItemPlayPause.Invalidate() after setting background (which could help as workaround). The real problem is changing background onActionPerformed. Instead of that in onActionPerformed you should change state variable and call RequestRedraw. Override onDraw event, handle your state variable and change background respectively. But background should be set inside onDraw handler.
Pavel Pertsev
Nope, I'm wrong. Just tried that and background isn't changing anyway. Seems like another bug for me. BTW, why do you use footer? It's crappy and ugly. Make your custom button and place it to the bottom.
Ravender Singh Dahiya
thanks Pavel it can be done with buttons,,,my query was for footer...weather it can be done with footer or not,,,,thanks...