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
Solved

Status Bar Problem with OVR

Posted on 1998-06-04
3
334 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 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
not able to insert into temp table 68 169
Macro to save highlighted rows as a separate file 5 45
Replacement selected text 2 63
pre4 challenge 19 103
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 …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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 recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

840 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