Solved

Combobox Control(interface design)

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
windows 10 how make picture as desktop background 2 66
matchUp  challenge 9 126
sumHeights2  challenge 7 132
Windows shortcut location resolution on double click open 4 55
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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 an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

730 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