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. Why my four radio buttons show up but no text next to them?

Why my four radio buttons show up but no text next to them?

Scheduled Pinned Locked Moved C / C++ / MFC
performancehelpquestionlounge
6 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.
  • T Offline
    T Offline
    tm
    wrote on last edited by
    #1

    I am creating these four radio buttons dynamically. The behavior is so random and confusing. At some point I got some text, and then I can't get it anymore. I have been told by friends at this forum that maybe the width is not enough, one time that fixed the problem but not anymore!!!!!!! Here is the code: if (OneGrpPosition != NULL) { pConfig->m_OneRadioBtn = (CRadioBtn *) (((CGrpBox*)pConfig->m_OneGrpBox)->m_GrpRadioBtn).GetNext(OneGrpPosition); int len= ctrlRect.right - ctrlRect.left; ctrlRect.right = ctrlRect.left +len+ 60; if (ctrlRect.right >= 542) ::MessageBox(0, "Running out of screen width to display radio button", "Warning", MB_OK); ctrlRect.bottom = ctrlRect.top + 25; if (nDex == 0) // { m_RadioButtonArray[nDex].Create((pConfig->m_OneRadioBtn)->m_RadioLabel, WS_GROUP | WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, ctrlRect,this, (pConfig->m_OneRadioBtn)->m_RadioGuiID ); m_RadioButtonArray[nDex].SetFont(&m_font, TRUE); } else { m_RadioButtonArray[nDex].Create((pConfig->m_OneRadioBtn)->m_RadioLabel,WS_CHILD| WS_VISIBLE | BS_AUTORADIOBUTTON, ctrlRect,this,(pConfig->m_OneRadioBtn)->m_RadioGuiID); m_RadioButtonArray[nDex].SetFont(&m_font, TRUE); } nDex= nDex+1; ctrlRect.left = ctrlRect.right +10; //This radio button has already been added to the memory structure } } //This ia a new radio button that needs to be added to the memory structure } I am in Paradise. Voltaire

    P 1 Reply Last reply
    0
    • T tm

      I am creating these four radio buttons dynamically. The behavior is so random and confusing. At some point I got some text, and then I can't get it anymore. I have been told by friends at this forum that maybe the width is not enough, one time that fixed the problem but not anymore!!!!!!! Here is the code: if (OneGrpPosition != NULL) { pConfig->m_OneRadioBtn = (CRadioBtn *) (((CGrpBox*)pConfig->m_OneGrpBox)->m_GrpRadioBtn).GetNext(OneGrpPosition); int len= ctrlRect.right - ctrlRect.left; ctrlRect.right = ctrlRect.left +len+ 60; if (ctrlRect.right >= 542) ::MessageBox(0, "Running out of screen width to display radio button", "Warning", MB_OK); ctrlRect.bottom = ctrlRect.top + 25; if (nDex == 0) // { m_RadioButtonArray[nDex].Create((pConfig->m_OneRadioBtn)->m_RadioLabel, WS_GROUP | WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON, ctrlRect,this, (pConfig->m_OneRadioBtn)->m_RadioGuiID ); m_RadioButtonArray[nDex].SetFont(&m_font, TRUE); } else { m_RadioButtonArray[nDex].Create((pConfig->m_OneRadioBtn)->m_RadioLabel,WS_CHILD| WS_VISIBLE | BS_AUTORADIOBUTTON, ctrlRect,this,(pConfig->m_OneRadioBtn)->m_RadioGuiID); m_RadioButtonArray[nDex].SetFont(&m_font, TRUE); } nDex= nDex+1; ctrlRect.left = ctrlRect.right +10; //This radio button has already been added to the memory structure } } //This ia a new radio button that needs to be added to the memory structure } I am in Paradise. Voltaire

      P Offline
      P Offline
      Paolo Messina
      wrote on last edited by
      #2

      what value is ctrlRect initialized with?

      T 1 Reply Last reply
      0
      • P Paolo Messina

        what value is ctrlRect initialized with?

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

        top=35 bottom=60 L=120 R=220 I have tried L=120 and Right = 170 through 220. It is really confusing. Thanks for your time I am in Paradise. Voltaire

        P 1 Reply Last reply
        0
        • T tm

          top=35 bottom=60 L=120 R=220 I have tried L=120 and Right = 170 through 220. It is really confusing. Thanks for your time I am in Paradise. Voltaire

          P Offline
          P Offline
          Paolo Messina
          wrote on last edited by
          #4

          Are you sure the radio buttons gets created? Can you see the dot? the if clause in your code is doing the same for both conditions... why?

          L 1 Reply Last reply
          0
          • P Paolo Messina

            Are you sure the radio buttons gets created? Can you see the dot? the if clause in your code is doing the same for both conditions... why?

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            Yes, I see all my four radio buttons are being created. The first one is different from the other three, because I need to have them in a group. Meaning if I click on of them the other three are unselected. I do see the four of them being created. But no text next to them. I am thinking of just creating the first one to see if the text displays there. It is a weird one. I really am looking forward to solve this one!! Thanks again for your time.:rolleyes:

            P 1 Reply Last reply
            0
            • L Lost User

              Yes, I see all my four radio buttons are being created. The first one is different from the other three, because I need to have them in a group. Meaning if I click on of them the other three are unselected. I do see the four of them being created. But no text next to them. I am thinking of just creating the first one to see if the text displays there. It is a weird one. I really am looking forward to solve this one!! Thanks again for your time.:rolleyes:

              P Offline
              P Offline
              Paolo Messina
              wrote on last edited by
              #6

              It's very weird, but to my experiece this kind of bugs are really stupid. Did you tried to use a hard-coded CRect for the creation, just to make sure it's not something else? However, if you would send me a small demo project, I'll give it a look. I hate this kind of bugs! :) Paolo.

              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