Modify the insertion point via script in textboxes?

Started by Knox, Sat 01/01/2011 22:42:42

Previous topic - Next topic

Knox

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).
--All that is necessary for evil to triumph is for good men to do nothing.

monkey0506

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..

Knox

#2
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
--All that is necessary for evil to triumph is for good men to do nothing.

Knox

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!)
--All that is necessary for evil to triumph is for good men to do nothing.

Khris

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().

Knox

ah ok! Ill try that and see what I can do! thnx...."Khricey"...hehee, nice name :)
--All that is necessary for evil to triumph is for good men to do nothing.

SMF spam blocked by CleanTalk