Subclassing
-
Hi fellows, I have a CStatic-derived class. When I get the WM_LBUTTONDOWN message, I change the current bitmap into another one, and restore them in the WM_LBUTTONUP message. It woks fine. Then I include it in my CDialog-derived class using DDX. However, when I add the ON_STN_CLICKED to the message map of my dialog, it does not receive any message. I assume that is because the control already managed te WM_LBUTTONDOWN message. What can I do about it? Prehaps I need to do some subclassing? Any thoughts will be really appreciated. Regards, FG. A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.
-
Hi fellows, I have a CStatic-derived class. When I get the WM_LBUTTONDOWN message, I change the current bitmap into another one, and restore them in the WM_LBUTTONUP message. It woks fine. Then I include it in my CDialog-derived class using DDX. However, when I add the ON_STN_CLICKED to the message map of my dialog, it does not receive any message. I assume that is because the control already managed te WM_LBUTTONDOWN message. What can I do about it? Prehaps I need to do some subclassing? Any thoughts will be really appreciated. Regards, FG. A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.
Are you wanting the
WM_LBUTTONDOWN
message to be handled in both the control class and in the dialog class? Have you seen this?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
-
Hi fellows, I have a CStatic-derived class. When I get the WM_LBUTTONDOWN message, I change the current bitmap into another one, and restore them in the WM_LBUTTONUP message. It woks fine. Then I include it in my CDialog-derived class using DDX. However, when I add the ON_STN_CLICKED to the message map of my dialog, it does not receive any message. I assume that is because the control already managed te WM_LBUTTONDOWN message. What can I do about it? Prehaps I need to do some subclassing? Any thoughts will be really appreciated. Regards, FG. A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.
-
Hi fellows, I have a CStatic-derived class. When I get the WM_LBUTTONDOWN message, I change the current bitmap into another one, and restore them in the WM_LBUTTONUP message. It woks fine. Then I include it in my CDialog-derived class using DDX. However, when I add the ON_STN_CLICKED to the message map of my dialog, it does not receive any message. I assume that is because the control already managed te WM_LBUTTONDOWN message. What can I do about it? Prehaps I need to do some subclassing? Any thoughts will be really appreciated. Regards, FG. A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.
Fernando A. Gómez F. wrote:
I assume that is because the control already managed te WM_LBUTTONDOWN message. What can I do about it?
Maybe. Read some MSDN articles on MFC message routing.
Fernando A. Gómez F. wrote:
What can I do about it?
Lots of things. Since you have a custom control "CStatic-derived class" you can define a message that you post that the parent dialog can handle. Or you can do more of a Observer/Observable Design Pattern.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
Colin Angus Mackay in the C# forumled mike
-
Hi fellows, I have a CStatic-derived class. When I get the WM_LBUTTONDOWN message, I change the current bitmap into another one, and restore them in the WM_LBUTTONUP message. It woks fine. Then I include it in my CDialog-derived class using DDX. However, when I add the ON_STN_CLICKED to the message map of my dialog, it does not receive any message. I assume that is because the control already managed te WM_LBUTTONDOWN message. What can I do about it? Prehaps I need to do some subclassing? Any thoughts will be really appreciated. Regards, FG. A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.
-
Hi fellows, I have a CStatic-derived class. When I get the WM_LBUTTONDOWN message, I change the current bitmap into another one, and restore them in the WM_LBUTTONUP message. It woks fine. Then I include it in my CDialog-derived class using DDX. However, when I add the ON_STN_CLICKED to the message map of my dialog, it does not receive any message. I assume that is because the control already managed te WM_LBUTTONDOWN message. What can I do about it? Prehaps I need to do some subclassing? Any thoughts will be really appreciated. Regards, FG. A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.
See for subclassing maybe it is some helpful to you This article explains how to subclass controls so that they act and look the way you desire. It uses a listbox as an example.[^] of course its for listbox_**
**_
whitesky
-
In your CStatic derived class' WM_LBUTTONUP and WM_LBUTTONDOWN handlers try placing a call to
Default()
.
You may be right
I may be crazy
-- Billy Joel --Within you lies the power for good, use it!!!
Didn't work... :(( A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.
-
Fernando A. Gómez F. wrote:
I assume that is because the control already managed te WM_LBUTTONDOWN message. What can I do about it?
Maybe. Read some MSDN articles on MFC message routing.
Fernando A. Gómez F. wrote:
What can I do about it?
Lots of things. Since you have a custom control "CStatic-derived class" you can define a message that you post that the parent dialog can handle. Or you can do more of a Observer/Observable Design Pattern.
"Just about every question you've asked over the last 3-4 days has been "urgent". Perhaps a little planning would be helpful?"
Colin Angus Mackay in the C# forumled mike
I think I'll try your approach. Thanks a lot. Regards, FG. A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.