How to set up GUI action events?

edited November 2013 in Library Questions

I've downloaded the G4P GUI tool and was wondering how I extract information entered into a text box to apply to other methods?

public void textfield2_change1(GTextField source, GEvent event) { 
  int e = event.getValue(); 
}

I assume it would be something along these lines but it doesn't seem to be working? Is there a good tutorial out there on how to do this for all of the different buttons and lists etc.

Answers

  • I have formatted the text for you as it makes it easier to read. In future highlight your code and click on the C button it will indent your code so it will be formatted when you post your discussion.

    To get the test out of the text field create a String variable called text (or choose your own identifier) then -

    public void textfield2_change1(GTextField source, GEvent event) {
      text = source.getText();
    }
    
  • Ah thanks I will do in the future. And that worked cheers.

Sign In or Register to comment.