?
Solved

CDialogBar & CComboBox

Posted on 2002-03-27
6
Medium Priority
?
331 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 200 total points
ID: 6898857
// 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
ID: 6898871
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
ID: 6898879
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:dragosh
ID: 6898884
hi

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

10x again
0
 
LVL 23

Expert Comment

by:Roshan Davis
ID: 6898888
Okay
Try it

GOOD LUCK
0
 
LVL 3

Author Comment

by:dragosh
ID: 6902070
hi

10x for your tips .. the points are yours

rgds
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

807 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