Is this a Bug or something I oversee?

  • Thread starter Thread starter Cor
  • Start date Start date
C

Cor

Hi newsgroup

I was answering something to Dotnet Shadow when I remembered me that I had
send a posible Bug to Herfried and Ken Tuckers private newsgroup
"microsoft.public.dotnet.languages.vb.controls" on 25 november about almost
the same question Robert was asking. I never did get any answer on it.

That was with a button, from which I thought that it was after enabling
still firing.

Therefore before giving Robert an answer I tried it again but then with the
textbox and I thought that it was working fine.

But because I found the answer with textbox.readonly a very nice answer
yesterday in this newsgroup I did test that also.
\\\
Here is the code that left will somebody try it?
' needs one texbox, one button and one label on a form
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Me.TextBox1.ReadOnly = True
Me.Button1.Text = "Locked"
Me.TextBox1.Focus()
For y As Integer = 1 To 100
Threading.Thread.Sleep(50)
Me.Refresh()
Next
Me.TextBox1.ReadOnly = False
Me.Label1.Text = Me.TextBox1.Text
Me.Button1.Text = "Unlocked"
End Sub
///

If the textbox is disabled you can type some text (not repeating), and when
the sub is ended it comes in the textbox but not on the label.

If what I think that I see is true, I think it is not good to give the
advice to use the textbox readonly property

Please comments?

Cor
 
Cor said:
Hi newsgroup

Hi Cor,

I tried to figure out what's the core statement/question (or Cor statement?
*g*) with your message. Unfortunately I couldn't. I also see your other
message pointing me to this message.
I was answering something to Dotnet Shadow when I remembered me that I had

After I read it the first time, I thought you were referring to the
"Shadow(s)" keyword, so I didn't understand. :-)
 
Cor said:
\\\
Here is the code that left will somebody try it?
' needs one texbox, one button and one label on a form
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Me.TextBox1.ReadOnly = True
Me.Button1.Text = "Locked"
Me.TextBox1.Focus()
For y As Integer = 1 To 100
Threading.Thread.Sleep(50)
Me.Refresh()
Next
Me.TextBox1.ReadOnly = False
Me.Label1.Text = Me.TextBox1.Text
Me.Button1.Text = "Unlocked"
End Sub
///

If the textbox is disabled you can type some text (not repeating),
and when the sub is ended it comes in the textbox but not on the
label.

If what I think that I see is true, I think it is not good to give
the advice to use the textbox readonly property

Please comments?

I tested it again now, but, sorry, I don't see the point. The app behaves
like expected (like I expected it *g*). The text I type during Sub
Button1_Click is put in the message queue. After the loop, the content of
the textbox is copied to the label. As the entered chars are still in the
queue, it is still the text when the sub has been started. After the message
(button click) has been processed, the message queue is processed and the
chars are entered in the textbox.
 
Hi Armin,

From your messages in the other thread I understood that you did supose this
as espected, with a *g*.

But when you change the Me.textbox1.readonly = true to
me.textbox1.enabled is false
and then the other one also, you should get another behaviour.

And I thought, that should be if your comment is true be the same.

Cor
 
Cor said:
From your messages in the other thread I understood that you did
supose this as espected, with a *g*.

But when you change the Me.textbox1.readonly = true to
me.textbox1.enabled is false
and then the other one also, you should get another behaviour.

And I thought, that should be if your comment is true be the same.

The difference is that enabled = false sets the focus to another control.
That's why the keys are sent to the other control (to the button in my
case). The keys *are* sent to the textbox if readonly = true because the
focus is still on the textbox.
 
Hi Armin,

So the solution for this *g* can be to create a very small button or
something with focus?

What do you think?

Cor
 
Cor said:
So the solution for this *g* can be to create a very small button
or something with focus?

What do you think?

Hmm.... I expect that the control that has the focus before the loop will
have the focus after it. Or I'd better say, any control but this "small
button" should have the focus, but then it will also receive the keyboard
input.
 
Hmm.... I expect that the control that has the focus before the loop will
have the focus after it. Or I'd better say, any control but this "small
button" should have the focus, but then it will also receive the keyboard
input.

But if it is than a fake it does not matter.
(Button without events)

Cor
 
Back
Top