|
-
July 18th, 2002, 05:32 AM
#1
Extending edit menu
Hi,
is there a way to extend the standard menu, that appears on right clicking an edit control, with own commands?
Thanks,
Winni
-
July 18th, 2002, 07:05 AM
#2
Well I don't know an easy way, but what I would do (unless I decided to rewrite the control all together) would be to subclass the edit-windows class. I'm not talking MFC here, but that might be easier than this.
This is how:
Lookup SetWindowLong() and use it to change the WndProc used for the edit-control. All messages other than WM_RBUTTONUP (or whatever) you pass on to the old WndProc, which you'll get with GetWindowLong() (obviously you'll need to call that before SetWindowLong()). When you get the WM_RBUTTONUP you construct the menu. Tip: use the same id:s for the standard menu items (which you also have to construct).
Then you need to catch WM_COMMAND as well. Check if the command comes from you "own" menu-items, if it doesn't just pass it on to the old WndProc and it will work as normal.
I haven't tried the things about the menu, but the first part works (at least for me). Sorry if I am a bit unclear, I hope you understand what I mean.
-
July 18th, 2002, 07:05 AM
#3
extending edit menu
Hi,
I'm not sure but you could try to handle the OnRButtonDown message yourself.
You could create a menu which can be attached to the mouse cursor and appears when you hold right button down. If you want to try that I can tell you how to create the menu and attach it.
-
July 18th, 2002, 07:29 AM
#4
Hi,
thanks for the replies. I think, I have to make things clearer. I´ve already subclassed the edit control and catch the WM_RBUTTONDOWN. What I want to do is, get a handle to the standard context menu and to add some additional items. Probably the only way is, to build a menu, that has all standard entries and implement the standard functionality, but I would like to avoid this.
Thanks,
Winni
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|