Solved

Changing the cursor in a Rich Edit View?

Posted on 1998-02-09
13
476 Views
Last Modified: 2013-11-19
Hi,

I have a rich edit view in which I would like the cursor to become a standard arrow instead of an I-beam when the mouse is over it.  Since this is a rich edit control, I can not change the cursor definition in the class name, because the class name is automatically changed to the rich edit class name.  I have tried using SetLong to change it, but that only results in a flicker, like other solutions.  I have intercepted WM_SETCURSOR in CWnd::OnSetCursor() and changed it there, but that only works most of the time.  For example when the left mouse button is clicked and held and the mouse is dragged (when making a selection) the cursor changed back into an I-beam whenever it is over a part of the rich edit view that does not have text in it.  I am very puzzled by this and I haven't been able to find an answer anywhere else.  Please help.

- James
0
Comment
Question by:prodos
  • 7
  • 3
  • 3
13 Comments
 
LVL 23

Expert Comment

by:chensu
ID: 1315854
Have you combined the two methods?
0
 

Author Comment

by:prodos
ID: 1315855
Yes I have, it seems when I combine them the arrow changes into the I-beam less frequently, but it still happens when making a selection.
0
 
LVL 23

Expert Comment

by:chensu
ID: 1315856
Show your code in OnSetCursor() please.
0
 

Author Comment

by:prodos
ID: 1315857
BOOL CIrcOutputView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
    if( nHitTest == HTCLIENT )
    {
        ::SetCursor( ArrowCursor );
        return TRUE;
    }
      
    return CRichEditView::OnSetCursor(pWnd, nHitTest, message);
}
0
 
LVL 23

Expert Comment

by:chensu
ID: 1315858
What happens if you remove the "if( nHitTest == HTCLIENT )"?
0
 

Author Comment

by:prodos
ID: 1315859
It still changes back into an I-beam when making a selection, other than that it just makes it an arrow no matter where it is in the window (ie. it doesn't become the resize cursor when it is on the resizable frame).
0
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

Author Comment

by:prodos
ID: 1315860
Adjusted points to 200
0
 

Author Comment

by:prodos
ID: 1315861
Edited text of question
0
 
LVL 4

Accepted Solution

by:
jtwine100697 earned 250 total points
ID: 1315862
What you will need to do is register a copy of the RICHEDIT class, setting the hCursor member to the cursor that you want (IDC_ARROW), and then use that class for your control.  You will also have to handle OnSetCursor(), and set the cursor to the cursor that you want.

This prevents the cursor from changing back and forth.

I can provide you with code, if required.

-=- James.

0
 

Author Comment

by:prodos
ID: 1315863
Adjusted points to 250
0
 

Author Comment

by:prodos
ID: 1315864
Great! How can I contact you directly, I have a couple minor questions about your answer.
0
 
LVL 4

Expert Comment

by:jtwine100697
ID: 1315865
Hey...  Got your email..., going to reply...

-=- James.
0
 
LVL 4

Expert Comment

by:jtwine100697
ID: 1315866
  You never replied to my Email...

   Did you receive it?

-=- James.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now