Solved

Changing the cursor in a Rich Edit View?

Posted on 1998-02-09
13
485 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
[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
  • 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
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!

 

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
 

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

Independent Software Vendors: 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
xyBalance chalenge 58 102
centeredAverage challenge 8 186
sum13 challenge 24 134
NotAlone Challenge 20 88
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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…
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.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

733 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