Subject | Opinions (using TIB_Edit) |
---|---|
Author | Woody (TMW) |
Post date | 2004-11-17T19:32:27Z |
OK, I'm having a slight problem in deciding which is the best direction to
go for this so I'm asking for any opinions or other options.
I'm creating a custom time entry key procedure for the TIB_Edit component
for a certain client. Basically, depending on what portion is being entered,
the colon between hours and minutes would be automatically inserted.
Likewise, a space will be inserted between the time and either "a" or "p"
when typed if it isn't already there. I have been using the OnKeyPress event
and appending the key press and any other character(s) needed but having
problems with assigning the value back to the field after each key stroke
because it isn't a complete time entry yet.
For example:
Assume you start with a blank entry. The first key could be anything
from 1 to 9. If it's greater than 1, it should add the colon to begin
receiving the minutes. If not, it adds the current keystroke and waits for
the next key stroke. Each keystroke is looked at based on it's position and
the various possibilities for that position. Sometimes only the key pressed
is added and sometimes and additional character gets added as well. Get the
picture? I knew you would. :)
So:
Would it be better to post the additional keys into the buffer and let
Windows do the work for me or should I continue to try to assign the new
value back to the TIB_Edit directly? (So far, I haven't found a way to
assign the new value directly. I can assign TIB_Edit(Sender).Text the value
but it doesn't change the underlying field value when tabbing out of the
field.)
Thanks for any input into this.
Woody (TMW)
go for this so I'm asking for any opinions or other options.
I'm creating a custom time entry key procedure for the TIB_Edit component
for a certain client. Basically, depending on what portion is being entered,
the colon between hours and minutes would be automatically inserted.
Likewise, a space will be inserted between the time and either "a" or "p"
when typed if it isn't already there. I have been using the OnKeyPress event
and appending the key press and any other character(s) needed but having
problems with assigning the value back to the field after each key stroke
because it isn't a complete time entry yet.
For example:
Assume you start with a blank entry. The first key could be anything
from 1 to 9. If it's greater than 1, it should add the colon to begin
receiving the minutes. If not, it adds the current keystroke and waits for
the next key stroke. Each keystroke is looked at based on it's position and
the various possibilities for that position. Sometimes only the key pressed
is added and sometimes and additional character gets added as well. Get the
picture? I knew you would. :)
So:
Would it be better to post the additional keys into the buffer and let
Windows do the work for me or should I continue to try to assign the new
value back to the TIB_Edit directly? (So far, I haven't found a way to
assign the new value directly. I can assign TIB_Edit(Sender).Text the value
but it doesn't change the underlying field value when tabbing out of the
field.)
Thanks for any input into this.
Woody (TMW)