[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

How to get a string using InputDialog with FxRuby

Li Chen

9/25/2008 6:25:00 PM

Hi all,

Does anyone know how to get user input using InputDialog with FxRuby?

Thanks,

Li
--
Posted via http://www.ruby-....

9 Answers

Chris Hulan

9/26/2008 11:42:00 AM

0

On Sep 25, 2:25 pm, Li Chen <chen_...@yahoo.com> wrote:
> Hi all,
>
> Does anyone know how to get user input using InputDialog  with FxRuby?
>
> Thanks,
>
> Li
> --
> Posted viahttp://www.ruby-....

The docs (http://www.fxruby.org/doc/api/cl...
FXInputDialog.html) are very clear, IMHO

Need more details or a code sample?

Cheers
Chris

Li Chen

9/26/2008 12:39:00 PM

0

Chris Hulan wrote:
> On Sep 25, 2:25?pm, Li Chen <chen_...@yahoo.com> wrote:
>> Hi all,
>>
>> Does anyone know how to get user input using InputDialog ?with FxRuby?
>>
>> Thanks,
>>
>> Li
>> --
>> Posted viahttp://www.ruby-....
>
> The docs (http://www.fxruby.org/doc/api/cl...
> FXInputDialog.html) are very clear, IMHO
>
> Need more details or a code sample?
>
> Cheers
> Chris


I need a code sample.

Thanks,

Li
--
Posted via http://www.ruby-....

Chris Hulan

9/26/2008 2:19:00 PM

0

On Sep 26, 8:38 am, Li Chen <chen_...@yahoo.com> wrote:
> Chris Hulan wrote:
> > On Sep 25, 2:25?pm, Li Chen <chen_...@yahoo.com> wrote:
> >> Hi all,
>
> >> Does anyone know how to get user input using InputDialog ?with FxRuby?
>
> >> Thanks,
>
> >> Li
> >> --
> >> Posted viahttp://www.ruby-....
>
> > The docs (http://www.fxruby.org/doc/api/cl...
> > FXInputDialog.html) are very clear, IMHO
>
> > Need more details or a code sample?
>
> > Cheers
> > Chris
>
> I need a code sample.
>
> Thanks,
>
> Li
> --
> Posted viahttp://www.ruby-....

I was hopping you'd provide a sample of code showing what you are
trying to do ;)

a very simple example:
<code>
result = FXInputDialog.getString("Enter some text...",self,"New
InputDialog","Please type some text:")
if result
print "User entered: " + result
</code>

cheers

Li Chen

9/26/2008 2:49:00 PM

0

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
--
Posted via http://www.ruby-....

Li Chen

9/26/2008 4:21:00 PM

0

Li Chen wrote:
> 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
--
Posted via http://www.ruby-....

Chris Hulan

9/28/2008 3:03:00 AM

0

On Sep 26, 12:20 pm, Li Chen <chen_...@yahoo.com> wrote:
> Li Chen wrote:
> > 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
> --
> Posted viahttp://www.ruby-....

Sorry about that, I was on a computer without Ruby so it only worked
in Theory ;)

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

The dialog requires an app (or a parent window), my initial example
didn't account for that

Any clearer?

Li Chen

9/28/2008 1:11:00 PM

0


>
> 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

--
Posted via http://www.ruby-....

Chris Hulan

9/29/2008 12:19:00 PM

0

On Sep 28, 9:10 am, Li Chen <chen_...@yahoo.com> wrote:
> > 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
>
> --
> Posted viahttp://www.ruby-....

Don't see anything in the FXRuby docs, but according to the Fox docs
for FXInputDialog that parameter is an FXIcon. So I guess you can
pass a reference to an Icon to be displayed in the dialog

Cheers

Li Chen

9/29/2008 2:13:00 PM

0

Hi Chris,

Thank you very much. Now I think it is a little bit easier for me to
read the FxRuby API document.

Li

--
Posted via http://www.ruby-....