hi,
the problem is that I am using JAPI so I am actually getting the number from a textfield. the textfield does not have a get_value() option, and so i need to write a conversion function preferably from a String to int.
or char to int since that's next best thing.
It is quite limited. You can also use the keylistener to restrict the keys that the user types but you'll probably have to handle the I/O and display as well.
Normally easier to get the project going then worry about non-numeric input if there is time. It is one of those things that can get you really bogged down. Took me 2 days to do it in Basic on a Commodore PET - the number of variations of numeric input is quite staggering, especially when you start including floating point formats and negative numbers.
character*64 str
integer i, field
...
! declare a field
field = j_textfield (frame)
...
! get the value
call j_gettext (field, str)
read (str, '(I5)') i
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.