TextBoxEx and mouse events problems

M

Maciej Kotok

Hi

Im trying to use the TextBoxEx Control in my Smart Device Application. Im
new with the OpenNETCF and I have some problems with the mouse events. I
have an object of textBoxEx class named textBox1 and I want to handle some
mouse event - let say Click. Here is my code:

using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Data;
using OpenNETCF.Windows.Forms;

namespace temp
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private OpenNETCF.Windows.Forms.TextBoxEx textBox1;
private System.Windows.Forms.MainMenu mainMenu1;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// textBox1
//
this.textBox1 = new TextBoxEx();
this.textBox1.Location = new System.Drawing.Point(8, 8);
this.textBox1.Multiline = true;
this.textBox1.Size = new System.Drawing.Size(224, 108);
this.textBox1.Text = "textBox1";
this.Controls.Add(textBox1);
this.textBox1.Click +=new EventHandler(textBox1_Click);
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.mainMenu1 = new System.Windows.Forms.MainMenu();
//
// Form1
//
this.Menu = this.mainMenu1;
this.MinimizeBox = false;
this.Text = "Form1";
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main()
{
ApplicationEx.Run(new Form1());
}
private void textBox1_Click(object sender, EventArgs e)
{
MessageBox.Show("Textbox1 Click");
}
}
}

There must me something wrong with it because it dosent work. The
textBox1_Click method dosen't activate. Is there anything else that i should
do to make my code work fine?

regards
Maciej Kotok
 
P

Peter Foot [MVP]

TextBoxEx inherits all it's events support from TextBox and this class
doesn't support the Click event, or rather it does but it is never raised.
You can handle the GotFocus event which will be raised when the user first
taps the control, but will only fire again if focus is lost from the
TextBox.

Peter
 
M

Maciej Kotok

If the Click event is not supported so do You have any idea where can I
disable/enable my cut/copy/paste toolbar buttons?

I wanted to do this in the Click event. Check if any text is selected and/or
if anything is in the clipboard. I'm also checking this things in KeyPress
event, but user can select text by tapping it, and GotFocus isnt good
enough.

The ideal solution would be the textBox.SelectedText event, but
unfortunately there isn't anything like that :|.

Any ideas?

regards
Maciej Kotok
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top