Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating an event for an existing property
Message
 
À
07/05/2007 23:38:11
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
OS:
Windows XP SP2
Divers
Thread ID:
01222600
Message ID:
01223344
Vues:
22
Maybe I didn't explain my goal here well. What I'm looking for is this:

1. I have a form with a textbox. The clipboard is empty. (The Cut, copy, and paste menuitems/toolbaritems should be disabled, i.e., identical to the default context menu provided by the framework.)
2. A user types some text and highlights the last two characters. The Cut and copy menues and toolbar items should become enabled.
3. User clicks the copy button on the toolbar. Now Paste should be enabled through out.

In VFP, I used the system's edit menuitems and a timer to maintain the enabled state for the toolbar and menuitems. Trying to not do it that way here but base it more on actual events.

What I'm seeing at the moment: For the menu, using the DropDownOpened event to correct the enabled status. But for the toolbar,....?




>Sorry I didn't get back to you sooner, Richard. I've been real busy today. =0(
>
>I don't know what kind of code you have in the Click of your Copy/Paste menu items, but you don't need to do anything with creating any new events. The menu clicks take care of it all. They should be something like this:
>
>
>private void copyToolStripMenuItem_Click(object sender, EventArgs e)
>{
>	if (this.ActiveMdiChild != null)
>	{
>		Control o = this.ActiveMdiChild;
>		while (o is ContainerControl)
>		{
>			ContainerControl oContainer = (ContainerControl)o;
>			o = oContainer.ActiveControl;
>		}
>		if (o != null && o is TextBox)
>			((TextBox)o).Copy();
>	}
>
>}
>
>private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
>{
>	if (this.ActiveMdiChild != null)
>	{
>		Control o =  this.ActiveMdiChild;
>		while (o is ContainerControl)
>		{
>			ContainerControl oContainer = (ContainerControl)o;
>			o = oContainer.ActiveControl;
>		}
>		if (o != null && o is TextBox)
>			((TextBox)o).Paste();
>	}
>}
>
>
>Does this help?
>
>~~Bonnie
>
>
>
>
>>Unfortunately, most of the users around here don't know/won't learn about those key combos. Hence, the menu item enabling.
>>
>>
>>>Richard,
>>>
>>>I don't think you even have to do anything ... I'm pretty sure that Ctrl/C and Ctrl/V work fine without any extra coding.
>>>
>>>~~Bonnie
>>>
>>>
>>>
>>>
>>>>Not sure about this one. How would or can you create a new event (not handler necessarily) to catch when someone selects text in a Textbox? What I'm looking to do is when someone selects text in a textbox the event will call up to the main (MDI application here) form to activate the cut and copy items.
>>>>
>>>>Thanks
>>>>
>>>>Richard
State of Florida, DCF
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform