Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Owner Draw button changes the tab order

Owner Draw button changes the tab order

Scheduled Pinned Locked Moved C / C++ / MFC
graphics
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BlrBoy
    wrote on last edited by
    #1

    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

    K 1 Reply Last reply
    0
    • B 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

      K Offline
      K Offline
      kvrnkiran
      wrote on last edited by
      #2

      Hi BlrBoy, Try using SWP_NOZORDER in your SetWindowPos function. This retains the Z-order of the control. Hope that helps. Kiran.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups