Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Creating dialogs

Creating dialogs

Scheduled Pinned Locked Moved C / C++ / MFC
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CaffeinePlease
    wrote on last edited by
    #1

    Help!!! I'm tring to create a dialog with the following two lines: I am string Number 1 I am string number 2 Now, depending on what the user selected beforehand is dependant on which of the above strings is dispplayed on the dialog. But how do you do it? This is a prelude to more sophisticated dialog, but I need to know how I can change the content of an individual dialog that is dependant on the users selection. Any help would be great. Regards John

    J 1 Reply Last reply
    0
    • C CaffeinePlease

      Help!!! I'm tring to create a dialog with the following two lines: I am string Number 1 I am string number 2 Now, depending on what the user selected beforehand is dependant on which of the above strings is dispplayed on the dialog. But how do you do it? This is a prelude to more sophisticated dialog, but I need to know how I can change the content of an individual dialog that is dependant on the users selection. Any help would be great. Regards John

      J Offline
      J Offline
      Jeff Naber
      wrote on last edited by
      #2

      Hi John, I'm going to guess that you are using the Microsoft Foundation Classes (MFC 6) in the Visual Studio IDE, if this is not true, please specify your environment. If you go to the 'resources' tab in the 'workspace' you can add a new dialog by right-clicking on the 'dialog' folder in that area and selected 'Insert Dialog'. By right clicking on the new dialog box you can fill in the 'properties' of this dialog box. Name it something useful such as 'IDD_MAIN_DIALOG' that you will understand later. (using the IDD_ prefix will come in handy later if and when you want to create context sensitive help). On the dialog put two edit box controls (drag them from the 'controls' tool bar. In the property for each control, fill in the 'id' as something useful like IDC_FIRST_MESSAGE and IDC_SECOND_MESSAGE. (using the prefix of IDC_ comes in handy when you want to have context sensitive help). You can leave the OK and Cancel buttons there or remove them as necessary. Now that these edit boxes exist, Save the whole thing. Right click on the dialog box and selected 'Class Wizard'. It will ask you if you want to create a new class, say yes. You will inherit from CDialogBox. Name it something appropriate. Now when you go back to your 'Class View' tab in the Workspace, you will see that newly added class. You can add a function called OnInitDialog. When the dialog opens, after it is created, but before it is displayed it will run the OnInitDialog() function. You can check parameters here and use the commands 'SetWindowText()' to set up the values in each of the edit boxes before the window opens. I know this is a quick overview, but it should help to get you started, and as you have more specific questions you should be able to find what you are looking for in the documentation or by posting more specific questions out here. Hope this helps Jeff

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups