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. newbie needs help

newbie needs help

Scheduled Pinned Locked Moved C / C++ / MFC
help
7 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.
  • K Offline
    K Offline
    kjessee
    wrote on last edited by
    #1

    Probably another simple queston. I have used the same code in other dialog boxes, (with different variables)and it works. Thanks for the help. I get the following ASSERT at the line containing m_BeginStr.ResetContent(); _AFXWIN_INLINE void CComboBox::ResetContent() { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0); } void CDlgOffset::OnButtonBrowse() { FILE *StrFile; CWnd* pWnd; CString sStrName; double E; double S; CFileDialog dlg( TRUE, "txt", NULL, OFN_FILEMUSTEXIST, "Text Files (*.txt)||\0" ,NULL ); int nResponse = dlg.DoModal(); if (nResponse == IDOK) { m_StrFile = dlg.GetPathName(); pWnd = GetDlgItem( IDC_EDIT2 ); pWnd->SetWindowText( m_StrFile ); // Load the Combo Boxes StrFile = fopen( m_StrFile, "r+"); fseek( StrFile, 0L, SEEK_SET ); m_BeginStr.ResetContent(); m_EndingStr.ResetContent(); while( fscanf( StrFile, "%s %lf %lf", sStrName, &E, &S ) != EOF ) { m_BeginStr.AddString( sStrName ); m_EndingStr.AddString( sStrName ); } fclose( StrFile ); } }

    C 1 Reply Last reply
    0
    • K kjessee

      Probably another simple queston. I have used the same code in other dialog boxes, (with different variables)and it works. Thanks for the help. I get the following ASSERT at the line containing m_BeginStr.ResetContent(); _AFXWIN_INLINE void CComboBox::ResetContent() { ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, CB_RESETCONTENT, 0, 0); } void CDlgOffset::OnButtonBrowse() { FILE *StrFile; CWnd* pWnd; CString sStrName; double E; double S; CFileDialog dlg( TRUE, "txt", NULL, OFN_FILEMUSTEXIST, "Text Files (*.txt)||\0" ,NULL ); int nResponse = dlg.DoModal(); if (nResponse == IDOK) { m_StrFile = dlg.GetPathName(); pWnd = GetDlgItem( IDC_EDIT2 ); pWnd->SetWindowText( m_StrFile ); // Load the Combo Boxes StrFile = fopen( m_StrFile, "r+"); fseek( StrFile, 0L, SEEK_SET ); m_BeginStr.ResetContent(); m_EndingStr.ResetContent(); while( fscanf( StrFile, "%s %lf %lf", sStrName, &E, &S ) != EOF ) { m_BeginStr.AddString( sStrName ); m_EndingStr.AddString( sStrName ); } fclose( StrFile ); } }

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      has m_BeginStr been initialized? chances are that it isn't yet a "window" (and the ::IsWindow test is failing). make sure you're either DDX'ing the control or SubClassing it (ie. attaching an actual control to the variable) -c


      “losinger is a colorizing text edit control” -- googlism

      Smaller Animals Software

      K 1 Reply Last reply
      0
      • K kjessee

        it has CCombobox attached to it in the member varibles.

        C Offline
        C Offline
        Chris Losinger
        wrote on last edited by
        #3

        look in the DoDataExchange function of your dialog. do you see a line that looks something like this: DDX_Control(pDX, IDC_MY_COMBOS_ID, m_BeginStr); ? if not, it needs one. otherwise, the member variable is never actually attached to the control. -c


        “losinger is a colorizing text edit control” -- googlism

        Smaller Animals Software

        K 1 Reply Last reply
        0
        • C Chris Losinger

          has m_BeginStr been initialized? chances are that it isn't yet a "window" (and the ::IsWindow test is failing). make sure you're either DDX'ing the control or SubClassing it (ie. attaching an actual control to the variable) -c


          “losinger is a colorizing text edit control” -- googlism

          Smaller Animals Software

          K Offline
          K Offline
          kjessee
          wrote on last edited by
          #4

          it has CCombobox attached to it in the member varibles.

          C 1 Reply Last reply
          0
          • K kjessee

            It is there. void CDlgO::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDlgOffset) DDX_Control(pDX, IDC_COMBO_END_STR, m_EndingStr); DDX_Control(pDX, IDC_COMBO_BEG_STR, m_BeginStr);

            C Offline
            C Offline
            Chris Losinger
            wrote on last edited by
            #5

            hmmm. can you put a breakpoint on that DDX line and step into the DDX_Control code to see if anything fails? -c


            “losinger is a colorizing text edit control” -- googlism

            Smaller Animals Software

            K 1 Reply Last reply
            0
            • C Chris Losinger

              look in the DoDataExchange function of your dialog. do you see a line that looks something like this: DDX_Control(pDX, IDC_MY_COMBOS_ID, m_BeginStr); ? if not, it needs one. otherwise, the member variable is never actually attached to the control. -c


              “losinger is a colorizing text edit control” -- googlism

              Smaller Animals Software

              K Offline
              K Offline
              kjessee
              wrote on last edited by
              #6

              It is there. void CDlgO::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CDlgOffset) DDX_Control(pDX, IDC_COMBO_END_STR, m_EndingStr); DDX_Control(pDX, IDC_COMBO_BEG_STR, m_BeginStr);

              C 1 Reply Last reply
              0
              • C Chris Losinger

                hmmm. can you put a breakpoint on that DDX line and step into the DDX_Control code to see if anything fails? -c


                “losinger is a colorizing text edit control” -- googlism

                Smaller Animals Software

                K Offline
                K Offline
                kjessee
                wrote on last edited by
                #7

                it fails before it gets there. Kevin

                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