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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Custom control problem

Custom control problem

Scheduled Pinned Locked Moved C / C++ / MFC
help
6 Posts 4 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
    followait
    wrote on last edited by
    #1

    The custom control is associated with a class derived from CScrollView, works fine, but when I try to handle WM_CREATE in OnCreate, I found that OnCreate isn't called. I don't know where to put the initial code after the control is created and before displayed. Thanks for help.

    A PJ ArendsP 2 Replies Last reply
    0
    • F followait

      The custom control is associated with a class derived from CScrollView, works fine, but when I try to handle WM_CREATE in OnCreate, I found that OnCreate isn't called. I don't know where to put the initial code after the control is created and before displayed. Thanks for help.

      A Offline
      A Offline
      Allad
      wrote on last edited by
      #2

      You can try to call CView::OnInitialUpdate It is called before the control is displayed. Cheers, Allad

      F 1 Reply Last reply
      0
      • F followait

        The custom control is associated with a class derived from CScrollView, works fine, but when I try to handle WM_CREATE in OnCreate, I found that OnCreate isn't called. I don't know where to put the initial code after the control is created and before displayed. Thanks for help.

        PJ ArendsP Offline
        PJ ArendsP Offline
        PJ Arends
        wrote on last edited by
        #3

        If your custom control is on a dialog or form view (created from a dialog template) then your class's OnCreate() is never called. That is because the contol window is created when the dialog is created, and then your control subclasses the window. Use PreSubclassWindow to handle the code that you would normally handle in OnCreate.


        "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!

        Within you lies the power for good; Use it!

        F 1 Reply Last reply
        0
        • A Allad

          You can try to call CView::OnInitialUpdate It is called before the control is displayed. Cheers, Allad

          F Offline
          F Offline
          followait
          wrote on last edited by
          #4

          It's not called either. PreSubClassWindow is ok.

          L 1 Reply Last reply
          0
          • PJ ArendsP PJ Arends

            If your custom control is on a dialog or form view (created from a dialog template) then your class's OnCreate() is never called. That is because the contol window is created when the dialog is created, and then your control subclasses the window. Use PreSubclassWindow to handle the code that you would normally handle in OnCreate.


            "You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ???  You're definitely a superstar!!!" - mYkel - 21 Jun '04 "There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05 Within you lies the power for good - Use it!

            F Offline
            F Offline
            followait
            wrote on last edited by
            #5

            Thanks for your help.

            1 Reply Last reply
            0
            • F followait

              It's not called either. PreSubClassWindow is ok.

              L Offline
              L Offline
              Lane Yu
              wrote on last edited by
              #6

              Because when your class is ready to handle messages, the control has already been created. So you should insert your initlizing code in PreSubClassWindow().

              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