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 Displays Differently

Dialog Displays Differently

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
17 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.
  • R Reagan Conservative

    If I remove the template, then I get nothing when I call the keypad class. The operation of this application is quite large. I'm not sure if you have some idea of what an "Instructor Operating System (IOS)" is to a flight simulator, but it controls every aspect of the flight simulator as far as settings go. In order to use this system, it was decided that it should be user and password protected, so that not just anyone could enter the cockpit and use the simulator. Before I added the password protection modules, the keypad came up as it was designed (being the user design and not just the template). The user design uses some of the template and adds on to it's functionality. It would take paragraphs to fully explain the inner workings of this application, so I'm not sure that you might be able to come up with a viable suggestion as to how to make this work correctly. I was wondering if it was possible to 'create' the keypad at some other location that's not visible, and then delete it, so that when I call it again, it will not be the first time it has been called and created??

    John P.

    D Offline
    D Offline
    David Crow
    wrote on last edited by
    #4

    Are you using MFC?

    "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

    "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

    R 1 Reply Last reply
    0
    • D David Crow

      Are you using MFC?

      "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      R Offline
      R Offline
      Reagan Conservative
      wrote on last edited by
      #5

      Yes.

      John P.

      D 1 Reply Last reply
      0
      • R Reagan Conservative

        Yes.

        John P.

        D Offline
        D Offline
        David Crow
        wrote on last edited by
        #6

        Ok, so how are you instantiating and creating the "login" dialog?

        "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

        R 1 Reply Last reply
        0
        • D David Crow

          Ok, so how are you instantiating and creating the "login" dialog?

          "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          R Offline
          R Offline
          Reagan Conservative
          wrote on last edited by
          #7

          I create an instantiation of CLogin clog. This creates the login dialog which has text boxes for holding the UserID and PIN values. There are buttons to select the entry for the UserId and PIN and this in turn calls the Keypad dialog. When the user enters the UserID and PIN numbers, they are placed in the text boxes (one at a time).

          John P.

          D 1 Reply Last reply
          0
          • R Reagan Conservative

            I create an instantiation of CLogin clog. This creates the login dialog which has text boxes for holding the UserID and PIN values. There are buttons to select the entry for the UserId and PIN and this in turn calls the Keypad dialog. When the user enters the UserID and PIN numbers, they are placed in the text boxes (one at a time).

            John P.

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #8

            jparken wrote:

            I create an instantiation of CLogin clog.

            Do you then call Create(), CreateIndirect(), or InitModalIndirect()?

            "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

            R 1 Reply Last reply
            0
            • D David Crow

              jparken wrote:

              I create an instantiation of CLogin clog.

              Do you then call Create(), CreateIndirect(), or InitModalIndirect()?

              "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

              "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

              R Offline
              R Offline
              Reagan Conservative
              wrote on last edited by
              #9

              I don't call any of these, David. And none of these are called for Keypad as well.

              John P.

              D 1 Reply Last reply
              0
              • R Reagan Conservative

                I don't call any of these, David. And none of these are called for Keypad as well.

                John P.

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #10

                I guess I've failed to understand the problem. What is meant by "user design?"

                "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

                "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                R 1 Reply Last reply
                0
                • D David Crow

                  I guess I've failed to understand the problem. What is meant by "user design?"

                  "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

                  "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                  R Offline
                  R Offline
                  Reagan Conservative
                  wrote on last edited by
                  #11

                  I guess that was a poor choice of wording on my part. Almost all the dialogs have been created from a template. So I guess the proper terminology would be "owner drawn".

                  John P.

                  D 1 Reply Last reply
                  0
                  • R Reagan Conservative

                    I guess that was a poor choice of wording on my part. Almost all the dialogs have been created from a template. So I guess the proper terminology would be "owner drawn".

                    John P.

                    D Offline
                    D Offline
                    David Crow
                    wrote on last edited by
                    #12

                    Ok, so what is an "owner drawn" dialog, and how does it differ from a non-owner drawn dialog?

                    "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

                    "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                    R 1 Reply Last reply
                    0
                    • D David Crow

                      Ok, so what is an "owner drawn" dialog, and how does it differ from a non-owner drawn dialog?

                      "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

                      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                      R Offline
                      R Offline
                      Reagan Conservative
                      wrote on last edited by
                      #13

                      In order to explain that, I would have to enter the code for the module that from which just about all the other dialogs are derived. That would be a couple of pages of code that I doubt anyone would want me to paste on the Forum. Here's just a small example of what I'm referring to: const UINT CIosDialog::BTN_ID[CIosDialog::NUM_BUTTONS] = { IDC_BN_0, IDC_BN_1, IDC_BN_2, IDC_BN_3, IDC_BN_4, IDC_BN_5, IDC_BN_6, IDC_BN_7, IDC_BN_8, IDC_BN_9, IDC_BN_10, IDC_BN_11, IDC_BN_12, IDC_BN_13, IDC_BN_14, IDC_BN_15, IDC_BN_16, IDC_BN_17, IDC_BN_18, IDC_BN_19, IDC_BN_20, IDC_BN_21, IDC_BN_22, IDC_BN_23, IDC_BN_24, IDC_BN_25, IDC_BN_26, IDC_BN_27, IDC_BN_28, IDC_BN_29, IDC_BN_30, IDC_BN_31, IDC_BN_32, IDC_BN_33, IDC_BN_34, IDC_BN_35, IDC_BN_36, IDC_BN_37, IDC_BN_38, IDC_BN_39, IDC_BN_40, IDC_BN_41, IDC_BN_42, IDC_BN_43, IDC_BN_44, IDC_BN_45, IDC_BN_46, IDC_BN_47, IDC_BN_48, IDC_BN_49, IDC_BN_50, IDC_BN_51, IDC_BN_52, IDC_BN_53, IDC_BN_54, IDC_BN_55, IDC_BN_56, IDC_BN_57, IDC_BN_58, IDC_BN_59, IDC_BN_60, IDC_BN_61, IDC_BN_62, IDC_BN_63, IDC_BN_64, IDC_BN_65, IDC_BN_66, IDC_BN_67, IDC_BN_68, IDC_BN_69 }; The same is done for labels, text ids, etc. Then for example in another file: CEnvironmentControl::BTN_INFO_STRUCT CEnvironmentControl::btnInfo[] = { //******************* // Atmospheric control //******************* {true, IDB_BLUE_BTN_WIDE_OFF, IDB_BLUE_BTN_WIDE_ON, "B A R O P R E S S U R E\n-->\n", BaroPressure, CStringType, &baroPressureString,NULL,"", 0}, //&trainerData.baroPresString, NULL, "", 0}, {true, IDB_BLUE_BTN_WIDE_OFF, IDB_BLUE_BTN_WIDE_ON, "A I R P O R T T E M P\n-->\n", AirportTemp, FloatType, &trainerData.envInfo.CURRENT_AIRPORT_TEMP, NULL, " \272 C", 0}, {true, IDB_BLUE_BTN_WIDE_OFF, IDB_BLUE_BTN_WIDE_ON, "S U R F A C E W I N D S\n-->\n", SurfaceWinds, CStringType, &envData.surfaceWindsString, NULL, "", 0}, {true, IDB_BLUE_BTN_WIDE_OFF, IDB_BLUE_BTN_WIDE_ON, "A L O F T W I N D S\n( 8000' MIN ALTITUDE )\n-->\n", AloftWinds, CStringType, &envData.aloftWindsString, NULL, "", 0}, {true, IDB_BLUE_BTN_WIDE_OFF, IDB_BLUE_BTN_WIDE_ON, "W I N D G U S T S\n-->\n", WindGusts, FloatType, &envData.info.GUSTS, NULL, " kts", 0}, {true, IDB_BLUE_BTN_WIDE_OFF, IDB_BLUE_BTN_WIDE_ON, "T U R B U L E N C E\n-->\n", Turbulence, IntegerType, &

                      D 1 Reply Last reply
                      0
                      • R Reagan Conservative

                        In order to explain that, I would have to enter the code for the module that from which just about all the other dialogs are derived. That would be a couple of pages of code that I doubt anyone would want me to paste on the Forum. Here's just a small example of what I'm referring to: const UINT CIosDialog::BTN_ID[CIosDialog::NUM_BUTTONS] = { IDC_BN_0, IDC_BN_1, IDC_BN_2, IDC_BN_3, IDC_BN_4, IDC_BN_5, IDC_BN_6, IDC_BN_7, IDC_BN_8, IDC_BN_9, IDC_BN_10, IDC_BN_11, IDC_BN_12, IDC_BN_13, IDC_BN_14, IDC_BN_15, IDC_BN_16, IDC_BN_17, IDC_BN_18, IDC_BN_19, IDC_BN_20, IDC_BN_21, IDC_BN_22, IDC_BN_23, IDC_BN_24, IDC_BN_25, IDC_BN_26, IDC_BN_27, IDC_BN_28, IDC_BN_29, IDC_BN_30, IDC_BN_31, IDC_BN_32, IDC_BN_33, IDC_BN_34, IDC_BN_35, IDC_BN_36, IDC_BN_37, IDC_BN_38, IDC_BN_39, IDC_BN_40, IDC_BN_41, IDC_BN_42, IDC_BN_43, IDC_BN_44, IDC_BN_45, IDC_BN_46, IDC_BN_47, IDC_BN_48, IDC_BN_49, IDC_BN_50, IDC_BN_51, IDC_BN_52, IDC_BN_53, IDC_BN_54, IDC_BN_55, IDC_BN_56, IDC_BN_57, IDC_BN_58, IDC_BN_59, IDC_BN_60, IDC_BN_61, IDC_BN_62, IDC_BN_63, IDC_BN_64, IDC_BN_65, IDC_BN_66, IDC_BN_67, IDC_BN_68, IDC_BN_69 }; The same is done for labels, text ids, etc. Then for example in another file: CEnvironmentControl::BTN_INFO_STRUCT CEnvironmentControl::btnInfo[] = { //******************* // Atmospheric control //******************* {true, IDB_BLUE_BTN_WIDE_OFF, IDB_BLUE_BTN_WIDE_ON, "B A R O P R E S S U R E\n-->\n", BaroPressure, CStringType, &baroPressureString,NULL,"", 0}, //&trainerData.baroPresString, NULL, "", 0}, {true, IDB_BLUE_BTN_WIDE_OFF, IDB_BLUE_BTN_WIDE_ON, "A I R P O R T T E M P\n-->\n", AirportTemp, FloatType, &trainerData.envInfo.CURRENT_AIRPORT_TEMP, NULL, " \272 C", 0}, {true, IDB_BLUE_BTN_WIDE_OFF, IDB_BLUE_BTN_WIDE_ON, "S U R F A C E W I N D S\n-->\n", SurfaceWinds, CStringType, &envData.surfaceWindsString, NULL, "", 0}, {true, IDB_BLUE_BTN_WIDE_OFF, IDB_BLUE_BTN_WIDE_ON, "A L O F T W I N D S\n( 8000' MIN ALTITUDE )\n-->\n", AloftWinds, CStringType, &envData.aloftWindsString, NULL, "", 0}, {true, IDB_BLUE_BTN_WIDE_OFF, IDB_BLUE_BTN_WIDE_ON, "W I N D G U S T S\n-->\n", WindGusts, FloatType, &envData.info.GUSTS, NULL, " kts", 0}, {true, IDB_BLUE_BTN_WIDE_OFF, IDB_BLUE_BTN_WIDE_ON, "T U R B U L E N C E\n-->\n", Turbulence, IntegerType, &

                        D Offline
                        D Offline
                        David Crow
                        wrote on last edited by
                        #14

                        So are these controls added to the dialog in OnInitDialog() or some other initialization function? The problem, then, is that they do not show up the first time the dialog is rendered but do show up each time thereafter. Is that correct?

                        "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

                        "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                        R 1 Reply Last reply
                        0
                        • D David Crow

                          So are these controls added to the dialog in OnInitDialog() or some other initialization function? The problem, then, is that they do not show up the first time the dialog is rendered but do show up each time thereafter. Is that correct?

                          "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

                          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                          R Offline
                          R Offline
                          Reagan Conservative
                          wrote on last edited by
                          #15

                          Yes, these controls are added in the OnInitDialog(). It is not these other dialogs that have a problem with displaying properly. That only occurs with the Keypad dialog, and the Keypad dialog is not created (derived) from the IosDialog. It is derived from the common CDialog. The class definition is shown below: ///////////////////////////////////////////////////////////////////////////// // CKeypad dialog class CKeypad : public CDialog { // Construction public: CKeypad(CWnd* pParent, const WinInfoStruct); ~CKeypad(); bool Get_Integer(CString Label, int Min, int Max, int *result=0); bool Get_Float(CString Label, float Min, float Max, float *result=0); bool Get_Latitude(CString Label, LAT_DEGREES *result=0); bool Get_Longitude(CString Label, LON_DEGREES *result=0); bool Get_Angle(CString Label, DEGREES *result=0); bool Get_Day(CString Label, int Min, int Max, int *result=0); bool Get_Month(CString Label, int Min, int Max, int *result=0); bool Get_Time (CString Label, TimeFormats Format, SECONDS Min, SECONDS Max, SECONDS *result=0); bool Get_BaroPress (CString Label, float Min, float Max, float *result=0); // Dialog Data //{{AFX_DATA(CKeypad) enum { IDD = IDD_KEYPAD }; //}}AFX_DATA private: // Attributes enum CONSTANTS { NUM_BUTTONS = 14 }; WinInfoStruct winInfo; CSuperFrame superFrame; CSuperButton m_EntryBtn[NUM_BUTTONS]; CSuperButton m_Backspace; CSuperButton m_Enter; CSuperButton m_Cancel; CSuperButton m_sbNorth; CSuperButton m_sbSouth; CSuperButton m_sbEast; CSuperButton m_sbWest; CEntryBuffer m_EntryBuffer; CString m_Title; CString m_ErrorBuffer; bool settingLat; bool m_bShowDirections; CRect titleRect; //----------------------------------------------------------- // Static Data //----------------------------------------------------------- const static UINT btnId[NUM_BUTTONS]; //----------------------------------------------------------- private: // Methods void ProcessCharacter(char C); void UpdateDisplay(bool New_Title); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CKeypad) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL protected: // Generated message map functions //{{AFX_MSG(CKeypad) afx_msg void OnBn1(); afx_msg void OnBn2(); afx_msg void OnBn3(); afx_msg void OnBn4(); afx_msg void OnBn5(); afx_msg void OnBn6(); afx_msg void OnBn7();

                          D 1 Reply Last reply
                          0
                          • R Reagan Conservative

                            Yes, these controls are added in the OnInitDialog(). It is not these other dialogs that have a problem with displaying properly. That only occurs with the Keypad dialog, and the Keypad dialog is not created (derived) from the IosDialog. It is derived from the common CDialog. The class definition is shown below: ///////////////////////////////////////////////////////////////////////////// // CKeypad dialog class CKeypad : public CDialog { // Construction public: CKeypad(CWnd* pParent, const WinInfoStruct); ~CKeypad(); bool Get_Integer(CString Label, int Min, int Max, int *result=0); bool Get_Float(CString Label, float Min, float Max, float *result=0); bool Get_Latitude(CString Label, LAT_DEGREES *result=0); bool Get_Longitude(CString Label, LON_DEGREES *result=0); bool Get_Angle(CString Label, DEGREES *result=0); bool Get_Day(CString Label, int Min, int Max, int *result=0); bool Get_Month(CString Label, int Min, int Max, int *result=0); bool Get_Time (CString Label, TimeFormats Format, SECONDS Min, SECONDS Max, SECONDS *result=0); bool Get_BaroPress (CString Label, float Min, float Max, float *result=0); // Dialog Data //{{AFX_DATA(CKeypad) enum { IDD = IDD_KEYPAD }; //}}AFX_DATA private: // Attributes enum CONSTANTS { NUM_BUTTONS = 14 }; WinInfoStruct winInfo; CSuperFrame superFrame; CSuperButton m_EntryBtn[NUM_BUTTONS]; CSuperButton m_Backspace; CSuperButton m_Enter; CSuperButton m_Cancel; CSuperButton m_sbNorth; CSuperButton m_sbSouth; CSuperButton m_sbEast; CSuperButton m_sbWest; CEntryBuffer m_EntryBuffer; CString m_Title; CString m_ErrorBuffer; bool settingLat; bool m_bShowDirections; CRect titleRect; //----------------------------------------------------------- // Static Data //----------------------------------------------------------- const static UINT btnId[NUM_BUTTONS]; //----------------------------------------------------------- private: // Methods void ProcessCharacter(char C); void UpdateDisplay(bool New_Title); // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CKeypad) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL protected: // Generated message map functions //{{AFX_MSG(CKeypad) afx_msg void OnBn1(); afx_msg void OnBn2(); afx_msg void OnBn3(); afx_msg void OnBn4(); afx_msg void OnBn5(); afx_msg void OnBn6(); afx_msg void OnBn7();

                            D Offline
                            D Offline
                            David Crow
                            wrote on last edited by
                            #16

                            So what was the previous mention of CLogin for? Is that somehow related to CKeypad?

                            "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

                            "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                            R 1 Reply Last reply
                            0
                            • D David Crow

                              So what was the previous mention of CLogin for? Is that somehow related to CKeypad?

                              "Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman

                              "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

                              R Offline
                              R Offline
                              Reagan Conservative
                              wrote on last edited by
                              #17

                              Keypad is called to enter the UserID and PIN for the login, and Keypad is called from within CLogin, CKeypad kp(mainFramePtr->wndPtr, winInfo); if (kp.Get_Integer("Enter ID Number", 0, 99999, &intValue))

                              John P.

                              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