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. dynamic DefPushButton

dynamic DefPushButton

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 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.
  • G Offline
    G Offline
    GeraldoLuiz
    wrote on last edited by
    #1

    I have a modal dialog with an OK button with BS_DEFPUSHBUTTON style but when the focus is on a particular textbox, I want to change the DefPushButton to another one, so when the user press ENTER the action is related to that field. I tried to redefine it using SetButtonStyle(), but it doesn't work. The button visually seems to receive the Default focus, but whem I press ENTER the old default one is clicked. If I take the DEF style from the old one, then no action happens when I press ENTER. Then, a strange thing happens with the focus when I tab into the button. When I move the focus to the button with the tab key, it seems like it receives the focus (dotted rectangle inside) but is not in selected state. Is it possible ? Can I change the default button dynamically or windows prevent it ? How can I accomplish such a thing ? Thanks.

    D 1 Reply Last reply
    0
    • G GeraldoLuiz

      I have a modal dialog with an OK button with BS_DEFPUSHBUTTON style but when the focus is on a particular textbox, I want to change the DefPushButton to another one, so when the user press ENTER the action is related to that field. I tried to redefine it using SetButtonStyle(), but it doesn't work. The button visually seems to receive the Default focus, but whem I press ENTER the old default one is clicked. If I take the DEF style from the old one, then no action happens when I press ENTER. Then, a strange thing happens with the focus when I tab into the button. When I move the focus to the button with the tab key, it seems like it receives the focus (dotted rectangle inside) but is not in selected state. Is it possible ? Can I change the default button dynamically or windows prevent it ? How can I accomplish such a thing ? Thanks.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Have you looked at the DM_SETDEFID message?


      A rich person is not the one who has the most, but the one that needs the least.

      G 1 Reply Last reply
      0
      • D David Crow

        Have you looked at the DM_SETDEFID message?


        A rich person is not the one who has the most, but the one that needs the least.

        G Offline
        G Offline
        GeraldoLuiz
        wrote on last edited by
        #3

        Ok, David, that's it. I didn't know this message. I will give it a try. Thanks a lot for pointing me in the right direction.

        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