Need to make a button (or checkbox) invisible..
-
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 -
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 articlesIf 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
-
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 articlesIn 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. . .
-
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. . .
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 -
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
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 -
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 articlesAh - 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.
-
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 articlesOK, 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 . . .
-
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 articlesWell 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