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. Need to make a button (or checkbox) invisible..

Need to make a button (or checkbox) invisible..

Scheduled Pinned Locked Moved C / C++ / MFC
c++comtoolstutorialquestion
8 Posts 3 Posters 1 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.
  • R Offline
    R Offline
    rbid
    wrote on last edited by
    #1

    Hello, Scenario: MFC dialog application. That contains a lot of regular controls but should also contain a hidden(invisible) button or checkbox. clicking on the button (or checkbox) will enable or disable some custom or expert capabilities. Only knowing the exact location of the button will allow the user to click and get the expert capabilities. The invisible control should behave as a regular visible control. I know that this is possible, due that I saw it on a demo application few years ago (That I don't remember its name), but I don't have the vague idea on how to code it. Any idea on how to implement it with Visual C++ using MFC? Thanks in advance.

    -- **Ricky Marek** (_AKA: rbid_) -- "Things are only impossible until they are not" --- Jean-Luc Picard My articles

    M N 2 Replies Last reply
    0
    • R rbid

      Hello, Scenario: MFC dialog application. That contains a lot of regular controls but should also contain a hidden(invisible) button or checkbox. clicking on the button (or checkbox) will enable or disable some custom or expert capabilities. Only knowing the exact location of the button will allow the user to click and get the expert capabilities. The invisible control should behave as a regular visible control. I know that this is possible, due that I saw it on a demo application few years ago (That I don't remember its name), but I don't have the vague idea on how to code it. Any idea on how to implement it with Visual C++ using MFC? Thanks in advance.

      -- **Ricky Marek** (_AKA: rbid_) -- "Things are only impossible until they are not" --- Jean-Luc Picard My articles

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      If it's an option, it seems to me it's easier to just intercept WM_LBUTTONDOWN notification messages and check for the cursor being in a certain region. A simple flag to toggle can keep the expert/novice state. Mark

      "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

      R 1 Reply Last reply
      0
      • R rbid

        Hello, Scenario: MFC dialog application. That contains a lot of regular controls but should also contain a hidden(invisible) button or checkbox. clicking on the button (or checkbox) will enable or disable some custom or expert capabilities. Only knowing the exact location of the button will allow the user to click and get the expert capabilities. The invisible control should behave as a regular visible control. I know that this is possible, due that I saw it on a demo application few years ago (That I don't remember its name), but I don't have the vague idea on how to code it. Any idea on how to implement it with Visual C++ using MFC? Thanks in advance.

        -- **Ricky Marek** (_AKA: rbid_) -- "Things are only impossible until they are not" --- Jean-Luc Picard My articles

        N Offline
        N Offline
        normanS
        wrote on last edited by
        #3

        In a non-MFC application, I would have suggested owner-drawn pushbutton, with the "in" and "out" buttons the colour of the dialog box. (Not that I ever used owner-drawn pushbuttons, but I thought about it once.) Of course, everything is easier with MFC. . .

        R 1 Reply Last reply
        0
        • N normanS

          In a non-MFC application, I would have suggested owner-drawn pushbutton, with the "in" and "out" buttons the colour of the dialog box. (Not that I ever used owner-drawn pushbuttons, but I thought about it once.) Of course, everything is easier with MFC. . .

          R Offline
          R Offline
          rbid
          wrote on last edited by
          #4

          normanS wrote:

          ForumVisual C++ / MFC Subject:Re: Need to make a button (or checkbox) invisible.. Sender:normanS Date:15:44 16 May '07 with the "in" and "out" buttons the colour of the dialog box.

          This is a problem for me due that I have an ActiveX control beneath (2D Graph ActiveX Control[^]) has its background changing all the time... therefore making the "invisible button" follow these changes is not easy. :( The solution may be to use a "rectangle" and add some code to intercept when the user clicks on the mouse over it, and if it is in the rectangle do something otherwise call the 2D Graph ActiveX Control[^] handler for the mouse click. (But I'm not sure if this will work)

          -- **Ricky Marek** (_AKA: rbid_) -- "Things are only impossible until they are not" --- Jean-Luc Picard My articles

          N 2 Replies Last reply
          0
          • M Mark Salsbery

            If it's an option, it seems to me it's easier to just intercept WM_LBUTTONDOWN notification messages and check for the cursor being in a certain region. A simple flag to toggle can keep the expert/novice state. Mark

            "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

            R Offline
            R Offline
            rbid
            wrote on last edited by
            #5

            Mark Salsbery wrote:

            ForumVisual C++ / MFC Subject:Re: Need to make a button (or checkbox) invisible.. Sender:Mark Salsbery Date:13:47 16 May '07 If it's an option, it seems to me it's easier to just intercept WM_LBUTTONDOWN notification messages and check for the cursor being in a certain region. A simple flag to toggle can keep the expert/novice state. Mark

            Thanks Mark, Now, how do you intercept the WM_LBUTTONDOWN notification from the main window before the control beneath will intercept and handle it? I have an ActiveX control beneath. (2D Graph ActiveX Control[^])? If this is not possible, can I intercept the notification after the control beneath? Thanks in advance.

            -- **Ricky Marek** (_AKA: rbid_) -- "Things are only impossible until they are not" --- Jean-Luc Picard My articles

            M 1 Reply Last reply
            0
            • R rbid

              normanS wrote:

              ForumVisual C++ / MFC Subject:Re: Need to make a button (or checkbox) invisible.. Sender:normanS Date:15:44 16 May '07 with the "in" and "out" buttons the colour of the dialog box.

              This is a problem for me due that I have an ActiveX control beneath (2D Graph ActiveX Control[^]) has its background changing all the time... therefore making the "invisible button" follow these changes is not easy. :( The solution may be to use a "rectangle" and add some code to intercept when the user clicks on the mouse over it, and if it is in the rectangle do something otherwise call the 2D Graph ActiveX Control[^] handler for the mouse click. (But I'm not sure if this will work)

              -- **Ricky Marek** (_AKA: rbid_) -- "Things are only impossible until they are not" --- Jean-Luc Picard My articles

              N Offline
              N Offline
              normanS
              wrote on last edited by
              #6

              Ah - maybe you could make owner-drawn buttons with the IN and OUT transparent? In any case, I would guess that checking for mouse clicks in a certain area would actually be easier than making an owner-drawn button. I don't think that there should be a problem intercepting mouse clicks in the message handler and checking if they are within your defined rectangle. If they are, do something. If not, I don't think you have to explicitly call the 2D graph handler - just let Windows handle them using the DEFAULT.

              1 Reply Last reply
              0
              • R rbid

                normanS wrote:

                ForumVisual C++ / MFC Subject:Re: Need to make a button (or checkbox) invisible.. Sender:normanS Date:15:44 16 May '07 with the "in" and "out" buttons the colour of the dialog box.

                This is a problem for me due that I have an ActiveX control beneath (2D Graph ActiveX Control[^]) has its background changing all the time... therefore making the "invisible button" follow these changes is not easy. :( The solution may be to use a "rectangle" and add some code to intercept when the user clicks on the mouse over it, and if it is in the rectangle do something otherwise call the 2D Graph ActiveX Control[^] handler for the mouse click. (But I'm not sure if this will work)

                -- **Ricky Marek** (_AKA: rbid_) -- "Things are only impossible until they are not" --- Jean-Luc Picard My articles

                N Offline
                N Offline
                normanS
                wrote on last edited by
                #7

                OK, now that I've clicked on your "My articles" link, I guess I'm not qualified to advise you on the use of owner-drawn buttons! Good thing I said my knowledge was based on having thought about using them. Maybe I should read your article to see how to make them work . . .

                1 Reply Last reply
                0
                • R rbid

                  Mark Salsbery wrote:

                  ForumVisual C++ / MFC Subject:Re: Need to make a button (or checkbox) invisible.. Sender:Mark Salsbery Date:13:47 16 May '07 If it's an option, it seems to me it's easier to just intercept WM_LBUTTONDOWN notification messages and check for the cursor being in a certain region. A simple flag to toggle can keep the expert/novice state. Mark

                  Thanks Mark, Now, how do you intercept the WM_LBUTTONDOWN notification from the main window before the control beneath will intercept and handle it? I have an ActiveX control beneath. (2D Graph ActiveX Control[^])? If this is not possible, can I intercept the notification after the control beneath? Thanks in advance.

                  -- **Ricky Marek** (_AKA: rbid_) -- "Things are only impossible until they are not" --- Jean-Luc Picard My articles

                  M Offline
                  M Offline
                  Mark Salsbery
                  wrote on last edited by
                  #8

                  Well I didn't know there was a control beneath where you need to click :) In that case you'd need to catch it at the control since that's where the click message goes. So I guess in that case, maybe an owner-drawn control that draws nothing is a worthwile solution. Mark

                  "Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder

                  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