I need to automatically enable/disable Paste menu item in MONO .NET 2 Winform Edit menu.
http://www.yoda.arachsys.com/csharp/faq/#clipboard explains how to implement this using p/invoke. How to implement this functionality in MONO WinForms in Linux ? Andrus. http://www.yoda.arachsys.com/csharp/faq/#clipboard contains: How can I monitor changes to the Clipboard contents (e.g. to enable/disable items on the Edit menu, depending on whether there is something to paste)? Import the SetClipboardViewer API function, and call it in your initialisation code, passing the handle of your form. The form will then receive WM_DRAWCLIPBOARD messages, which you can handle in WndProc. using System.Runtime.InteropServices; ... [DllImport("user32.dll")] public static extern int SetClipboardViewer(int hWnd); private const int WM_DRAWCLIPBOARD = 776; // ... somewhere in initialisation code ... SetClipboardViewer(this.Handle.ToInt32()); protected override void WndProc(ref Message m) { // Process the message normally base.WndProc(ref m); if (m.Msg == WM_DRAWCLIPBOARD) { // ... respond to Clipboard changes ... } } _______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
