Page 1 of 1

Selecting Text

PostPosted: Thu Jul 09, 2009 1:34 pm
by shevegen
What is the simplest way to select text that a user entered? On IRC (when I asked how to select text from the ttf.rb sample file) one solution was to find out where the mouse clicked (probably left mouse button press, selection up until left mouse button release)

Did sound complicated.

Perhaps there are simpler ways, maybe even without ttf?

Basically I'd like to have a simple way to select what a user types in i.e. a "highscore" field - with pure keyboard a user is probably faster, but I am interested in the functionality of mouse-select -> copy selection to clickboard, and then pasting it outside rubygame too (on a Linux system, which seems easier. I dont really know much about windows...)

Re: Selecting Text

PostPosted: Thu Jul 09, 2009 4:59 pm
by shawn42
A good start would be to look at TextField from rubygoo:
http://code.google.com/p/rubygoo/
http://code.google.com/p/rubygoo/source ... t_field.rb

I'm sure you could figure something out from that... I don't know how to send text to the copy-buffer though. (Maybe that's a feature request for Rubygame 3.0?) :D