G4P use GTextField for number entry only

edited August 2016 in Library Questions

I'm working on a program that takes a grid of numbers as inputs. I'd like to use GTextField objects to enter each number. As far as I can tell, there's no easy way to limit the possible characters to the digits 0-9 only. I think I know how to make an event handler that's called whenever a text field changes, and simply deletes any wrong characters. The problem I'm running into here is that I'd need to find a way to scale this to work with multiple text fields. I would prefer not to have a separate event handler for each text field, as this would result in many copies of the same code, just with different method names. Any suggestions how I could go about doing this?

Answers

Sign In or Register to comment.