Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cursor Control in Text Box

Status
Not open for further replies.

Shanachie

Programmer
Jun 18, 2000
92
US
In my app, there are several text boxes for users to input special instructions. When they click on the box, I insert the user's name and the date and time, to document who and when. (That settles a lot of arguments about who screwed up the customer's order.) When they do that, however, the cursor is at the beginning of the name/date/time string. How can I automatically move the cursor to the end of that string?

TIA,
Shanachie
 
That probably not the good idea to do - because if there is a ON KEY LABEL END defined somewhere that will get precedence.

Instead try this:
THIS.SelStart = len(alltrim(transform(THIS.Value)))THIS.SelLength = 0

THIS is the TextBox control here. You can put this code after your code which is logging the changes.
 
Hi Shanachie,

The idea of keeping the track .. you are first inserting the name, date & time string and allowing the data to be entered.

Now the question..(since I see a defect in conception).. that as a user I am aware of what another users such insertion looks like and so.. press the back space and change that vital information. The build of such data becomes questionable.

SO my suggestion.. allow the text box to be entered as normal text box and then.. before update..
save it as.. "myUser+Date+TimeString"+" : "+myTextBoxValue

This way the security to the user info and also your problem of putting at the end gets solved.

However, in the got focus event.. KEYBOARD "{END}" will solve the question you raised.

:)

ramani :)
(Subramanian.G)
 
Hi, Ramani!

Your comments are spot on. I had simplified the problem statement to focus on the issue. What I actually do is to have the text box collect a new string to be appended to the existing string. The form has two text boxes, the top one being read-only, showing the existing text. The bottom one is for the user to enter text to be added. There is no way for the user to edit the existing text. This became a requirement when an account rep was caught "fixing" her incorrect special instructions after an order was sewn wrong.

(The application supports an operation that embroiders logos and such on shirts, jackets, hats, etc. for corporate customers. The text involved is for "Special Instructions", details that need to be communicated to the Production folks. Sometimes an order may be for 5,000 units. If they screw up some detail, they may have to redo the order. When that happens, they like to be able to figure out how things got screwed up.)

I show the name/date/time in the "new text" text box to remind the users as they enter these Special Instructions that they are responsible for getting it right.

One more detail: the new text is added to the beginning of the existing text so that the notes are displayed in newest-to-oldest order, newest at the top.

Thanks for your comments,
Shanachie

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top