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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. inter-dialog box communications

inter-dialog box communications

Scheduled Pinned Locked Moved C / C++ / MFC
questioncom
6 Posts 3 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
    Cam
    wrote on last edited by
    #1

    Ok, here goes...I've got a dialog-based application. From this application I have created a modeless dialog box. When the user closes the modeless dialog box, I need to access a variable within my main Dlg box's class, in order to save data from the modeless dlg box. So, as I see it, I need a pointer to it. How do I get a pointer to the Dlg class of a dialog-based app?? ~Cam Desautels (BinaryUprising.com)

    C 1 Reply Last reply
    0
    • C Cam

      Ok, here goes...I've got a dialog-based application. From this application I have created a modeless dialog box. When the user closes the modeless dialog box, I need to access a variable within my main Dlg box's class, in order to save data from the modeless dlg box. So, as I see it, I need a pointer to it. How do I get a pointer to the Dlg class of a dialog-based app?? ~Cam Desautels (BinaryUprising.com)

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Create the dialog with this as the parent (m_Modeless.Create(this);) and store the value, or call GetParent and cast the return to an instance of your dialog class. I tend to create modeless dialogs in the constructor, by doing this: if (Create IDD, pParent)) ShowWindow(SW_SHOW); and store my modeless dialogs as pointers. Then I can do this m_Modeless = new CMyModeless(this); // Dialog is now created. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

      Sonork ID 100.10002:MeanManOz

      I live in Bob's HungOut now

      G 1 Reply Last reply
      0
      • C Christian Graus

        Create the dialog with this as the parent (m_Modeless.Create(this);) and store the value, or call GetParent and cast the return to an instance of your dialog class. I tend to create modeless dialogs in the constructor, by doing this: if (Create IDD, pParent)) ShowWindow(SW_SHOW); and store my modeless dialogs as pointers. Then I can do this m_Modeless = new CMyModeless(this); // Dialog is now created. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

        Sonork ID 100.10002:MeanManOz

        I live in Bob's HungOut now

        G Offline
        G Offline
        Garth J Lancaster
        wrote on last edited by
        #3

        Christian - do you know if this would work with a Tabbed Dialog Box such as the one Derek Lakin presents 'CTabCtrlSSL' ? I need to do something like this, but only add a new dialog one at a time, depending on if the user presses 'continue' or 'ok' .. the problem is, the next dialog depends on a control in the previous one .. My first choice would be to create a global variable for each piece of data that needs to be passed from dialog to dialog (usually, there is only one control with the relevant data) - then when, for example 'ok' is pressed, it copies the required data from the control to the global variable. When the next dialog is initialised, it simply reads the global variable.. .. but maybe this isnt necessary/too long winded any ideas you and others have would be appreciated. thanks, and ho ho !!

        C 1 Reply Last reply
        0
        • G Garth J Lancaster

          Christian - do you know if this would work with a Tabbed Dialog Box such as the one Derek Lakin presents 'CTabCtrlSSL' ? I need to do something like this, but only add a new dialog one at a time, depending on if the user presses 'continue' or 'ok' .. the problem is, the next dialog depends on a control in the previous one .. My first choice would be to create a global variable for each piece of data that needs to be passed from dialog to dialog (usually, there is only one control with the relevant data) - then when, for example 'ok' is pressed, it copies the required data from the control to the global variable. When the next dialog is initialised, it simply reads the global variable.. .. but maybe this isnt necessary/too long winded any ideas you and others have would be appreciated. thanks, and ho ho !!

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          Do you mean a dialog box that contains other dialog boxes, tabbed ? I'm not familiar with the article, but any dialog you create should work using this method, however if the dialogs you refer to are all children of another dialog physically ( i.e. contained as children of another dialog ), then I'd look to the class that impliments that as to how you should deal with it. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

          Sonork ID 100.10002:MeanManOz

          I live in Bob's HungOut now

          G 1 Reply Last reply
          0
          • C Christian Graus

            Do you mean a dialog box that contains other dialog boxes, tabbed ? I'm not familiar with the article, but any dialog you create should work using this method, however if the dialogs you refer to are all children of another dialog physically ( i.e. contained as children of another dialog ), then I'd look to the class that impliments that as to how you should deal with it. Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

            Sonork ID 100.10002:MeanManOz

            I live in Bob's HungOut now

            G Offline
            G Offline
            Garth J Lancaster
            wrote on last edited by
            #5

            Thanks Christian .. Im just re-reading the article now, and having a poke at the code, to try and determine exactely what's going on under the skin ... The Article Header says "An extended tab control that allows tab pages to be added from dialog resources" .. Basically, you start with a 'parent' dialog, and then any other 'Tab' you add seems to be a 'child' dialog, but I'll have to verify that in the actual code I guess thanks for your help G :-D

            C 1 Reply Last reply
            0
            • G Garth J Lancaster

              Thanks Christian .. Im just re-reading the article now, and having a poke at the code, to try and determine exactely what's going on under the skin ... The Article Header says "An extended tab control that allows tab pages to be added from dialog resources" .. Basically, you start with a 'parent' dialog, and then any other 'Tab' you add seems to be a 'child' dialog, but I'll have to verify that in the actual code I guess thanks for your help G :-D

              C Offline
              C Offline
              Christian Graus
              wrote on last edited by
              #6

              No worries. Does mbf.com.au mean you work for the health fund my wife has joined ? Do you get a sweet flat screen, or is that just the people at the front desk ? :-D Christian After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001

              Sonork ID 100.10002:MeanManOz

              I live in Bob's HungOut now

              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