Solved

Combobox Control(interface design)

Posted on 2000-03-30
4
162 Views
Last Modified: 2013-11-20
Hi,
  I am at present doing a project in VC. I want to have a control, like a chat box,where whatever u type in a small text box can be exhibited in the larger one.
 I found out that combobox can be used for it,with its styles attribute set to simple.But i am not able to store whatever i type in the smaller text box and display in the larger one.
Any of u please help me in this regard.

Thanx,
Thiru
0
Comment
Question by:thirumaran
  • 2
4 Comments
 
LVL 2

Expert Comment

by:abdij
ID: 2669131
Hi
why dont u have an Edit box with Vertical scroll bars?

Abdij
0
 
LVL 31

Expert Comment

by:Zoppo
ID: 2669234
Hi thirumaran,

You can retrieve the edit control's text with CWnd::GetWindowText() and add to combo box with CComboBox::AddString().

ZOPPO
0
 

Author Comment

by:thirumaran
ID: 2669237
Hi,
   Using edit box is very simple. Just to know the usage of combo box, using this type of style(simple) and to make the UI attractive,i need to go for it.
please help me regarding this question.
Thanx
Thiru
0
 
LVL 31

Accepted Solution

by:
Zoppo earned 20 total points
ID: 2669411
Hi again, thirumaran,

here's how I would do it:

// m_cb is the CComboBox member added with ClassWizard
CMyDialog::PreTranslateMessage(MSG* pMsg)
{
 if ( pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_RETURN )
 {
  CWnd* pFocus = GetFocus();

  if ( NULL != pFocus && pFocus->GetParent()->m_hWnd == m_cb.m_hWnd )
  {
   CString t;
   m_cb.GetWindowText( t );
   if ( !t.IsEmpty() )
   {
    m_cb.InsertString( 0, t );
    t = "";
    m_cb.SetWindowText( t );
    return TRUE;
   }
  }
 }
 return CDialog::PreTranslateMessage(pMsg);
}


give it a try...

ZOPPO
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

Title # Comments Views Activity
Need to retreive data from .TFS file exported by DVR 8 176
Separate into files by filename 12 75
ffmpeg - "rtsp://...... Operation not permitted" 4 73
Path of Workbook 3 59
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

929 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

14 Experts available now in Live!

Get 1:1 Help Now