cancel
Showing results for 
Search instead for 
Did you mean: 

Image is getting enlarged in button with callback

Kusum Swarankar
Associate
Posted on March 16, 2018 at 06:27

Hi,

I have a button of size 100* on that button i want to set image for pressed and unpressed which is also of 100* I am setting it in init dialog as

BUTTON_SetBkColor(hEnter,BUTTON_CI_UNPRESSED,GUI_BLACK);

BUTTON_SetBkColor(hEnter,BUTTON_CI_PRESSED,GUI_BLACK);

BUTTON_SetBitmap(hEnter,BUTTON_CI_UNPRESSED,&bm_entericon_3Blue);

BUTTON_SetBitmap(hEnter,BUTTON_CI_PRESSED,&bm_entericon_3Pressedimageblue);

by this image is fitting into the button size .But the same thing when i am trying with call back the image is enlarged, I am not able to understand why it is like that.

callback is implemented as:

switch (pMsg->MsgId) {

case WM_INIT_DIALOG:

hEnter = WM_GetDialogItem(pMsg->hWin, ID_PW_BUTTON_12);

WM_SetCallback(hEnter, ChangeEnterButton);

break:

}

this is my callback function

void ChangeEnterButton(WM_MESSAGE * pMsg)

{

switch (pMsg->MsgId) {

case WM_PAINT:

if(BUTTON_IsPressed(pMsg->hWin))

{

GUI_SetBkColor(GUI_BLACK);

GUI_Clear();

GUI_DrawBitmap(&bm_entericon_3Pressedimageblue,0,0);

}

else

{

GUI_SetBkColor(GUI_BLACK);

GUI_Clear();

GUI_DrawBitmap(&bm_entericon_3Blue,0,0);

}

break;

default:

BUTTON_Callback(pMsg);

break;

}

}

Please do needful help.

0 REPLIES 0