Owner Draw button changes the tab order
-
Hello All, In my dialog box, I want to use an image on a button, so I made it as Owner Draw, I use CBitmapButton class and it is working fine. But when ever the dialog comes up, the initial focus is on the user defined button only. Here is the code for bitmap button
CBitmap bmp; BITMAP bm; bmp.LoadBitmap (IDB_ENABLE_BMP); bmp.GetBitmap (&bm); m_oMyBtn.SetWindowPos (NULL, 0, 0, bm.bmWidth, bm.bmHeight, SWP_NOMOVE | SWP_NOOWNERZORDER); m_oMyBtn.LoadBitmaps (IDB_ENABLE_BMP, IDB_SEL_BMP, IDB_FOCUS_BMP, IDB_DISABLE_BMP);
I found when ever I use "SetWindowPos" the initial focus is always on the owner draw button. If I remove "SetWindowPos" function then the focus is as per my tab order settings. My idea is to resize the button as per the image size. If any other way to do that let me know. Thanks for your time BlrBoy -
Hello All, In my dialog box, I want to use an image on a button, so I made it as Owner Draw, I use CBitmapButton class and it is working fine. But when ever the dialog comes up, the initial focus is on the user defined button only. Here is the code for bitmap button
CBitmap bmp; BITMAP bm; bmp.LoadBitmap (IDB_ENABLE_BMP); bmp.GetBitmap (&bm); m_oMyBtn.SetWindowPos (NULL, 0, 0, bm.bmWidth, bm.bmHeight, SWP_NOMOVE | SWP_NOOWNERZORDER); m_oMyBtn.LoadBitmaps (IDB_ENABLE_BMP, IDB_SEL_BMP, IDB_FOCUS_BMP, IDB_DISABLE_BMP);
I found when ever I use "SetWindowPos" the initial focus is always on the owner draw button. If I remove "SetWindowPos" function then the focus is as per my tab order settings. My idea is to resize the button as per the image size. If any other way to do that let me know. Thanks for your time BlrBoy