[Closed] WM_PASTE for an edit control in toolbar |
Post Reply |
Author | |
kevins
Newbie Joined: 22 August 2006 Location: United States Status: Offline Points: 15 |
Post Options
Thanks(0)
Posted: 22 August 2006 at 12:31pm |
How do I capture WM_PASTE for an edit control in a toolbar?
We are converting our user interface to using Xtreme ToolkitPro. In our original code we have an edit box on a toolbar in which we override the WindowProc function and test the message for WM_PASTE. How can I do this with Xtreme ToolkitPro? I have tried a few things and have failed so I am trying them again with the CustomThemes example program because it has an edit box in a toolbar. Here are the results: I followed Olegs 2nd response to topic "Change notification for CXTPControlEdit", so now I have a control derived from CXTPControlEditCtrl. I added ON_WM_CHAR() to the message map and added the OnChar function. It gets called, that's great. But I added the WindowProc function and it never gets called. I copied the function from my existing (pre-CodeJock) code, so the function signature should be correct. I also tried adding "ON_MESSAGE(WM_PASTE, OnPaste)" to the message map but OnPaste never gets called. Thanks for any assistance that can be provided. |
|
kevins
Newbie Joined: 22 August 2006 Location: United States Status: Offline Points: 15 |
Post Options
Thanks(0)
|
Is my question unclear or am I out of luck in getting this functionality?
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hi,
First you need to make custom edit class for CXTPControlEdit. In CustomThemes sample it is CControlComboBoxEditEx:
Somethinh like this:
class CMyEdit: public CXTPControlEditCtrl
{ public: DECLARE_MESSAGE_MAP() }; class CControlMyEdit : public CXTPControlEdit
{
DECLARE_XTP_CONTROL(CControlMyEdit) public: virtual CXTPControlEditCtrl* CreateEditControl() {
return new CMyEdit(); } }; and you will be able to catch all messages in your CMyEdit.
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
kevins
Newbie Joined: 22 August 2006 Location: United States Status: Offline Points: 15 |
Post Options
Thanks(0)
|
Bummer :-( That's exactly what I did. I just did a little test with
CustomThemes and had no luck. It's using a combobox rather than an edit
box, but hopefully the basics are the same and we can press on. I'll
detail my changes here:
I added the code in Bold: class CControlComboBoxEditEx : public CXTMaskEditT<CXTPControlComboBoxEditCtrl> { public: afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct); LRESULT CControlComboBoxEditEx::OnPaste(WPARAM, LPARAM); DECLARE_MESSAGE_MAP() }; BEGIN_MESSAGE_MAP(CControlComboBoxEditEx, CXTMaskEditT<CXTPControlComboBoxEditCtrl>) ON_MASKEDIT_REFLECT() ON_WM_CREATE() ON_MESSAGE(WM_PASTE, OnPaste) END_MESSAGE_MAP() LRESULT CControlComboBoxEditEx::OnPaste(WPARAM, LPARAM) { return 1; // I set a breakpoint here. } I pasted data into the control labeled Masked and I do not hit my breakpoint. I/We must be missing something simple. Or the control isn't getting WM_PASTE. |
|
kevins
Newbie Joined: 22 August 2006 Location: United States Status: Offline Points: 15 |
Post Options
Thanks(0)
|
Any more ideas? I'm sure we're just missing something simple.
|
|
Oleg
Admin Group Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
|
Hello,
Right :( Just tested it and it doesn't work.
The thing that Edit of combobox is actual RichEdit not standard Edit and WM_PASTE for RichEdit is not called.
To create standard Edit instead RichEdit just overridethis function:
BOOL CControlComboBoxEditEx::CreateEdit(DWORD dwStyle, CWnd* pParentWnd)
{ return CEdit::Create(dwStyle, CRect(0, 0, 0, 0), pParentWnd, 0); } |
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
kevins
Newbie Joined: 22 August 2006 Location: United States Status: Offline Points: 15 |
Post Options
Thanks(0)
|
Thanks Oleg, I would have nevered figured that out on my own.
For anyone else reading this, here is my final routine: BOOL ControlIntEditCtrl::CreateEdit(DWORD dwStyle, CWnd* pParentWnd) { BOOL bRetVal = CEdit::Create(dwStyle, CRect(0, 0, 0, 0), pParentWnd, 0); // NOTE: I needed the SetWindowText to get the edit control to start with "1", // but after updating to CodeJock 10.3 this no longer worked. (So, I have the // view post a message to itself in OnInitialUpdate to get the edit box // initialized.) //pControlIntEdit->SetEditText(_T("1")); in MainFram failed to work after added this routine. //SetWindowText(_T("1")); return bRetVal; } |
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |