[fxruby-users] Best class to use

Lyle Johnson lyle at lylejohnson.name
Tue Nov 24 16:51:26 EST 2009


On Tue, Nov 24, 2009 at 2:42 PM, Stuart Clarke <stuart_clarke86 at yahoo.com>wrote:

My questions are, how can I create the text field as an append-able area?
> For example, as a user I want to type things into the text area (input area)
> and I will also click buttons which will add some data to the input area
> also. At present when I click the buttons to add data it clears the text
> field (input area).
>

Well, to append text to an FXText widget, you can use the FXText#appendText
method. If it's an FXTextField, you'd need to grab the current text field
content, add the new content to it, and then set it back to the FXTextField,
e.g.

    text_field.text = text_field.text + "some appended text"

My second question is, how do I get the GUI to respond to new lines being
> entered into the text area (input area)? Each time a line is filled or the
> user hits the enter/return button I want the time to entered into the date
> area for the corresponding line in the input area for example
>
> INPUT AREA
>                             DATE AREA
> this is my data, i am the user (USER HITS ENTER FOR NEW LINE)
> Date value
>

I think the easiest way would be to listen for either the SEL_INSERTED or
SEL_CHANGED message from the FXText widget; see the API documentation for
more information:

    http://www.fxruby.org/doc/api/classes/Fox/FXText.html

Hope this helps,

Lyle
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20091124/ee81de87/attachment.html>


More information about the fxruby-users mailing list