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. default buttons

default buttons

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
5 Posts 3 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.
  • A Offline
    A Offline
    aafcls
    wrote on last edited by
    #1

    Hello, I have a dialog with an OK and Cancel button, for example. Until a certain event takes place, the OK button is disabled, and the Cancel button is default (ie: has the thicker black outline). When the event takes place, and the OK button becomes enabled, I want it so that the OK button instantly becomes the only default button. With what keywords can I accomplish this? Thanks ;)

    T 1 Reply Last reply
    0
    • A aafcls

      Hello, I have a dialog with an OK and Cancel button, for example. Until a certain event takes place, the OK button is disabled, and the Cancel button is default (ie: has the thicker black outline). When the event takes place, and the OK button becomes enabled, I want it so that the OK button instantly becomes the only default button. With what keywords can I accomplish this? Thanks ;)

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      use [CDialog::SetDefID()](http://msdn2.microsoft.com/en-us/library/7sd15kw3.aspx)[[^](http://msdn2.microsoft.com/en-us/library/7sd15kw3.aspx "New Window")] for instance :

      this->SetDefID(IDOK); //considering that this is your dialog box class


      TOXCCT >>> GEII power

      [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

      A 1 Reply Last reply
      0
      • T toxcct

        use [CDialog::SetDefID()](http://msdn2.microsoft.com/en-us/library/7sd15kw3.aspx)[[^](http://msdn2.microsoft.com/en-us/library/7sd15kw3.aspx "New Window")] for instance :

        this->SetDefID(IDOK); //considering that this is your dialog box class


        TOXCCT >>> GEII power

        [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

        A Offline
        A Offline
        aafcls
        wrote on last edited by
        #3

        can you please be more specific, I'm not sure how you mean to implement this.

        T D 2 Replies Last reply
        0
        • A aafcls

          can you please be more specific, I'm not sure how you mean to implement this.

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #4

          the this is the pointer within the CDialog class in which the processing event were caught. i mean, if you're switching the default button when typing something in an edit box for instance, you override the EN_CHANGE message of that edit box, and as this editbox belongs to the dialogbox, the this pointer refers to the dialog box. have you even copied the code to try it ?


          TOXCCT >>> GEII power

          [VisualCalc 3.0  updated ][Flags Beginner's Guide  new! ]

          1 Reply Last reply
          0
          • A aafcls

            can you please be more specific, I'm not sure how you mean to implement this.

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

            aafcls wrote:

            can you please be more specific, I'm not sure how you mean to implement this.

            Just call SetDefID(IDOK). It's not any harder than that.


            "Money talks. When my money starts to talk, I get a bill to shut it up." - Frank

            "Judge not by the eye but by the heart." - Native American Proverb

            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