HighTechTalks DotNet Forums  

TextBoxEx and mouse events problems

Dotnet Framework (Compact Framework) microsoft.public.dotnet.framework.compactframework


Discuss TextBoxEx and mouse events problems in the Dotnet Framework (Compact Framework) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Maciej Kotok
 
Posts: n/a

Default TextBoxEx and mouse events problems - 12-12-2004 , 05:17 PM






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



Reply With Quote
  #2  
Old   
Peter Foot [MVP]
 
Posts: n/a

Default Re: TextBoxEx and mouse events problems - 12-12-2004 , 05:30 PM






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

--
Peter Foot
Windows Embedded MVP
www.inthehand.com | www.opennetcf.org

"Maciej Kotok" <magic01 (AT) poczta (DOT) onet.pl> wrote

Quote:
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




Reply With Quote
  #3  
Old   
Maciej Kotok
 
Posts: n/a

Default Re: TextBoxEx and mouse events problems - 12-12-2004 , 08:03 PM



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


Użytkownik "Peter Foot [MVP]" <feedback (AT) no-spam (DOT) inthehand.com> napisał w
wiadomości news:%23YcPbKK4EHA.924 (AT) TK2MSFTNGP14 (DOT) phx.gbl...
Quote:
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




Reply With Quote
  #4  
Old   
 
Posts: n/a

Default Re: TextBoxEx and mouse events problems - 12-12-2004 , 10:23 PM



Use an IMessageFilter implementation and ApplicationEx.AddMessageFilter.

www.opennetcf.org/sdf

-Chris


"Maciej Kotok" <magic01 (AT) poczta (DOT) onet.pl> wrote

Quote:
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


Użytkownik "Peter Foot [MVP]" <feedback (AT) no-spam (DOT) inthehand.com> napisał w
wiadomości news:%23YcPbKK4EHA.924 (AT) TK2MSFTNGP14 (DOT) phx.gbl...
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






Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.