Why my four radio buttons show up but no text next to them?
-
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
-
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
what value is ctrlRect initialized with?
-
what value is ctrlRect initialized with?
-
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
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?
-
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?
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:
-
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:
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.