Solved

Updating Data in Controls in a Dialog Box

Posted on 1998-08-03
3
237 Views
Last Modified: 2013-11-19
I have to display some data in different controls such a List Box, List Control, Edit Box in a Dialog. However only partial data is shown i.e when 3 items are to be shown in a List box, only the last one is shown.

However when I click in the two empty spaces in the list box, the data is shown. Any idea how to solve the problem

0
Comment
Question by:kapoorv
3 Comments
 
LVL 1

Expert Comment

by:guruprasad031298
ID: 1320173
Can you post the code here ....
0
 

Author Comment

by:kapoorv
ID: 1320174

void CTermDialog::OnShowTerm()
{
      // TODO: Add your control notification handler code here

      UpdateData(TRUE);

      vConcat = get_terms((LPCTSTR)m_TermName,(LPCTSTR)m_Language);
      
      // Get the number of Terms with the same name  i.e. having Concat Links.
      if(vConcat.size() == 0)
      {            
            MessageBox("TERM NAME Does Not Exist in Database","TERM NAME ERROR",MB_ICONERROR);
            return;
      }
      else
      if(vConcat.size() == 1)
      {
            for(iConcat = vConcat.begin();iConcat != vConcat.end();++iConcat)
                   Show((*iConcat)->m_term_code);
      }
      else
            MessageBox("TERMS GREATER THAN 1");
}

void CTermDialog::Show(const char* sTermCode)
{
      CTerm      newTerm(sTermCode);
            
      m_Active = newTerm.get_active_ind();            // Get the Active Statue of the Term.
      m_Approval = newTerm.get_approved_ind();      // Get the Approval Indicator of the Term.
      m_Status = newTerm.get_status_ind();            // Get the Statue of the Term.
      
      vNote = newTerm.get_notes();       // Get the Notes associated with the Term.
      int x = 0;
      
      if(vNote.size() > 0)
      {      
            for(iNote = vNote.begin();iNote != vNote.end();++iNote)
            {
                  pNoteType[x] = (*iNote)->m_type;
                  //pNotesText[x]      = (*iNote)->m_text;
                  m_TestNoteType[x]      = (*iNote)->m_type;
                  m_TestNoteText[x]      = (*iNote)->m_text;
                  x++;
            }
      }

      x = 0;
      BOOL bFlag = TRUE;
      m_Notes = m_TestNoteText[0];
      SetDlgItemText(IDC_NOTES,m_Notes);

      while(bFlag)
      {

            switch(*pNoteType[0])
            {
                  case 'S':
                  {
                              m_ScopeNoteButton.SetState(1);
                              bFlag = FALSE;
                              break;
                  }
                  case 'T':
                  {
                              m_MaintainanceNoteButton.SetState(1);
                              bFlag = FALSE;
                              break;
                  }
                  case 'Q':
                        {
                              m_QueryNoteButton.SetState(1);
                              bFlag = FALSE;
                              break;
                        }
                  case 'O':
                        {
                              bFlag = FALSE;
                              break;      
                        }
                  default:
                              return;
            }
      }
            
      // Get the Classes with which the Term is associated.
      m_ClassCtrl.ResetContent(); // Deleting all the Enteries in the Class List Box
      vRmpClass = newTerm.get_classes();
      
      for(iRmpClass = vRmpClass.begin();iRmpClass != vRmpClass.end();++iRmpClass)
      {
            m_ClassDesc = (*iRmpClass)->m_code;
            m_ClassCtrl.AddString(m_ClassDesc);
      }
      
      // Get the Variants of the Term in the Language selected.
/*      iNoOfGridRows = m_VariantGrid->GetNumberRows();
      if(iNoOfGridRows > 1) // Deleting the Rows of the Previous Term
      {
            long i;
            for(i= iNoOfGridRows;i>0;i--)
                  m_VariantGrid->DeleteRow(i);
      }
      
      iNoOfGridRows = iNoOfVariants = 0;
      
      //      vVariant = newTerm.get_variants((LPCTSTR)m_Language);
      vVariant = newTerm.get_variants("NULL");
      for(iVariant = vVariant.begin();iVariant != vVariant.end();++iVariant)
      {
            iNoOfGridRows = m_VariantGrid->GetNumberRows();
            if(iNoOfVariants >= 1) // Adding Rows to the Grid depending on the number
                                             // of Variants for a Term.
                  m_VariantGrid->AppendRow();
            
            sVariantName            = (*iVariant)->m_name;
            sVariantType            = (*iVariant)->m_type;
            sVariantLanguage      = (*iVariant)->m_lang_code;
            
            m_VariantGrid->QuickSetText(0,iNoOfVariants,sVariantType);
            m_VariantGrid->QuickSetText(1,iNoOfVariants,sVariantName);
            m_VariantGrid->QuickSetText(2,iNoOfVariants,sVariantLanguage);
            
            iNoOfVariants++;
      }*/


      vCategory = newTerm.get_categories();       // Get the Category(s) to which the term belongs
      
      CString sCategoryType,sCategoryName;
      m_Category.DeleteAllItems();
      iNoOfVariants = 0;

      for(iCategory = vCategory.begin(); iCategory != vCategory.end();++iCategory)
      {
            sCategoryType = (*iCategory)->m_type;
            sCategoryDesc = (*iCategory)->m_desc;
            sCategoryName = (*iCategory)->m_code;
                              
            m_Category.InsertItem(iNoOfVariants,(LPCTSTR)sCategoryType); // Add the Category Type
            m_Category.SetItemText(iNoOfVariants,1,(LPCTSTR)sCategoryDesc); // Add the Category Type
            m_Category.SetItemText(iNoOfVariants,2,(LPCTSTR)sCategoryName); // Add the Category Name

            iNoOfVariants++;
      }

      m_CreateName = newTerm.get_created_by();
      m_CreateDate = newTerm.get_create_time();
      m_ModifyName = newTerm.get_updated_by();
      m_ModifyDate = newTerm.get_update_time();

      UpdateData(FALSE);
      
}
0
 
LVL 1

Accepted Solution

by:
kumarana earned 50 total points
ID: 1320175
Get the pointers to all your controls and call
InvalidateRect(TRUE) for all of your controls . This might work.
Do this after UpdateData( FALSE );
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question