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. Disabling checkbox

Disabling checkbox

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.
  • D Offline
    D Offline
    dorkshoe
    wrote on last edited by
    #1

    Does anyone know how to disable a checkbox without disabling its text? I want the box disabled but the text to be normal. Basically so it looks like a regular checkbox you have no control over. -dork

    D A 2 Replies Last reply
    0
    • D dorkshoe

      Does anyone know how to disable a checkbox without disabling its text? I want the box disabled but the text to be normal. Basically so it looks like a regular checkbox you have no control over. -dork

      D Offline
      D Offline
      Dominik Reichl
      wrote on last edited by
      #2

      I would just introduce an internal flag which indicates if the checkbox is disabled or not. Then implement a callback function which gets called when the state of the checkbox changes. UpdateData(TRUE). If the checkbox flag indicates disabled, invert the current state, else not. :-D -Dominik


      _outp(0x64, 0xAD); and __asm mov al, 0xAD __asm out 0x64, al do the same... but what do they do?? ;)

      A 1 Reply Last reply
      0
      • D dorkshoe

        Does anyone know how to disable a checkbox without disabling its text? I want the box disabled but the text to be normal. Basically so it looks like a regular checkbox you have no control over. -dork

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

        You can derive class from CButton. In your derived class, provide a function in which u create a static control and places it just over the text area of your check box. Use GetWindowText or any other function to get combo box text. Provide your own function for enabling and disabling in which after calling base class implementation, redraw static control. i hope that works. Muhammad Shoaib Khan http://geocities.com/lansolution

        1 Reply Last reply
        0
        • D Dominik Reichl

          I would just introduce an internal flag which indicates if the checkbox is disabled or not. Then implement a callback function which gets called when the state of the checkbox changes. UpdateData(TRUE). If the checkbox flag indicates disabled, invert the current state, else not. :-D -Dominik


          _outp(0x64, 0xAD); and __asm mov al, 0xAD __asm out 0x64, al do the same... but what do they do?? ;)

          A Offline
          A Offline
          abc876
          wrote on last edited by
          #4

          Dominik Reichl wrote: If the checkbox flag indicates disabled, invert the current state, else not. this would enable the checkbox if it is disabled. this is not what he wants. he wants that check box is disabled but its text appears as enabled i.e checkbox is no longer able to respond to user but its text appears as enabled. Muhammad Shoaib Khan http://geocities.com/lansolution

          D 1 Reply Last reply
          0
          • A abc876

            Dominik Reichl wrote: If the checkbox flag indicates disabled, invert the current state, else not. this would enable the checkbox if it is disabled. this is not what he wants. he wants that check box is disabled but its text appears as enabled i.e checkbox is no longer able to respond to user but its text appears as enabled. Muhammad Shoaib Khan http://geocities.com/lansolution

            D Offline
            D Offline
            Dominik Reichl
            wrote on last edited by
            #5

            M.Shoaib Khan wrote: this would enable the checkbox if it is disabled. Nope. You make a call to the UpdateData(TRUE) function. Therefor the member variable for the checkbox contains the _new_ state of the checkbox. If you want to ignore the change, you therefor have to invert the state now. :-D -Dominik


            _outp(0x64, 0xAD); and __asm mov al, 0xAD __asm out 0x64, al do the same... but what do they do?? ;)

            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