Solved

Cursor on CRichEditView

Posted on 2002-04-02
3
290 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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
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…

746 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

14 Experts available now in Live!

Get 1:1 Help Now