Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Status Bar Problem with OVR

Posted on 1998-06-04
3
Medium Priority
?
360 Views
Last Modified: 2013-11-19
Ive been developing a text editor (Im working with CRichEditView as my base class) and I wanted to use the OVR text in the status bar. Now, I managed to make it light up when you hit the INSERT key and turn off, but it always inserts even if the OVR is turned on. For this I used the CCmdUI Enable() function. My question is, how do I make it INSERT or OVERSTRIKE the text while enabling or desabling OVR in the status bar?
0
Comment
Question by:VisualLR
  • 2
3 Comments
 

Accepted Solution

by:
midthune earned 200 total points
ID: 1316034
First, make a bool member of your view class "m_Insert"

void CMyAppView::OnUpdateIns(CCmdUI* pCmdUI)
{
    CString string;

    if( m_Insert )
        string = "INS";
    else
        string = "OVR";

    pCmdUI->SetText( string );
}


void CMyAppView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
    if( nChar == VK_INSERT )
        m_Insert = !m_Insert;

    CRichEditView::OnKeyDown(nChar, nRepCnt, nFlags);
}

Your problem may be the last line above... are you calling the base-class implementation of OnKeyDown even when the insert key is pressed?
Actually, you might want to do all this in your MainFrame if you are using an MDI...
0
 

Author Comment

by:VisualLR
ID: 1316035
Im having problems inplementing the code you've given me... first I get an error that says I can't access CRichEditView::OnKeyDown cause it's a protected memeber. And my other problem is how do I write the messages for these functions (the ON_COMMAND's)? I understand what OnUpdateIns does perfectly, Im not quite certain on what OnKeyDown does... or what parameters to use and how. Thanks.
0
 

Expert Comment

by:midthune
ID: 1316036
Try putting the code in your view class. Use the Class Wizard to create a handler for WM_KEYDOWN and put the code in the generated function. The code in OnKeyDown just turns your bool m_Insert from true to false or false to true. You'll have to write in your own message map entries for OnUpdateIns.
ON_UPDATE_COMMAND_UI(ID_INDICATOR_INS, OnUpdateIns) in view.cpp
afx_msg void OnUpdateIns(CCmdUI* pCmdUI); in view.h
This is assuming that your status bar has an indicator called ID_INDICATOR_INS.
Initialize the ID_INDICATOR_INS to "OVR" (because it's wider, if you set it to "INS" then "OVR" won't fit in the box) by setting it in your string table. Then, in your view constructor set m_Insert to TRUE.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question