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. really simple button question

really simple button question

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
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.
  • J Offline
    J Offline
    Jared Allen
    wrote on last edited by
    #1

    I've looked around for some example code for how to add a button ( or any other control) to a custom control which is based on a CWnd. All the examples are for adding buttons and stuff to dialogs. which is simple and easy and I'm sure this is to - i just want to get it done the right way. CButton m_Button; m_Button.Create( ...? ...? what is needed? (not useing a dialog) thanks

    W E 2 Replies Last reply
    0
    • J Jared Allen

      I've looked around for some example code for how to add a button ( or any other control) to a custom control which is based on a CWnd. All the examples are for adding buttons and stuff to dialogs. which is simple and easy and I'm sure this is to - i just want to get it done the right way. CButton m_Button; m_Button.Create( ...? ...? what is needed? (not useing a dialog) thanks

      W Offline
      W Offline
      Wolfram Steinke
      wrote on last edited by
      #2

      I'm not sure what it is you wish to achieve? A composite control that consists of a button and something else? Where you create that button will also depend on which you parent is going be. Pleas give a little more information. Happy programming!!

      1 Reply Last reply
      0
      • J Jared Allen

        I've looked around for some example code for how to add a button ( or any other control) to a custom control which is based on a CWnd. All the examples are for adding buttons and stuff to dialogs. which is simple and easy and I'm sure this is to - i just want to get it done the right way. CButton m_Button; m_Button.Create( ...? ...? what is needed? (not useing a dialog) thanks

        E Offline
        E Offline
        Erik Funkenbusch
        wrote on last edited by
        #3

        I hate to say this, but I don't understand how the documentation could be any clearer on this. m_Button.Create("OK", WS_VISIBLE|WS_CHILD, CRect(0,0,100,100), &m_the_control_i_want_as_parent, THE_ID_I_WANT_TO_USE_FOR_THIS_CONTROL); About the only two things in there that might be confusing are the styles, (which need only specify that the control should be shown (WS_VISIBLE) and that it's a child control (WS_CHILD)) and the ID, which usually MSDev creates for you. You just pick and ID that's unique to this dialog and use it. Now, this should work fine as long as the control you using as a parent doesn't blit over you with drawing code.

        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