Solved

Updating Data in Controls in a Dialog Box

Posted on 1998-08-03
3
236 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

896 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now