Before I forget to say it, thanks for everyone's time and help. The Q_OBJECT macro is in there, I'm not sure what else would need to be added other than the standard c++ stuff when sub-classing. In this particular case, the "provided parent" is the sub-classed QFrame I mentioned in the first post. The QFrame receives the WM_COMMAND messages which I get using nativeEvent. When the message->message is WM_COMMAND in the QFrame, the HIWORD(message->wParam) tells me what the communication is. They have one for keypress but not keyrelease. I'm trying to find a way to capture the keyrelease event so I can switch between vertical and horizontal scroll depending on whether the Alt key is depressed. When I asked the folks at ProEssentials if there was a way to do it, they said to add this to their sample code:
DLL, C++,
In our VC demo, PEViews file
Header file
protected:
//{{AFX_MSG(CPEView)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
// new func
virtual BOOL PreTranslateMessage(MSG* pMsg);
CPP file
// new implementation
BOOL CPEView::PreTranslateMessage(MSG* pMsg) {
if ( pMsg->message == WM_KEYDOWN )
{
if (pMsg->wParam = VK_MENU)
{
PEnset(m_hPE, PEP_nMOUSEWHEELFUNCTION, PEMWF_VERT_SCROLL);
}
return TRUE;
}
else if (pMsg->message == WM_KEYUP )
{
if (pMsg->wParam = VK_MENU)
{
PEnset(m_hPE, PEP_nMOUSEWHEELFUNCTION, PEMWF_HORZ_SCROLL);
}
return TRUE;
}
else
return CView::PreTranslateMessage(pMsg);
DLL, C++,
In our VC demo, PEViews file
Header file
protected:
//{{AFX_MSG(CPEView)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
// new func
virtual BOOL PreTranslateMessage(MSG* pMsg);
CPP file
// new implementation
BOOL CPEView::PreTranslateMessage(MSG* pMsg) {
if ( pMsg->message == WM_KEYDOWN )
{
if (pMsg->wParam = VK_MENU)
{
PEnset(m_hPE, PEP_nMOUSEWHEELFUNCTION, PEMWF_VERT_SCROLL);
}
return TRUE;
}
else if (pMsg->message == WM_KEYUP )
{
if (pMsg->wParam = VK_MENU)
{
PEnset(m_hPE, PEP_nMOUSEWHEELFUNCTION, PEMWF_HORZ_SCROLL);
}
return TRUE;
}
else
return CView::PreTranslateMessage(pMsg);
To copy to clipboard, switch view to plain text mode
I have no idea how to translate this from MFC to Qt. I don't know jack about MFC. Maybe I should have said all this up front, if so my sincerest apologies. When I said I wasn't working in MFC, it was Qt, ProEssentials offered to customize the code for a measly $1000 USD. $1000 to add a keyrelease wparam to WM_COMMAND which in my opinion I can't believe doesn't already exist considering they have one for keypress. I'll get off my soap box now.
edit after post
I'm starting to think that the ProEssentials window is not a "Windows" window in that it doesn't generate events with MSG's. The only MSG's it generates are the self-made self-emitted WM_COMMAND MSG's. There aren't any Windows (or Qt) events to catch because they're not generated, only the ProEssentials events which ProEssentials generates. If so, I've been spinning my and your wheels all this time and you have my apologies. What do you think, does it sound like I might be right?
Bookmarks