Thread: Dialog box

  1. #1
    Registered User
    Join Date
    Dec 2001

    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,


  2. #2
    Registered User
    Join Date
    Aug 2002
    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.
    Best Regards,


  3. #3
    Registered User
    Join Date
    Dec 2001
    I'm pretty famous for making it worse than it needs to be.


    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.


  4. #4
    Registered User
    Join Date
    Nov 2001
    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.


Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 02-13-2008, 02:59 PM
  2. Parent of a BrowseForFolder dialog box
    By @nthony in forum Windows Programming
    Replies: 4
    Last Post: 01-08-2007, 02:54 PM
  3. Display Dialog Box Then Execute
    By stickman in forum C++ Programming
    Replies: 17
    Last Post: 05-10-2006, 11:02 AM
  4. New Theme
    By XSquared in forum A Brief History of
    Replies: 160
    Last Post: 04-01-2004, 08:00 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM