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. How to Display Radio button dynamically on Dialog.

How to Display Radio button dynamically on Dialog.

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorial
5 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.
  • H Offline
    H Offline
    hemlat
    wrote on last edited by
    #1

    Hi, I have written following code in my MFC code to display Radio Button on my dialog.

    CButton myButton;
    myButton.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_RADIOBUTTON,
    CRect(50,40,80,70),this, 1);

    But Dialog is not showing Radio button.Can anyone help me.

    L E 2 Replies Last reply
    0
    • H hemlat

      Hi, I have written following code in my MFC code to display Radio Button on my dialog.

      CButton myButton;
      myButton.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_RADIOBUTTON,
      CRect(50,40,80,70),this, 1);

      But Dialog is not showing Radio button.Can anyone help me.

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

      There are a number of things that could be the reason. Definitively know from your post we cannot. My advice is that you learn how rendering is done in Windows OS which will enable you to determine your specific problem.

      1 Reply Last reply
      0
      • H hemlat

        Hi, I have written following code in my MFC code to display Radio Button on my dialog.

        CButton myButton;
        myButton.Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_RADIOBUTTON,
        CRect(50,40,80,70),this, 1);

        But Dialog is not showing Radio button.Can anyone help me.

        E Offline
        E Offline
        Electron Shepherd
        wrote on last edited by
        #3

        What function is this code in? My guess would be that myButton is going out of scope and being destroyed just after it's been created.

        Server and Network Monitoring

        H 1 Reply Last reply
        0
        • E Electron Shepherd

          What function is this code in? My guess would be that myButton is going out of scope and being destroyed just after it's been created.

          Server and Network Monitoring

          H Offline
          H Offline
          hemlat
          wrote on last edited by
          #4

          Thanks for your reply.Previously myButton is local variable in OnInitDialog function. I have changed it to member variable and I have allocated memory.It is working fine and it is displaying Radio Button. I have changed this to Push Button. I need to add Event Handler to this Button.Can any one help me.

          modified on Thursday, March 26, 2009 12:17 AM

          M 1 Reply Last reply
          0
          • H hemlat

            Thanks for your reply.Previously myButton is local variable in OnInitDialog function. I have changed it to member variable and I have allocated memory.It is working fine and it is displaying Radio Button. I have changed this to Push Button. I need to add Event Handler to this Button.Can any one help me.

            modified on Thursday, March 26, 2009 12:17 AM

            M Offline
            M Offline
            mutpan
            wrote on last edited by
            #5

            you need to derive the new class from CButton and add the event handler in that class

            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