Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Creating an event for an existing property
Message
De
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:
01223277
Vues:
20
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
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform