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. Can we Set the ReadOnly attribute to a checkbox?

Can we Set the ReadOnly attribute to a checkbox?

Scheduled Pinned Locked Moved C / C++ / MFC
question
8 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.
  • J Offline
    J Offline
    Jim Chan
    wrote on last edited by
    #1

    As we known, we can set ReadOnly attribute to an editbox, and we can also disable a checkbox. But can we set a ReadOnly attribute to a checkbox and did not disable it ? Looking forward to your answer.

    P 1 Reply Last reply
    0
    • J Jim Chan

      As we known, we can set ReadOnly attribute to an editbox, and we can also disable a checkbox. But can we set a ReadOnly attribute to a checkbox and did not disable it ? Looking forward to your answer.

      P Offline
      P Offline
      Prakash Nadar
      wrote on last edited by
      #2

      m_chkItem.EnableWindow(false);

      will disable the chkbutton, you need to have a member variable of the check box item for this or

      GetDlgItem(IDC_XXX)->EnableWindow(false);

      will do it directly without the member variable


      P.R.A.K.A.S.H

      J 1 Reply Last reply
      0
      • P Prakash Nadar

        m_chkItem.EnableWindow(false);

        will disable the chkbutton, you need to have a member variable of the check box item for this or

        GetDlgItem(IDC_XXX)->EnableWindow(false);

        will do it directly without the member variable


        P.R.A.K.A.S.H

        J Offline
        J Offline
        Jim Chan
        wrote on last edited by
        #3

        Thank you Mr.Prakash, but I thought we made misunderstandings. I meant that I wanna "set a ReadOnly attribute to a checkbox and Not disable it",and the attribute can not find directory in the checkbox property.. And your method is to disable the checkbox, it's not what I want, but thank you anyway.

        P 1 Reply Last reply
        0
        • J Jim Chan

          Thank you Mr.Prakash, but I thought we made misunderstandings. I meant that I wanna "set a ReadOnly attribute to a checkbox and Not disable it",and the attribute can not find directory in the checkbox property.. And your method is to disable the checkbox, it's not what I want, but thank you anyway.

          P Offline
          P Offline
          Prakash Nadar
          wrote on last edited by
          #4

          Humm, If its disabled its readonly... I guess you are confusing with readonly property of edit box. If its editable then its not readonly.. this is according to the concept of windows control. If you want its to alter then you need to cutomise it.


          P.R.A.K.A.S.H

          J 1 Reply Last reply
          0
          • P Prakash Nadar

            Humm, If its disabled its readonly... I guess you are confusing with readonly property of edit box. If its editable then its not readonly.. this is according to the concept of windows control. If you want its to alter then you need to cutomise it.


            P.R.A.K.A.S.H

            J Offline
            J Offline
            Jim Chan
            wrote on last edited by
            #5

            And what should I do to cutomise it? I am just a junior learner, Could you show me by codes? Thanks a lots.

            P 1 Reply Last reply
            0
            • J Jim Chan

              And what should I do to cutomise it? I am just a junior learner, Could you show me by codes? Thanks a lots.

              P Offline
              P Offline
              Prakash Nadar
              wrote on last edited by
              #6

              humm, I dont think there will be any code that will meet ur exact requirement, you can check on custom control here in cp just type custom control in the search edit box in this page.


              P.R.A.K.A.S.H

              J 1 Reply Last reply
              0
              • P Prakash Nadar

                humm, I dont think there will be any code that will meet ur exact requirement, you can check on custom control here in cp just type custom control in the search edit box in this page.


                P.R.A.K.A.S.H

                J Offline
                J Offline
                Jim Chan
                wrote on last edited by
                #7

                ok, thanks

                S 1 Reply Last reply
                0
                • J Jim Chan

                  ok, thanks

                  S Offline
                  S Offline
                  Steve S
                  wrote on last edited by
                  #8

                  At it's simplest, you need to have a derived class which ignores any input messages; you can add a PreTranslateMessage function (if it's MFC) that simply returns non-zero if the message it has is an input message (WM_xBUTTONx, WM_KEYx or WM_CHAR) Steve S

                  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