L
Li Chen
Hi all,
Does anyone know how to get user input using InputDialog with FxRuby?
Thanks,
Li
Does anyone know how to get user input using InputDialog with FxRuby?
Thanks,
Li
Hi all,
Does anyone know how to get user input using InputDialog with FxRuby?
Thanks,
Li
Chris said:The docs (http://www.fxruby.org/doc/api/classes/Fox/
FXInputDialog.html) are very clear, IMHO
Need more details or a code sample?
Cheers
Chris
I need a code sample.
Thanks,
Li
Li said:Hi Chris,
Here is the script:
###
require 'fox16'
include Fox
result = FXInputDialog.getString("Enter some text...",self,"New
InputDialog","Please type some text:")
if result
print "User entered: " + result
end
###
Here is the result of running the script:
C:\ruby\self\fox>fox1.rb
C:/ruby/self/fox/fox1.rb:4:in `getString': No matching function for
overloaded 'FXInputDialog_getString' (ArgumentError)
from C:/ruby/self/fox/fox1.rb:4
I am sure what is wrong?
Li
Sorry there is a typo in my earlier post: I am NOT sure what is wrong
about the results when I followed Chris's code sample.
Thanks,
Li
Here is a full working example:
require 'rubygems'
require 'fox16'
include Fox
if __FILE__ == $0
FXApp.new do |app|
app.create
result = FXInputDialog.getString("Enter some text...",app,"New
InputDialog","Please type some text:")
if result
puts "User entered: " + result
else
puts "User cancled!"
end
end
end
Now the code is working. I have one more question. I copy one method
from FxRuby's rdoc as follows:
getString(initial, app, caption, label, ic=nil)
Prompt for a string, in a free-floating window..
What does ic=nil mean?
Thanks,
Li
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.