How to Create Radio buttons dynamically
-
This should be a general question like " how to create dialog item dynamically?" but since i am currently working with radio buttons, i choose to make specific. The context that i am in is that i have defined a combo box with different types of information, and the combo box selection is dynamically calculated. For example, if "name" is selected, i need to draw an edit control beside the combo box.while if "sick?" is selected, two radio buttons are required to answer yes or no. I hope i have explained it clearly. Can anybody help me to solve this problem? Any help will be greatly appreciated.
-
This should be a general question like " how to create dialog item dynamically?" but since i am currently working with radio buttons, i choose to make specific. The context that i am in is that i have defined a combo box with different types of information, and the combo box selection is dynamically calculated. For example, if "name" is selected, i need to draw an edit control beside the combo box.while if "sick?" is selected, two radio buttons are required to answer yes or no. I hope i have explained it clearly. Can anybody help me to solve this problem? Any help will be greatly appreciated.
If you know how many radio buttons will be needed, why not put them on the form, and show/hide them with ShowWindow ? Otherwise, you can create a new RadioButton using it's constructor. Christian Graus - Microsoft MVP - C++
-
If you know how many radio buttons will be needed, why not put them on the form, and show/hide them with ShowWindow ? Otherwise, you can create a new RadioButton using it's constructor. Christian Graus - Microsoft MVP - C++
Thanks... I have considered the idea of hiding, but it may not be suitable for this problem since the combo box will have a lot of types that require large number of radio buttons or check boxes. Anyway, i will try the hiding method first. Thanks again~ By the way, do you know how to set cursor position in an Edit control? I tried using setsel() function, but nothing appears...
-
Thanks... I have considered the idea of hiding, but it may not be suitable for this problem since the combo box will have a lot of types that require large number of radio buttons or check boxes. Anyway, i will try the hiding method first. Thanks again~ By the way, do you know how to set cursor position in an Edit control? I tried using setsel() function, but nothing appears...
You need to have the number of characters before you can set the position ( i.e. if the edit box is empty, then the cursor has nowhere to go ). I'm pretty sure that setsel is the way to go. Christian Graus - Microsoft MVP - C++
-
You need to have the number of characters before you can set the position ( i.e. if the edit box is empty, then the cursor has nowhere to go ). I'm pretty sure that setsel is the way to go. Christian Graus - Microsoft MVP - C++
-
About the original topic again... if i use showwindow(),how can i hide them later? and for Edit control, which method should be used to hide them~
-
Sorry, I was in a meeting :-) Christian Graus - Microsoft MVP - C++
-
If you know how many radio buttons will be needed, why not put them on the form, and show/hide them with ShowWindow ? Otherwise, you can create a new RadioButton using it's constructor. Christian Graus - Microsoft MVP - C++
Christian Graus wrote: If you know how many radio buttons will be needed, why not put them on the form, and show/hide them with ShowWindow ? I agree. One of my applications does this, and trying to create/manage the controls at runtime would be a nightmare.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown