Solved

Combobox Control(interface design)

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

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 30

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
GIF file bit manipulation for color change 5 104
pre4 challenge 19 88
mapAB Challlenge 35 88
firstChar challenge 13 84
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

758 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

19 Experts available now in Live!

Get 1:1 Help Now