Solved

Status Bar Problem with OVR

Posted on 1998-06-04
3
344 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Accepted Solution

by:
midthune earned 50 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to create frequencies of a variable from SAS dataset? 10 146
Replacement selected text 2 69
scoreUp challenge 14 74
Problem to event 3 123
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
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.
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

751 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