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. Win32 / MFC mixing TRUE / BST_CHECK for SetCheck function

Win32 / MFC mixing TRUE / BST_CHECK for SetCheck function

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
7 Posts 4 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.
  • X Offline
    X Offline
    xanagan666
    wrote on last edited by
    #1

    I have done some mistakes regarding of using TRUE / FALSE for SetCheck / GetCheck method of CButton (they have to use BST_CHECK/BST_UNCHECK,I've got it mixed up with GetCheck/SetCheck of CListCtrl). But It run ok since both TRUE/BST_CHECK are definced as 1 and FALSE/BST_CHECK are defined as 0 Is this considered a serious bug ? Should I make a patch ? Sometime I wish they could use an enum for these parameters in stead of just defined value.

    H CPalliniC X 3 Replies Last reply
    0
    • X xanagan666

      I have done some mistakes regarding of using TRUE / FALSE for SetCheck / GetCheck method of CButton (they have to use BST_CHECK/BST_UNCHECK,I've got it mixed up with GetCheck/SetCheck of CListCtrl). But It run ok since both TRUE/BST_CHECK are definced as 1 and FALSE/BST_CHECK are defined as 0 Is this considered a serious bug ? Should I make a patch ? Sometime I wish they could use an enum for these parameters in stead of just defined value.

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      What was error you got?

      X 1 Reply Last reply
      0
      • H Hamid Taebi

        What was error you got?

        X Offline
        X Offline
        xanagan666
        wrote on last edited by
        #3

        Actually there was no error. I use the wrong parameter for SetCheck function. I wrote : m_comboButton.SetCheck(TRUE); m_comboButton.SetCheck(FALSE); while I should write m_comboButton.SetCheck(BST_CHECK); m_comboButton.SetCheck(BST_UNCHECK); The program has already been shipped and I fear that it might cause a problem In the future (I test it on xp/vista and it work fine)

        O 1 Reply Last reply
        0
        • X xanagan666

          Actually there was no error. I use the wrong parameter for SetCheck function. I wrote : m_comboButton.SetCheck(TRUE); m_comboButton.SetCheck(FALSE); while I should write m_comboButton.SetCheck(BST_CHECK); m_comboButton.SetCheck(BST_UNCHECK); The program has already been shipped and I fear that it might cause a problem In the future (I test it on xp/vista and it work fine)

          O Offline
          O Offline
          ovidiucucu
          wrote on last edited by
          #4

          You mean, BST_CHECKED and BST_UNCHECKED. Although, for the sake of good programming style and code readability, it's good to use those constants when calling CButton::SetCheck (may be also the third value BST_INDETERMINATE for three-state button), that is not a reason to worry in your particular case. BST_CHECKED and BST_UNCHECKED constants have the same values like TRUE and FALSE respectively: #define BST_UNCHECKED 0x0000 #define BST_CHECKED 0x0001 #define FALSE 0 #define TRUE 1

          Ovidiu Cucu Microsoft MVP - Visual C++

          CPalliniC 1 Reply Last reply
          0
          • X xanagan666

            I have done some mistakes regarding of using TRUE / FALSE for SetCheck / GetCheck method of CButton (they have to use BST_CHECK/BST_UNCHECK,I've got it mixed up with GetCheck/SetCheck of CListCtrl). But It run ok since both TRUE/BST_CHECK are definced as 1 and FALSE/BST_CHECK are defined as 0 Is this considered a serious bug ? Should I make a patch ? Sometime I wish they could use an enum for these parameters in stead of just defined value.

            CPalliniC Offline
            CPalliniC Offline
            CPallini
            wrote on last edited by
            #5

            xanagan666 wrote:

            Is this considered a serious bug ?

            IMHO NO! (1) Probably MS developers defined the MACROs keeping an eye on compatibility with TRUE/FALSE pair. (2) Probably They will never change that values.

            xanagan666 wrote:

            Should I make a patch ?

            IMHO you'll include these minor fixes in a patch addressing major ones (maybe never?). :-D

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

            In testa che avete, signor di Ceprano?

            1 Reply Last reply
            0
            • O ovidiucucu

              You mean, BST_CHECKED and BST_UNCHECKED. Although, for the sake of good programming style and code readability, it's good to use those constants when calling CButton::SetCheck (may be also the third value BST_INDETERMINATE for three-state button), that is not a reason to worry in your particular case. BST_CHECKED and BST_UNCHECKED constants have the same values like TRUE and FALSE respectively: #define BST_UNCHECKED 0x0000 #define BST_CHECKED 0x0001 #define FALSE 0 #define TRUE 1

              Ovidiu Cucu Microsoft MVP - Visual C++

              CPalliniC Offline
              CPalliniC Offline
              CPallini
              wrote on last edited by
              #6

              ovidiucucu wrote:

              BST_CHECKED and BST_UNCHECKED constants have the same values like TRUE and FALSE respectively: #define BST_UNCHECKED 0x0000 #define BST_CHECKED 0x0001 #define FALSE 0 #define TRUE 1

              I think he alread knows... :-D

              If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

              In testa che avete, signor di Ceprano?

              1 Reply Last reply
              0
              • X xanagan666

                I have done some mistakes regarding of using TRUE / FALSE for SetCheck / GetCheck method of CButton (they have to use BST_CHECK/BST_UNCHECK,I've got it mixed up with GetCheck/SetCheck of CListCtrl). But It run ok since both TRUE/BST_CHECK are definced as 1 and FALSE/BST_CHECK are defined as 0 Is this considered a serious bug ? Should I make a patch ? Sometime I wish they could use an enum for these parameters in stead of just defined value.

                X Offline
                X Offline
                xanagan666
                wrote on last edited by
                #7

                Thank everyone for your answer/solution :). I will be more careful in the future.

                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