keydown stops respondig (repost)

P

Peter Proost

Hi,

this is my (simplified) situation:

I have got 3 forms and one usercontrol:

their names are:
container (startup object),myform,another, mycontrol

contair has got IsMdiContainer set to true, a mainmenu with a menuitem,
which if you click it opens myform with the following piece of code:

Dim objMy As New myform
objMy.MdiParent = Me
objMy.WindowState = FormWindowState.Maximized
objMy.Show()



on myform there's a tabcontrol with to tabpages, on the first tabpage
there's a button and if you click it the form called "another" opens with
this piece of code:

Dim objAnother As New another
objAnother.MdiParent = MdiParent
objAnother.WindowState = FormWindowState.Maximized
objAnother.Show()

on the second tabpage is myusercontrol which contains 2 textboxes if you
press the enter key in the first textbox the focus is set to the second
textbox and that's it.

Now what's the problem I've got:
If I run the project then click on the menuitem, and go to the second
tabpage and press enter in the first textbox the keydown event fires ok.
But if I first press on the button on the first tabpage which opens
"another" form and close that form and then go to the second tabpage and
press enter in the textbox the keydown doesn't fire.

Attached is the testproject.

Any help would be appreciated.

Thanks in advance,

Greetz Peter
 
C

Cor Ligthert [MVP]

Peter,

In my newsreader your sample does not show up, did you zip it?

Cor
 
P

Peter Proost

Hi Cor I did zip it, but I forgot to remove the line which said the example
was attached because it isn't attached with this post, this is because I
also posted the question with the attachement 2days ago but I didn't get any
reaction to that post. So that's why I reposted it without attachement
because for example in google beta groups the post with the attachement
didn't show up. But in my outlook express it shows, you can find the
attachement in that post (dated 17/08/2005) with keydown stops responding as
subject. If you can't find I'll repost the attachment this afternoon.

Thanks in advance greetz Peter
 
C

Cor Ligthert [MVP]

Peter,

Can you describe this for me more step by step
\\\
Now what's the problem I've got:
If I run the project then click on the menuitem, and go to the second
tabpage and press enter in the first textbox the keydown event fires ok.
But if I first press on the button on the first tabpage which opens
"another" form and close that form and then go to the second tabpage and
press enter in the textbox the keydown doesn't fire.
///
Because when I click on the menuItem I dont see a second tabpage, for that I
have to open first myform in your sample however am than not sure anymore if
I do it correct.

To test it, it is in my opinion really needed that you describe it step for
step (for the wrong situation).

.. Start program
.. Click MyForm ? or something else

For me (and I think as well for others who tried it) it is now a little bit
a to difficult puzzle.

Cor
 
P

Peter Proost

Hi Cor,

sorry I was a bit unclear but what I meant to say is,

- Run the project then click on the open menuitem and then on the my form
menuitem
now the form with the 2 tabpages appears
- Next go to the second tabpage and click in the textbox above the other
textbox and press enter, the focus moves to the second textbox. This is what
it should do.
- Now close the form with the 2 tabpages and open it again, click on the
button on the first tabpage, another form opens, just close this form and on
the form with the 2 tabpages go to the second tabpage and click in the
textbox above the other, press enter, now nothing happens.
-Now if I put a break at the textbox_keydown event, it fires with every key
I press except the return and enter key and that's my problem.

I hope this is a bit more clear

Greetz Peter and thanks in advance
 
C

Cor Ligthert [MVP]

Peter,

I assume this is a know bug, I tried it in 2005 beta and there is is
working.

It does not help much, howewer .......................

Cor
 
P

Peter Proost

Cor,

now I at least know that it isn't a mistake I've made,

thanks for helping

Greetz Peter
 
P

Peter Proost

Cor what forgot to mention is that I think that it also has something to do
with the focus, because if you in my example app drag the usercontrol from
the second tabpage and put it on the form not on the tabcontroler and the
run the app. You'll see that if you do the same thing: first push the button
on the first tabpage, close the form that opens and click in the first
textbox and if you then press enter you'll see that the form opens again
because the button seams to handle the enter key being pressed and not the
textbox as you would expect.
When you then debug this by putting a break at the button click event you
can see that in the command window - immediate 3 controls have got the
focus:

?btnOther.Focus
True
?MyControl1.TextBox1.Focus
True
?MyControl1.TextBox2.Focus
True

Greetz Peter
 
C

Cor Ligthert [MVP]

Peter,

There is a lot written in this newsgroup about focus problems with the
tabpage control.

Cor
 

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