Re: Status bar - INS??
From: Jase (jshelley_at_spamblock.enersol.com.au)
Date: 04/08/04
- Next message: Roy Fine: "Re: Thread creation"
- Previous message: Jase: "Re: Carriage Return/Line Feed Problem"
- In reply to: Adrian Gibbons: "Re: Status bar - INS??"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 8 Apr 2004 11:34:01 +1000
All totally unnecessary. GetKeyState(...) works every time, but if that's
the way you want to do it, go right ahead.
Jase
"Adrian Gibbons" <adriangibbons@yahoo.co.uk> wrote in message
news:34a2acd5.0404060450.fa4d0a2@posting.google.com...
> Right, I have a solution. Not sure how great it is but it seems to
> work ok.
>
> **** CMainFrame class ****
> - Added ID_INDICATOR_OVR to static UINT indicators[].
>
> - Added a member variable called m_bGlobalInsert which is initialised
> to FALSE in the constructor.
>
> - ON_UPDATE_COMMAND_UI(ID_INDICATOR_OVR, OnUpdateInsertIndicator)
> handled:
> void CMainFrame::OnUpdateInsertIndicator(CCmdUI *pCmdUI)
> {
> pCmdUI->Enable(m_bGlobalInsert);
> }
>
> **** CMyRichEditView ****
> - Added member variable m_bInsert, again initialised to FALSE in the
> constructor.
>
> - Included MainFrm.h in MyRichEditView.h so I can cast AfxGetMainWnd()
> properly.
>
> - Overidden OnSetFocus():
> {
> if(m_bInsert != ((CMainFrame*)AfxGetMainWnd())->m_bGlobalInsert)
> {
> m_bInsert = ((CMainFrame*)AfxGetMainWnd())->m_bGlobalInsert;
> // Force keystroke. 999666 is an arbitrary number.
> SendMessage(WM_KEYDOWN, VK_INSERT, 999666);
> }
>
> - Overidden PreTranslateMessage():
> {
> if(pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_INSERT)
> {
> m_bInsert = !m_bInsert;
>
> // Don't toggle m_bGlobalInsert if WM_KEYDOWN from our SendMessage
> if(pMsg->lParam != 999666)
> ((CMainFrame*)AfxGetMainWnd())->m_bGlobalInsert =
> !((CMainFrame*)AfxGetMainWnd())->m_bGlobalInsert;
>
> return CMyRichEditView::PreTranslateMessage(pMsg);
> }
- Next message: Roy Fine: "Re: Thread creation"
- Previous message: Jase: "Re: Carriage Return/Line Feed Problem"
- In reply to: Adrian Gibbons: "Re: Status bar - INS??"
- Messages sorted by: [ date ] [ thread ]