Results 1 to 20 of 29

Thread: native event of child window

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Join Date
    Mar 2014
    Location
    USA
    Posts
    85
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: native event of child window

    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:

    Qt Code:
    1. DLL, C++,
    2.  
    3. In our VC demo, PEViews file
    4.  
    5. Header file
    6.  
    7. protected:
    8. //{{AFX_MSG(CPEView)
    9. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
    10. afx_msg void OnSize(UINT nType, int cx, int cy);
    11. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
    12.  
    13. // new func
    14. virtual BOOL PreTranslateMessage(MSG* pMsg);
    15.  
    16. CPP file
    17.  
    18. // new implementation
    19. BOOL CPEView::PreTranslateMessage(MSG* pMsg) {
    20. if ( pMsg->message == WM_KEYDOWN )
    21. {
    22. if (pMsg->wParam = VK_MENU)
    23. {
    24. PEnset(m_hPE, PEP_nMOUSEWHEELFUNCTION, PEMWF_VERT_SCROLL);
    25. }
    26. return TRUE;
    27. }
    28. else if (pMsg->message == WM_KEYUP )
    29. {
    30. if (pMsg->wParam = VK_MENU)
    31. {
    32. PEnset(m_hPE, PEP_nMOUSEWHEELFUNCTION, PEMWF_HORZ_SCROLL);
    33. }
    34. return TRUE;
    35. }
    36. else
    37. 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?
    Last edited by TonyInSoMD; 22nd December 2016 at 12:19.

Similar Threads

  1. Replies: 0
    Last Post: 9th August 2016, 16:37
  2. Native parent window for QWidget (IPreviewHandler)
    By Kevsoft in forum Qt Programming
    Replies: 3
    Last Post: 19th July 2015, 13:24
  3. Replies: 5
    Last Post: 17th September 2013, 06:45
  4. Replies: 11
    Last Post: 4th June 2008, 07:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.