Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Knox on Sat 01/01/2011 22:42:42

Title: Modify the insertion point via script in textboxes?
Post by: Knox on Sat 01/01/2011 22:42:42
Is there any way to move the insertion point's position in a textbox? Id like to make a keyboard shortcut that when the player presses the left or right arrow key, the insertion point moves left or right by one character (like in any text editor)...

...I think the answer will be "no", though (I cant seem to find anything in the manual).
Title: Re: Modify the insertion point via script in textboxes?
Post by: monkey0506 on Mon 03/01/2011 06:23:38
It would have to be manually scripted..but would be possible. It would be quite easy actually if you had a maximum length for the textbox that would fit within the fixed width of the box..
Title: Re: Modify the insertion point via script in textboxes?
Post by: Knox on Mon 03/01/2011 20:31:30
hmm, ok so its possible... I actually do have a maximum character amount of 14 for this text box, its for the saved game names the user types in.

Any help would be appreciated ;D
Title: Re: Modify the insertion point via script in textboxes?
Post by: Knox on Tue 08/02/2011 03:51:21
Sorry to bump this old thread, but would this imply me having to copy the character closest to the insertion point inside a variable, delete it, and move the insertion point to the left (then put back the last-saved charaction using the variable)?

If not, Im guessing I should try making a sprite that fakes the insertion point? (Id rather not have to resort to doing that though!)
Title: Re: Modify the insertion point via script in textboxes?
Post by: Khris on Tue 08/02/2011 07:44:53
To clarify what manually means here: you have to code the entire textbox. I'd use a label for the text and an animated button as cursor.
You'll also need GetTextWidth() (http://www.adventuregamestudio.co.uk/manual/GetTextWidth.htm).
Title: Re: Modify the insertion point via script in textboxes?
Post by: Knox on Tue 08/02/2011 14:49:11
ah ok! Ill try that and see what I can do! thnx...."Khricey"...hehee, nice name :)