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. Dialog Box Problem

Dialog Box Problem

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
4 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.
  • M Offline
    M Offline
    mvworld
    wrote on last edited by
    #1

    I have a dialog based application which the user accesses through a password. Now there are 2 categories of users and depending on the login and password the application has to display 2 different user screens. How do I do this? Also when I first wrote this application I had just one user in mind so all the code is present in the dialog class CApplicationDlg. Is it possible for me to hide all the controls on this dialog box and create a new user screen on the same dialog box when the 2nd user type logs in? Thanks Mike.

    J 1 Reply Last reply
    0
    • M mvworld

      I have a dialog based application which the user accesses through a password. Now there are 2 categories of users and depending on the login and password the application has to display 2 different user screens. How do I do this? Also when I first wrote this application I had just one user in mind so all the code is present in the dialog class CApplicationDlg. Is it possible for me to hide all the controls on this dialog box and create a new user screen on the same dialog box when the 2nd user type logs in? Thanks Mike.

      J Offline
      J Offline
      Joaquin M Lopez Munoz
      wrote on last edited by
      #2

      Well, I guess the simplest way to get this done, given the original design of your project, is as follows:

      1. Create two sets of controls for each user profile and merge them into the only dialog resource. You'll end up with a mess of overlapping controls, so you might want to do the work separately in auxiliary dialog resources and then copy and paste to the final destination. On the process some controls will be shared (i.e., they exist for both user profiles), keep that in mind and do not duplicate them.
      2. Have all the controls hidden by default. If you select Test on the Resource menu, the dialog should appear empty.
      3. Have two static arrays defined for your CDialog class, each specifying the IDs of the controls that should appear for the corresponding user profile.
      4. Add a variable to the constructor of your CDialog class indicating the user profile.
      5. In OninitDialog you just have to walk thorugh the appropriate array of control IDs and call GetDlgItem(id)->ShowWindow(SW_SHOW).

      Hope this helps. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

      M 1 Reply Last reply
      0
      • J Joaquin M Lopez Munoz

        Well, I guess the simplest way to get this done, given the original design of your project, is as follows:

        1. Create two sets of controls for each user profile and merge them into the only dialog resource. You'll end up with a mess of overlapping controls, so you might want to do the work separately in auxiliary dialog resources and then copy and paste to the final destination. On the process some controls will be shared (i.e., they exist for both user profiles), keep that in mind and do not duplicate them.
        2. Have all the controls hidden by default. If you select Test on the Resource menu, the dialog should appear empty.
        3. Have two static arrays defined for your CDialog class, each specifying the IDs of the controls that should appear for the corresponding user profile.
        4. Add a variable to the constructor of your CDialog class indicating the user profile.
        5. In OninitDialog you just have to walk thorugh the appropriate array of control IDs and call GetDlgItem(id)->ShowWindow(SW_SHOW).

        Hope this helps. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

        M Offline
        M Offline
        mvworld
        wrote on last edited by
        #3

        I figured that out thanks. But the problem now is that I need a menu bar for one user category and no menu for the other user category. By default the dialog box loads a menu bar, and I want to remove it when the user 2 enters. So I did the following CMenu* menu = GetSystemMenu(TRUE); menu->DestroyMenu(); But the program crashes! What do I do? Thanks, Mike

        J 1 Reply Last reply
        0
        • M mvworld

          I figured that out thanks. But the problem now is that I need a menu bar for one user category and no menu for the other user category. By default the dialog box loads a menu bar, and I want to remove it when the user 2 enters. So I did the following CMenu* menu = GetSystemMenu(TRUE); menu->DestroyMenu(); But the program crashes! What do I do? Thanks, Mike

          J Offline
          J Offline
          Joaquin M Lopez Munoz
          wrote on last edited by
          #4

          Well, maybe you can do it the other way around: by default have no menu in your dialog, and set it when needed with SetMenu. Joaquín M López Muñoz Telefónica, Investigación y Desarrollo

          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