471,599 Members | 1,835 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,599 software developers and data experts.

Textbox focus again again

Last week I posted this for the first time. However, I didn't get any useable
solution to my problem. I'm very keen on getting this problem solved, so
please excuse me for trying again. I'll try to be a little more precise.

I have an app running (minimized) and without showing itself on the task
bar. It puts an icon in the task pane (next to the clock), and when I click
this icon, a message handler is invoked and creates a new usercontrol on the
screen. This usercontrol contains a textbox. This textbox is the problem.
When the usercontrol appears I would like to give input to the textbox
immediately. I use the focus() method but all that happens is that I get a
text-cursor (flashing in the textbox) and it looks like its ready for input.
However, when I type on the keyboard, nothing happens. I have to click
somewhere on the usercontrol for the textbox to capture input from the
keyboard. I do not think that focus method is the key to the solution, I've
tried several combination from various methods. It looks like the fokus
medthod works on application level - or form - level, and not on Operating
system level - is that correct, any solution to my problem.

Thank you,
Regards Jesper.

Nov 17 '05 #1
2 1906
Perhaps you need a WIN32() like SetFocus() from User32.lib.

Nov 17 '05 #2
1) Focus method is useless when a form is shown for the first time if you
correctly entered TabIndex fields for each component. The field that will
first have focus is the one with the value '0'.

2) However, with Focus method, it would have worked. Do you have 'Enter' or
'GotFocus' that set a focus in one of the parent chain of your textbox ? If
not, how do you show your form ? How do you set the focus ? To your textbox
or to your usercontrol ? Do you have a sample of your code that you could
provide ?

"Jesper" <Je****@discussions.microsoft.com> a écrit dans le message de
news:E8**********************************@microsof t.com...
Last week I posted this for the first time. However, I didn't get any useable solution to my problem. I'm very keen on getting this problem solved, so
please excuse me for trying again. I'll try to be a little more precise.

I have an app running (minimized) and without showing itself on the task
bar. It puts an icon in the task pane (next to the clock), and when I click this icon, a message handler is invoked and creates a new usercontrol on the screen. This usercontrol contains a textbox. This textbox is the problem.
When the usercontrol appears I would like to give input to the textbox
immediately. I use the focus() method but all that happens is that I get a
text-cursor (flashing in the textbox) and it looks like its ready for input. However, when I type on the keyboard, nothing happens. I have to click
somewhere on the usercontrol for the textbox to capture input from the
keyboard. I do not think that focus method is the key to the solution, I've tried several combination from various methods. It looks like the fokus
medthod works on application level - or form - level, and not on Operating
system level - is that correct, any solution to my problem.

Thank you,
Regards Jesper.

Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Jose Egea | last post: by
reply views Thread by SpotsPlay | last post: by
4 posts views Thread by melanieab | last post: by
1 post views Thread by melanieab | last post: by
8 posts views Thread by cj | last post: by
8 posts views Thread by nil | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.