repost - Re: Can't get TextBoxEx Numeric working

H

Hank

This thread was getting old and stale, but still unresolved, so I thought I
would bring it to the top. - Hank

I tried putting it in the load event, same problem. I take it you wanted to
see Style get set later, so I took it to the extreme and moved it to a
button and set it from there manually. Same problem.
Hank

"Peter Foot [MVP]" <[email protected] wrote in message
It may be a timing issue with when the control is created and hence whether
the handle is valid - if it isn't created at the time the handle is accessed
it may return an invalid handle and the message to set the input mode may
fail. Try removing the code to set the Style from the designer code and call
it in Form_Load instead.

Peter

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

"Hank" <[email protected] wrote in message
My device is an iPaq 1900 series.

Strange. I created a new project and TextBoxEx works for Numeric there
(both
device and emulators). But it still won't work on the project I've been
working on and of course, need it to work on. I've tried deleting the
TextBoxEx control from the form, removing all OpenNETCF stuff on the
toolbar, removing all references to OpenNETCF, closing VStudio, and then
re-adding the TextBoxEx to the toolbar and the reference in the project.
No
go. Doesn't work on emulators either.

The TextBoxEx control is on a tabpage, so I added a new one just directly
on
a form (different form) to see if maybe being on a tabpage made a
difference, but it still didn't work. I'm making sure I'm setting the
style
property to Numeric. I've tried setting that property in the constructor
and
in the load event.

I really don't see anything exceptional about my project. I've switched
from
using ApplicationEx.Run() and Application.Run() and no difference. The
only
thing in my project that's a little different is a reference to an Oracle
Lite dll.

I've soft resetted the device, deleted application folder on the device --
everything I can think of. Somehow it must be something about my project,
because that the only place it doesn't work.

Nifty control, would really like to use it in several places in my app.

Hank

"Peter Foot [MVP]" <[email protected] wrote in message
What device type are you targetting? Does it work on the emulator?

Peter

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

"Hank" <[email protected] wrote in message
Was using Application.Run(form) in my Main(). Just now switched to
ApplicationEx.Run(form), if that's what you mean, and I still have the
same
problem. Didn't know about ApplicationEx.


"Alex Feinman [MVP]" <[email protected] wrote in message
Are you using Application or ApplicationEx in your Main?

--
Alex Feinman
---
Visit http://www.opennetcf.org
"Hank" <[email protected] wrote in message
I must be doing something wrong with the OpenNETCF TextBoxEx control.

I've set the TextBoxStyle property to Numeric. When I type letters
in
the
textbox, letters appear. Same problem with the other styles.

public MyConstructor()
{
InitializeComponent();
txtOpenNETCF_TextBoxEx.Style = TextBoxStyle.Numeric;
}

I installed the control on the toolbar and dragged it onto the form

I didn't run the .msi installer for the binaries on my machine.
Could
this
be the cause? (I would hope not) I just copied the
OpenNETCF.Windows.Forms.dll into the Windows CE dir, and the
corresponding
dll and xml files in the Designer dir -- copied them from another
machine
where I ran the .msi installers.

Thanks,
Hank
 
S

Sergey Bogdanov

Hank,

it seems that the problem is inside TextBoxEx, the window handle of
textbox gets inside constructor, that it's not correct at all. I'll
suggest you a bit rewrite TextBoxEx:

1. remove initialization from contructor

public TextBoxEx()
{
hwnd = setHwnd();
defaultStyle = GetWindowLong(hwnd, GWL_STYLE);
}


2. Put it into the OnParentChanged event.

protected override void OnParentChanged(EventArgs e)
{
hwnd = setHwnd();
defaultStyle = GetWindowLong(hwnd, GWL_STYLE);

base.OnParentChanged (e);
}


.... and notice that the TextBoxStyle now you should set after setting
parent:

TextBoxEx tb = new TextBoxEx();
tb.Location = new Point(10, 10);
tb.Size = new Size(100, 20);
Controls.Add(tb);

tb.Style = OpenNETCF.Windows.Forms.TextBoxStyle.Numeric;


I hope it help,
Sergey
 

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