Peter --

Sorry, I don't know the answers to either of those questions, but I'd like
to.  We'll have to wait for someone else to respond.

Bill

On Thu, 11 Apr 2002 16:38:24 -0700, Peter Stephens <peter-
[EMAIL PROTECTED]> wrote:

>Thank you for your response Bill. The sample you linked to follows (and
>confirms) the same design pattern as my snippet.
>
>One other question: Is there a good way to enable/disable menu items in a
>defered, but dynamic way? I would like to set the enabled status for the
>menus when the Edit menu is activated and not when the textbox's edit
status
>changes.
>
>I noticed that the Selected event will not fire for parent MenuItems. That
>leaves the Click or Popup event. From the documentation, Popup would seem
to
>be for used for this very purpose...
>
>--
>Peter
>
>
>
>> Bill Schmidt spake:
>>
>> Peter --
>>
>> See http://discuss.develop.com/archives/wa.exe?
>> A2=ind0110c&L=dotnet&F=&S=&P=8043
>>
>> This will work in an MDI WinForm.
>>
>> Bill
>>
>> On Thu, 11 Apr 2002 13:21:05 -0700, Peter Stephens <peter-
>> [EMAIL PROTECTED]> wrote:
>>
>> >Unlike FoxPro or MFC there doesn't seem to be any automagic
>> support for the
>> >standard edit commands in a main menu. The textbox does have a context
>> menu,
>> >but there doesn't seem to be a way to associate that with a main
>> menu or a
>> >merge menu (in MDI).
>> >
>> >I have an idea for a method that might work:
>> >
>> >------>
>> >bool AllowCut()
>> >{
>> >        TextBox textBox = GetCurrentControlAsTextBox();
>> >        if(textBox == null) return false;
>> >
>> >        // Do we have text to cut?
>> >        return textBox.SelectionLength > 0;
>> >}
>> >
>> >void CutText()
>> >{
>> >        TextBox textBox = GetCurrentControlAsTextBox();
>> >        if(textBox == null) return;
>> >
>> >        // Cut the text
>> >        if(textBox.SelectionLength <= 0) return;
>> >        Clipboard.SetDataObject(textBox.SelectedText);
>> >        textBox.SelectedText = "";
>> >}
>> >
>> >// Return active control if it is a textbox, otherwise null
>> >TextBox GetCurrentControlAsTextBox()
>> >{
>> >        Form activeWin = ActiveMdiChild;
>> >        if(activeWin == null) return null;
>> >        Control activeControl = activeWin.ActiveControl;
>> >        if(activeControl == null) return null;
>> >        return activeControl as TextBox;
>> >}
>> >
>> ><------
>> >
>> >These routines would be wired into a main MDI window.
>> >This code has _NOT_ been tested and might not work, but it is
>> where I will
>> >start. Better ideas are welcome!
>> >
>> >--
>> >Peter
>> >
>> >You can read messages from the DOTNET archive, unsubscribe from
>> DOTNET, or
>> >subscribe to other DevelopMentor lists at http://discuss.develop.com.
>>
>> You can read messages from the DOTNET archive, unsubscribe from DOTNET,
or
>> subscribe to other DevelopMentor lists at http://discuss.develop.com.
>>
>
>You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
>subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to