Solved

CDialogBar & CComboBox

Posted on 2002-03-27
6
304 Views
Last Modified: 2013-11-20
hi

I have a DialogBar with a combo box (dropdown) ... I want to catch Ctrl+C(copy) and Ctrl+V(paste) events for the combo's inner edit control .. to copy content and to paste content in combo when the focus is there

how can I do that ??

rgds
0
Comment
Question by:dragosh
  • 3
  • 3
6 Comments
 
LVL 23

Accepted Solution

by:
Roshan Davis earned 50 total points
Comment Utility
// The following code shows how to subclass the edit control and list box
// controls inside a combo box. It uses WM_CTLCOLOR for subclassing.
// CSuperComboBox represents the combo box.
HBRUSH CSuperComboBox::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
   if (nCtlColor == CTLCOLOR_EDIT)
   {
      //Edit control
      if (m_edit.GetSafeHwnd() == NULL)
         m_edit.SubclassWindow(pWnd->GetSafeHwnd());
   }
   else if (nCtlColor == CTLCOLOR_LISTBOX)
   {
      //ListBox control
      if (m_listbox.GetSafeHwnd() == NULL)
         m_listbox.SubclassWindow(pWnd->GetSafeHwnd());
   }
   HBRUSH hbr = CComboBox::OnCtlColor(pDC, pWnd, nCtlColor);
   return hbr;
}
0
 
LVL 3

Author Comment

by:dragosh
Comment Utility
hi roshmon

i don't think i understand .. how this will help me to copy/paste text from combo box ??

10x
0
 
LVL 23

Expert Comment

by:Roshan Davis
Comment Utility
derive a class from CEdit.
declare the object of CEdit derived class in the dialog class.
subclass as per the above code

In ur derived class map the onKey down , syskey down etc,

from there u can check the key strokes

GOOD LUCK
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 3

Author Comment

by:dragosh
Comment Utility
hi

i got it .. let me try it and i'll come back later

10x again
0
 
LVL 23

Expert Comment

by:Roshan Davis
Comment Utility
Okay
Try it

GOOD LUCK
0
 
LVL 3

Author Comment

by:dragosh
Comment Utility
hi

10x for your tips .. the points are yours

rgds
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Need to retreive data from .TFS file exported by DVR 8 166
WinWaitActive parameters 12 31
viewing source code from eclipse 13 74
Not needed 13 53
Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
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.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

744 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

18 Experts available now in Live!

Get 1:1 Help Now