textControl, Events

"Alexander Gnauck" <[email protected]>
Newsgroups gmane.comp.lib.wxwindows.wxnet
Organization AG Software
Message-ID <005001c3b776$6e0a7970$0200a8c0@alex>
Hi,

i try to get the key pressed Events in a TextCtrl.

i do this with that:

// add EventHandler
EVT_TEXT			((int) MY_TEXT_CONTROL,	new
wx.EventListener(OnKeyUp));

// Event Function
private void OnKeyUp(object sender, wx.Event e)
{
	switch (e.ID)
	{
		case (int) MY_TEXT_CONTROL:
			wx.CommandEvent ce = (wx.CommandEvent)e;
			Console.WriteLine( ce.String );    //<== Error
after some chars in the Control
			break;
		...	
		...
	}
}

after typing some text (about 100 chars) i get following exception:
Unhandled Exception: System.NullReferenceException: Object reference not
set to an instance of an object.
   at wx.Object.wxObject_dtor(IntPtr self)
   at wx.Object.Dispose(Boolean disposing)
   at wx.wxString.Finalize()An unhandled exception of type
'System.NullReferenceException' occurred in wx.net.dll

Additional information: Object reference not set to an instance of an
object.

And 'ce.String' returns me always all the text in the Textbox. Am i
doing smth wrong? How an i get the last key pressed?

Alex



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.