3 Replies Latest reply on Jan 3, 2011 8:19 PM by Gregory Lafrance

    TextInput Enter Event Timing

    oldMster Level 3

      I am having an odd problem with the Enter Event on a text input field.


      here is the scenario.  I have a TextInput field that the user can enter a value in.  If they manually enter the value, and press 'Enter', it works properly.  The field value is also available in a bar code.  the barcode reader is programmed to add an 'enter' to the end of the input string.  The value that is available in the 'Enter' event handler for that field is somewhat randomly a subset of the actual data read in the barcode.  About 1 in 10 times, it processes the field correctly.  It always appears ok on the screen, but I have the Enter event handler issuing an http request to retrieve information about the value entered, and the value at that point is 90% of the time not correct.  It appears the 'enter event' is being fired when the 'Enter' is put into the input buffer, not when it is 'popped' out.  This is really a serious problem since this is a healthcare application and we don't really want the user entering the value by hand.   Is there any way to change this behavior?



        • 1. Re: TextInput Enter Event Timing
          oldMster Level 3

          As a work around for now, I have changed the 'Enter' event handler to a 'dummy' method that starts a Timer for 100 milliseconds.  The Timer's event handler is the 'real' Enter event handler.  This is working, and the user doesn't notice the delay, but seems like a kludgey work around to me, and will be a real pain to implement for every field that we want to allow barcode entry for.  Surely there is a better way....



          • 2. Re: TextInput Enter Event Timing
            Gregory Lafrance Level 6

            Not exactly clear on your description of the problem. What do you mean the value is popped out?


            Need a more clear description and then might be able to provide a more rational solution.

            • 3. Re: TextInput Enter Event Timing
              oldMster Level 3

              What I mean is that the 'Enter' is (or at least appears to be) triggering the 'Enter' event before the input that was entered before the 'Enter' button was 'pressed' by the barcode reader has made it into the control.


              Say the barcode has 10 characters in it:



              If the user manually enters the value and press enter, then texinput.text is always equal to GY00000001 when the 'Enter' event accesses the control


              If the user uses the barcode reader to put the value in, then I get values like 'GY00', 'GY', 'GY0000' as the value in textinput.text when the 'Enter' event accesses the control.  The actual value varies with each read, and about 1 time in 10 it will have the whole value.  The screen display the user sees has the full value in it.


              So - my working theory is that Flash/Flex is firing the 'Enter' event when the 'Enter' key is placed into the keyboard input buffer, not when the 'Enter' key is processed out of the keyboard input buffer, so when it is fired the remaining characters go on to be processed, but aren't available in the textinput.text property yet in the 'Enter' event.  Normally this wouldn't be a problem because it would take a very fast user to actually get data into the buffer that fast.  The barcode reader, however, IS that fast.


              My theory seems to be confirmed, or at least plausible, since the workaround of having the 'Enter' event not do anything but fire off a Timer that waits 100 milliseconds, then calls the actual method I want to use to process the textinput.text value,  has 'fixed' (I would say masked, but for the user it looks fixed) the problem.