Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - [Closed] WM_PASTE for an edit control in toolbar
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

[Closed] WM_PASTE for an edit control in toolbar

 Post Reply Post Reply
Author
Message
kevins View Drop Down
Newbie
Newbie
Avatar

Joined: 22 August 2006
Location: United States
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote kevins Quote  Post ReplyReply Direct Link To This Post Topic: [Closed] WM_PASTE for an edit control in toolbar
    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.
Back to Top
kevins View Drop Down
Newbie
Newbie
Avatar

Joined: 22 August 2006
Location: United States
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote kevins Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2006 at 10:41am
Is my question unclear or am I out of luck in getting this functionality?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2006 at 10:46am
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
Back to Top
kevins View Drop Down
Newbie
Newbie
Avatar

Joined: 22 August 2006
Location: United States
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote kevins Quote  Post ReplyReply Direct Link To This Post Posted: 31 August 2006 at 4:52pm
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.
Back to Top
kevins View Drop Down
Newbie
Newbie
Avatar

Joined: 22 August 2006
Location: United States
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote kevins Quote  Post ReplyReply Direct Link To This Post Posted: 07 September 2006 at 10:22am
Any more ideas? I'm sure we're just missing something simple.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 07 September 2006 at 2:22pm
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
Back to Top
kevins View Drop Down
Newbie
Newbie
Avatar

Joined: 22 August 2006
Location: United States
Status: Offline
Points: 15
Post Options Post Options   Thanks (0) Thanks(0)   Quote kevins Quote  Post ReplyReply Direct Link To This Post Posted: 15 September 2006 at 1:22pm
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;
}
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.125 seconds.