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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Academia

    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


  • =?ISO-8859-1?Q?G=F6ran_Andersson?=

    #2
    Re: Event's code runs to completion before another event's code isentered?

    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
    _____
    Göran Anderssons privata hemsida.

    Comment

    • Academia

      #3
      Re: Event's code runs to completion before another event's code is entered?

      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" <guffa@guffa.co mwrote in message
      news:%23daNOwvG IHA.5276@TK2MSF TNGP04.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

      Comment

      • =?ISO-8859-1?Q?G=F6ran_Andersson?=

        #4
        Re: Event's code runs to completion before another event's code isentered?

        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
        _____
        Göran Anderssons privata hemsida.

        Comment

        Working...