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. Control subclassing

Control subclassing

Scheduled Pinned Locked Moved C / C++ / MFC
c++question
3 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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I develop an MFC application, a plain simple window (non-doc View). I want to add an edit child control on this parent window. For this purpose i need to call CEdit::Create() in order to place control. Now, I want to change the behaviour of edit control, for this purpose i derive my own class myedit from CEdit i.e class myedit:public CEdit. Then i add the member variable of myedit, m_myedit in project. Now do i need to call m_myedit.SubclassWindow() before calling m_myedit.Create() ???? Under what cases we need to call SubclassWindow/SubClassDlgItem() ????

    S T 2 Replies Last reply
    0
    • L Lost User

      I develop an MFC application, a plain simple window (non-doc View). I want to add an edit child control on this parent window. For this purpose i need to call CEdit::Create() in order to place control. Now, I want to change the behaviour of edit control, for this purpose i derive my own class myedit from CEdit i.e class myedit:public CEdit. Then i add the member variable of myedit, m_myedit in project. Now do i need to call m_myedit.SubclassWindow() before calling m_myedit.Create() ???? Under what cases we need to call SubclassWindow/SubClassDlgItem() ????

      S Offline
      S Offline
      Shog9 0
      wrote on last edited by
      #2

      Shah Shehpori wrote: Now do i need to call m_myedit.SubclassWindow() before calling m_myedit.Create() ? Nope! MFC takes care of subclassing the control as it is created when you call Create(). Shah Shehpori wrote: Under what cases we need to call SubclassWindow/SubClassDlgItem() ? If the control were already created but did not have an MFC class attached to it, you would then need to sublclass it in order for your custom class to receive messages sent to it. ---

      My whole life I've practiced the art of self-sabotage -- fearing success perhaps even more than fearing failure. I think I have got this flareup resolved, but I'm constantly waiting to see what new and exciting ways I can spoil my chances for a better life. - koreykruse, Compulsive Skin Picking

      1 Reply Last reply
      0
      • L Lost User

        I develop an MFC application, a plain simple window (non-doc View). I want to add an edit child control on this parent window. For this purpose i need to call CEdit::Create() in order to place control. Now, I want to change the behaviour of edit control, for this purpose i derive my own class myedit from CEdit i.e class myedit:public CEdit. Then i add the member variable of myedit, m_myedit in project. Now do i need to call m_myedit.SubclassWindow() before calling m_myedit.Create() ???? Under what cases we need to call SubclassWindow/SubClassDlgItem() ????

        T Offline
        T Offline
        TomKat
        wrote on last edited by
        #3

        be deriving a control when you set the veriable type to the derived type the sublassing is automatic . on presubclasswindow() { //make any modifications before your control is subclassed } I am the mighty keeper of the book on knowledge . Contact me to get your copy .

        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