On Thu, 30 Oct 2008 13:28:08 -0700, jp2msft
<jp*****@discussions.microsoft.comwrote:
Hi Pete,
Thanks for the fast response!
Yes: There is a form that is waiting on input. The problem is
complicated by
the fact that both a scanner and the keyboard are allowed - just in case
an
item is too dirty to be scanned, a scanner gets dropped/smashed, or any
other
unforeseeable (sp?) mishap.
The keyboard requirement prevents implimenting a timer, and processing
starts once the RegEx expression is met.
Why does the keyboard requirement prevent using a timer? All you'd be
trying to do is ensure you've consumed all of the input currently
available. Even if the user can type as fast as the scanner can send
input, it should be the same goal and thus same logic, and for mortal
human users, they are likely to simply enter the data you want them to and
then wait. A short timer won't even be noticeable to them.
As far as whether processing starts as soon as the RegEx expression is met
goes, well...you wrote this code, right? You have control over when
processing actually starts. Besides, as I understand it, processing
doesn't literally start as soon as the pattern is matched, because you
prompt the user for confirmation first. So all we're really talking about
here is a short delay before that confirmation dialog is presented.
Again, a half second delay (or whatever you decide is appropriate for the
purpose of consuming whatever data is left from the scanner) should be
perfectly fine.
Creating a custom modal form is a good idea. I did think of this myself,
but
dismissed it, thinking that this was a more complicated solution than
learning how to use tools that were at my disposal.
A modal form is practically the same in implementation as any other form.
If you've already coded a form that can take the input from the scanner,
then I think you already have the knowledge needed to do something similar
in a modal form.
Along that same line, now I am thinking about shifting the Focus to a
ReadOnly textbox as soon as the RegEx expression is met. This should
allow
all of the remaining buffer characters to be consumed without anything
in my
application trying to use them. It still sounds like a hack, though. :)
I don't understand the description. The problem, as I understand it, is
that the remaining input is processed by the modal MessageBox you
display. Unless you delay presentation of that MessageBox long enough for
the read-only TextBox to consume the remaining input, shifting the focus
won't help.
If you _do_ delay presentation of the MessageBox, then that's basically
just the timer-based solution I proposed earlier. Right?
Pete