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. Subclassing

Subclassing

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsquestiondiscussion
8 Posts 6 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.
  • F Offline
    F Offline
    Fernando A Gomez F
    wrote on last edited by
    #1

    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.

    D V L P H 5 Replies Last reply
    0
    • F Fernando A Gomez F

      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.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • F Fernando A Gomez F

        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.

        V Offline
        V Offline
        valikac
        wrote on last edited by
        #3

        one possible approach send dialog messages inside control derived class Kuphryn

        1 Reply Last reply
        0
        • F Fernando A Gomez F

          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.

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          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# forum

          led mike

          F 1 Reply Last reply
          0
          • F Fernando A Gomez F

            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.

            P Offline
            P Offline
            PJ Arends
            wrote on last edited by
            #5

            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!!!

            F 1 Reply Last reply
            0
            • F Fernando A Gomez F

              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.

              H Offline
              H Offline
              Hamid Taebi
              wrote on last edited by
              #6

              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


              1 Reply Last reply
              0
              • P PJ Arends

                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!!!

                F Offline
                F Offline
                Fernando A Gomez F
                wrote on last edited by
                #7

                Didn't work... :(( A polar bear is a bear whose coordinates has been changed in terms of sine and cosine.

                1 Reply Last reply
                0
                • L led mike

                  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# forum

                  led mike

                  F Offline
                  F Offline
                  Fernando A Gomez F
                  wrote on last edited by
                  #8

                  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.

                  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