468,766 Members | 1,395 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,766 developers. It's quick & easy.

Event's code runs to completion before another event's code is entered?

If the user types into the TextBox of a combobox it works OK. But if he hold
a key down so the letter repeats quickly the code runs into trouble.

My questions are:

Is it true that an event's code is normally run to completion before another
event's code is entered (KeyUp in my case)?

If that is true and there are exceptions that let another event start do
they include:

When DoEvents is executed?
When File I/O is executed?

Any others...

I don't believe there is a DoEvents in the executed code but there is
definitely file I/O.

It's a large program and difficult to find things out by experimenting. If I
had the answers to the above it would help much.

Thanks
Oct 30 '07 #1
3 1265
Academia wrote:
If the user types into the TextBox of a combobox it works OK. But if he hold
a key down so the letter repeats quickly the code runs into trouble.
What kind of trouble?
My questions are:

Is it true that an event's code is normally run to completion before another
event's code is entered (KeyUp in my case)?
The events are queued in the message queue of the application, and the
queue is handled in the main thread, one message at a time.
If that is true and there are exceptions that let another event start do
they include:

When DoEvents is executed?
Yes, the DoEvents call will consume any available messages from the queue.
When File I/O is executed?
No.
Any others...
No.

--
Göran Andersson
_____
http://www.guffa.com
Oct 30 '07 #2
I just erassed the answer I was typying because something occured to me.

Holding a key down proprably generates many KeyPreses but no KeyUp event
until the key is released.

Not sure what other events are raised, but maybe TextChanged and others are
happening without the KeyUp I expected per input character and coded for.

I'll have to go look at the code.

Any way I can run the code and see which events were raised between the
KeyPress and the KeyUp events?

thanks

"Göran Andersson" <gu***@guffa.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
Academia wrote:
>If the user types into the TextBox of a combobox it works OK. But if he
hold a key down so the letter repeats quickly the code runs into trouble.

What kind of trouble?
>My questions are:

Is it true that an event's code is normally run to completion before
another event's code is entered (KeyUp in my case)?

The events are queued in the message queue of the application, and the
queue is handled in the main thread, one message at a time.
>If that is true and there are exceptions that let another event start do
they include:

When DoEvents is executed?

Yes, the DoEvents call will consume any available messages from the queue.
> When File I/O is executed?

No.
It must release the CPU while waiting for the i/o to complete.

>
> Any others...

No.

--
Göran Andersson
_____
http://www.guffa.com

Oct 30 '07 #3
Academia wrote:
Holding a key down proprably generates many KeyPreses but no KeyUp event
until the key is released.
Correct.
Not sure what other events are raised, but maybe TextChanged and others are
happening without the KeyUp I expected per input character and coded for.
The key events are put in the same queue as other events, and are
handled by the same message pump. If a keypress for example changes the
apperance of a control, the messages that tells the control to change
itself is added to the message queue.
Any way I can run the code and see which events were raised between the
KeyPress and the KeyUp events?
You could add Debug.Write statements to the event handlers, so that you
can track what's happening. (Debugging and putting break points in the
event handlers might not work very well, as you interfer so much on the
event handling process that way.)
>> When File I/O is executed?
No.

It must release the CPU while waiting for the i/o to complete.
Yes, but not to the thread that called the I/O operation. Whatever the
computer does while waiting for the I/O, it's not consuming event
messages in your application.

--
Göran Andersson
_____
http://www.guffa.com
Nov 1 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Paul E. Orman | last post: by
2 posts views Thread by James | last post: by
1 post views Thread by steven.varr | last post: by
2 posts views Thread by Paul E. Orman | last post: by
9 posts views Thread by jeff | last post: by
1 post views Thread by Jeremy Martin | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.