Dynamic Loading Of Portions of Controls(List Boxes, List Controls, Edit Boxes) in a Dialog
-
Can someone give me a link to implementing various control within a dialog dynamically. I need at times to replace existing controls in a dialog, with different controls depending on User selections.
A C++ programming language novice, but striving to learn
-
Can someone give me a link to implementing various control within a dialog dynamically. I need at times to replace existing controls in a dialog, with different controls depending on User selections.
A C++ programming language novice, but striving to learn
CreateWindow
[^] function is the key to your success. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Can someone give me a link to implementing various control within a dialog dynamically. I need at times to replace existing controls in a dialog, with different controls depending on User selections.
A C++ programming language novice, but striving to learn
You can either place all the controls that you will ever be using in the dialog template and hide/show them as required or use the CreateWindow[^] API with the predefined class names as described in the remarks section.
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
You can either place all the controls that you will ever be using in the dialog template and hide/show them as required or use the CreateWindow[^] API with the predefined class names as described in the remarks section.
«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)I understand what you are saying, I think. Ex. one useage requires a large listbox while another selection would require a large editbox. You are saying that while the dialog is displayed? I can change what is presented? Or must I close the dialog after the User made a selection and then reload it with the proper controls in place according to the User's previous selections?
A C++ programming language novice, but striving to learn
-
I understand what you are saying, I think. Ex. one useage requires a large listbox while another selection would require a large editbox. You are saying that while the dialog is displayed? I can change what is presented? Or must I close the dialog after the User made a selection and then reload it with the proper controls in place according to the User's previous selections?
A C++ programming language novice, but striving to learn
Yes, you can change what is displayed on the dialog without closing and reopening. For example - The following will hide the list box and show the edit box.
GetDlgItem(IDC_LIST1)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_EDIT1)->ShowWindow(SW_SHOW);«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) -
Yes, you can change what is displayed on the dialog without closing and reopening. For example - The following will hide the list box and show the edit box.
GetDlgItem(IDC_LIST1)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_EDIT1)->ShowWindow(SW_SHOW);«_Superman_» I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)Thank you so much for your help. This really sovles my situation.
A C++ programming language novice, but striving to learn
-
Can someone give me a link to implementing various control within a dialog dynamically. I need at times to replace existing controls in a dialog, with different controls depending on User selections.
A C++ programming language novice, but striving to learn
I find the best way to handle this is to create all of the controls you'll need and then just enable/disable them at runtime.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
I find the best way to handle this is to create all of the controls you'll need and then just enable/disable them at runtime.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
Thanks again for the information.
A C++ programming language novice, but striving to learn