Solved

Combobox Control(interface design)

Posted on 2000-03-30
4
163 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

813 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

10 Experts available now in Live!

Get 1:1 Help Now