G4P Library How to get string from textfield?

I Must be missing something. such a trivial feature cannot go undocumented yet i cannot find it ANYWHERE. In hopes that quarks will see this because he made the library I ask the question here. I have a GUI built and i have a bunch of textfields and stuff. That's cool looking but it doesn't do anything. What i need to know is how do i get the value of the textfield. What exactly is the variable or function i need to use to get what is typed into the textfield?

Answers

  • edited November 2013 Answer ✓

    It is not undocumented - its just hard to find. When looking at the reference documents if you can't see the method you need in the appropriate class then look at the class it inherits from.

    Both GTextField and GTextArea inherit from the GEditableTextControl class. This means that any method in this class are also available for both textfield and textarea controls. In this class we have the getText() method - so

    String txt = textfield.getText(); // get text typed in a GTextField control
    
  • Thank you i figured it out a bit ago but it was hard to find you are not joking.

Sign In or Register to comment.