-
Dialog box
I'm feeling kind of dumb right now because I can't seem to make this work.
I'm trying to create an SDI program that has a popup menu with one selection that takes you to a dialog box with a combo box with four selections. Each selection will print out a sentence onto the mainframe area. Got the popup menu, it brings up the dialog box fine. Where I'm having trouble is getting the selection in the dialog box to print out what it's supposed to.
I'm working along the lines of having a CMap variable that represents the selection, then going to the OnDraw function and having it print out from there. Of course, this isn't working. Can anyone give me some steps to point me in the right direction in getting this done? I'm a complete novice, of course. Should I just be bringing up the dialog box with the code in the OnPopUpView and then trying to get the actual selecting done in the OnDraw function?
Thanks in advance,
Deana
-
It sounds like you are overcomplicating things. At least if this is an MSVC project.
If it is then simply use the classwizard to define variables for the comboboxes. Then set functions for OnUpdate (also done in class wizard).
When the box is updated you can then do whatever you need to make the appropriate updates. Either update variables in your view, call OnDraw, or whatever.
If you are not using MSVC then this won't really apply.
-
I'm pretty famous for making it worse than it needs to be.
So..
Give the combo box a variable in class wizard, say, m_combo, value, CString
Then give OnUpdate a function, and something like this (except without the various syntax errors that I'll work out)
CString szChoice;
if(m_combo == tropical) //tropical being one of the choices
{
szChoice = "You selected tropical";
}
..then using the szChoice variable in OnDraw for getting the sentence onto the screen.
Next question, having never worked with combo boxes, when I enter the list of data/choices, how do I go about assigning a variable for each of those items, or do I need to?
Thank you SO much for your help and patience.
Deana
-
A combo box holds a collection of data. You get a specific data from the box as you do from an container such as a vector.
Kuphryn