[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Changing the cursor in a Rich Edit View?

Posted on 1998-02-09
13
Medium Priority
?
493 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

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 1000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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 …
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…
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.
Loops Section Overview
Suggested Courses

834 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