Solved

Cursor on CRichEditView

Posted on 2002-04-02
3
293 Views
Last Modified: 2013-11-20
I want to show context menu on CRichEditView. So I overloaded OnRButtonDown function (OnContextMenu does not work) and inside the function I am calling
SetCursor(LoadCursor(NULL,IDC_ARROW));
just before calling TrackPopupMenu function. I want to have arrow cursor on the context menu. But it is not showing the arrow cursor. Why is that so? How can I show arrow cursor on context menu.
Why OnContextMenu does not work, I mean it is not getting called on R-click.
0
Comment
Question by:chhakuli
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 150 total points
ID: 6913776
You'll have to override 'OnSetCursor()' also, otherwise the system will revert to the default cursor...
0
 
LVL 2

Expert Comment

by:manojbkumar
ID: 6914864
To Display context menu in a RichEditView u should override
GetContextMenu()

in the public sction of view header add
virtual HMENU GetContextMenu( WORD seltyp, LPOLEOBJECT lpoleobj, CHARRANGE* lpchrg );
and then in cpp

HMENU CMyRichEditView::GetContextMenu(WORD, LPOLEOBJECT, CHARRANGE* )
{
     CMenu Menu;
     Menu.LoadMenu(IDR_MENU1);

     CMenu *pMenu = Menu.GetSubMenu(0);
     if(pMenu)
     {
          Menu.RemoveMenu(0, MF_BYPOSITION);
          pMenu->TrackPopupMenu(TPM_LEFTALIGN   ,point.x,point.y, AfxGetMainWnd());
          return pMenu->Detach();
     }
     return NULL;
     
}
0
 
LVL 2

Expert Comment

by:manojbkumar
ID: 6915134
Sorry there is a mistake in the code.Remove the line

pMenu->TrackPopupMenu(TPM_LEFTALIGN   ,point.x,point.y, AfxGetMainWnd());
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

910 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

23 Experts available now in Live!

Get 1:1 Help Now