update text box with a timer whilst editing same text box 
Author Message
 update text box with a timer whilst editing same text box

I have a VB app which uses a timer to bring in real-time information in the
back ground. All works ok (well not 100%, or I guess I wouldn't be here
typing this).

If the user is entering a value in to a text box, say "7.125". If after the
user has typed 7.1, and is about to type the "2", a live number arrives in
the back ground, and the software updates the text box whilst the user is
typing.

What the user has typed so far is overwritten by the new number. The  cursor
is then positioned the left of the new number, and if the user then types
the "25" from the above number, you are left with a mixture of the old and
new number in the text box.

How do I handle this properly ?

Garry



Sat, 13 Sep 2003 02:41:36 GMT  
 update text box with a timer whilst editing same text box
Have the Focus (Get & Lose) pause the arrival of background info.

--
Curt

(Remove NOSPAM for E-Mail Replies)
http://www.Darkfalz.com
---------------------------------------------------------------
** And The Geek Shall Inherit The Earth
---------------------------------------------------------------

Quote:
> I have a VB app which uses a timer to bring in real-time information in
the
> back ground. All works ok (well not 100%, or I guess I wouldn't be here
> typing this).

> If the user is entering a value in to a text box, say "7.125". If after
the
> user has typed 7.1, and is about to type the "2", a live number arrives in
> the back ground, and the software updates the text box whilst the user is
> typing.

> What the user has typed so far is overwritten by the new number. The
cursor
> is then positioned the left of the new number, and if the user then types
> the "25" from the above number, you are left with a mixture of the old and
> new number in the text box.

> How do I handle this properly ?

> Garry



Sat, 13 Sep 2003 02:53:23 GMT  
 update text box with a timer whilst editing same text box
It's a bit tricky, really. You could, as someone has already suggested,
prevent the output of the real time information into the textbox whilst it
has the focus, but this would also prevent the real time information from
updating the textbox even after the user has finished entering his own data
if he leaves the focus where it is. Just what is it you are doing that
allows input of real  time data and user entered data into the same text
box? There may be some other way to solve the problem. After the user has
entered the number "7.125" (from your own example) what does he do then?
Does he press the Enter key or type a space or something? Without more
information it is difficult to sort this out. Have you considered setting
some sort of flag each time the user presses a key. You could, for example,
have a Form variable called Counter (Long) and set it to a specific value
(say 100) in the Text Box Keypress event. Have a Timer running continuously
with its Interval property set to 100 (approximately one tenth of a second).
In the Timer event, check if the Counter variable has reached zero and
decrement it if it has not done so. Then your "real time update" code could
check the Counter variable each time it wanted to output some text and if
the Counter is zero then output it in the normal way. If, however, the
Counter is not zero then save the data somewhere (a string array, for
example) instead of outputting it to the TextBox. Each time your "real time
update" code decides that it is safe to output stuff to the Text Box (the
Counter is zero) then it first of all "empties" the current contents (if
any) of the "saved data" array to the Text Box and then finally the current
data item. This should (with a bit of luck!) cause your "real time" output
to be suspended until ten seconds after the user has stopped bashing keys in
the Text Box!

I've just read back over what I have written and it doesn't even make sense
to me now! That, though, is because I am about half way through this
delicious bottle of Jacob's Creek Shiraz Cabernet. Actually, I should
rephrase that. It is the contents of the bottle that is delicious, not the
bottle itself!

Hope I haven't been too much of a hindrance!

Mike


Quote:
> I have a VB app which uses a timer to bring in real-time information in
the
> back ground. All works ok (well not 100%, or I guess I wouldn't be here
> typing this).

> If the user is entering a value in to a text box, say "7.125". If after
the
> user has typed 7.1, and is about to type the "2", a live number arrives in
> the back ground, and the software updates the text box whilst the user is
> typing.

> What the user has typed so far is overwritten by the new number. The
cursor
> is then positioned the left of the new number, and if the user then types
> the "25" from the above number, you are left with a mixture of the old and
> new number in the text box.

> How do I handle this properly ?

> Garry



Sat, 13 Sep 2003 04:11:32 GMT  
 update text box with a timer whilst editing same text box

Quote:
> If the user is entering a value in to a text box, say "7.125". If after
the
> user has typed 7.1, and is about to type the "2", a live number arrives in
> the back ground, and the software updates the text box whilst the user is
> typing.
> How do I handle this properly ?

You have the case of the oversight. It's a nice idea, but the one, basic,
simple problem most people overlook is the logistics of the problem. What is
happening is that you want the text box to update whilst the user has not
finished typing.
How does the computer know when you have finished typing?
Perhaps a button, set as Default = True which starts the timer off, or a
maximum length which sets the program off when the user has typed in five
characters.
What you need is some way of telling the computer to update the box when the
user has finished. Try putting the real-time processed number into the
TextBox.Tag and copying it back to the TextBox.Text when the user selects a
button. It might be a slightly easier thing to do.
Without much detail, I can't help you as I don't know what the program is
meant to achieve, or how is currently does it.

Hope this helps.

QuickHare
Remove the NOSPAM to E-Mail direct.
Enleve la NOSPAM E-Mail moi directement.



Sat, 13 Sep 2003 03:27:21 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Text box text on new page text box

2. help on the text box/edit box control

3. enter two columns of text to a text or edit box

4. Getting Text from a non text or edit box

5. Update Text Box from List Box

6. Vb 4.0 Problems updating Text Boxes from Combo Box linked to Data Control

7. How do you update text box from combo box

8. using VB text boxes data but not text boxes in word 2000

9. Auto popluate text box with data from another text box

10. Columns in List box, when inserting text from text box (VBA)

11. Colour Text Box/Class Wrapper for Rich Text Box

12. Passing Data from VB App Text Box to a Web Page Text Box

 

 
Powered by phpBB® Forum Software