setting multiple bmps on button

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • setting multiple bmps on button

    Hi,
    I am facing problem with multiple set bmps on a button.
    I am using BUTTON_SetBitmapEx(hItem, BUTTON_BI_UNPRESSED, &bmDelivery_small, 1,40) function to set bmps .At the same time am setting other bmp to same button but its no setting .
    Can you please tell me the solution for setting multiple bmps on the same button.

    Regards,
    venkat
  • Drawing multiple bmps and clearing the bmps

    Hi,
    Thanks for reply, as you said i am drawing a bitmap in wmpaint of button callback function. But my requirement is like on the same button on some scenarios if bmp is already drawn i need to clear the bmp.
    I have drawn a bitmap by using api GUI_DrawBitmap(&bmDelivery_small, 1,30); and am not getting how to clear that bmp.



    Regards,
    Venkat
  • Drawing multiple bmps and clearing the bmps

    Hi Adrian,

    I have used WM_InvalidateWindow() then also its not clearing.Please look into the code .

    Below i have written the piece of code ,

    static void _cbButton(WM_MESSAGE * pMsg) {
    WM_HWIN hItem;
    int status[4];
    char dayBuff[3];
    hItem = pMsg->hWin;

    switch (pMsg->MsgId) {
    #if 0
    case WM_CREATE :
    GUI_DrawBitmap(NULL, 1,30);
    GUI_DrawBitmap(NULL, 40,30);
    GUI_DrawBitmap(NULL, 50,1);
    GUI_DispStringAt(" ",2,2);
    break;
    #endif

    case WM_PAINT:

    GUI_SetBkColor(0xE0E0E0);
    GUI_Clear();

    WM_GetUserData(hItem,&status,sizeof(status));

    if( status[0] )
    {
    GUI_DrawBitmap(&bmDelivery_small, 1,30);
    }
    if( status[1] )
    {
    GUI_DrawBitmap(&bmalarm_small, 40,30);
    }
    if( status[2] )
    {
    GUI_DrawBitmap(&bmRight, 50,1);
    }


    sprintf(dayBuff,"%d",status[3]);
    GUI_SetColor(GUI_BLACK);
    GUI_DispStringAt(dayBuff,2,2);

    WM_InvalidateWindow(pMsg->hWin); /***************************/

    break;

    default:
    WM_DefaultProc(pMsg);
    }
    }
  • how to send a data to button while invalidating the button

    Hi,

    I have a small doubt on a some
    API.


    I have created a dialog box , in the resource table of dialog box created a 40 buttons by create indirect .
    Then in WM_INIT of dialog box, I have invoked calendar app function which uses the 40 buttons of the dialog box to show date on each button with respect to the current month.
    In calendar app function , i will run the for loop from 1 to 31 where I will get the date like 1,2,3 etc and which are bmps to set on that day. Then I am calling WM_setCallback(ButtonItem,cbCallback)
    Immediately to that am also calling WM_SetUserData(ButtonItem,&Data,Sizeof(Data)).Because I need to set each button date and bmps ,so I made a buttoncallback to drawbmps and set date.
    WM_setuserdata will execute 40 time in the loop, it will set callback for 40 buttons. Till this is ok for me, when I click the next month ,I invoke CalendarAppfunction for making calendar that time the already drawn things like date and bmps which are not getting
    clear.
    To clear the last drawnbmps or set date on buttons , I have used InvaliadteWindow() but the problem is that i need to pass a data to the callback function.
    Am doing like this to pass data to callback function,

    InvalidateWindow(ButtonItem);

    setUserData(Buttonitem,&Data,sizeof(data).

    Actually,here the Data is structure which contains the data which always it will change for the each button.
    How I can send the data from InvalidateWindow() means can I use setUserData() along woth InvalidateWindow().
    I have tried along with that but its not receving any data in callback function of button.
    Please can you suggest on this why I cant use SetUserDAta() along with Invalidate Window.

    The post was edited 1 time, last by SEGGER - Adrian ().