Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Combobox Control(interface design)

Posted on 2000-03-30
4
Medium Priority
?
178 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 80 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

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

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…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

722 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