[fxruby-users] Method calls with menus

Lyle Johnson lyle at lylejohnson.name
Tue Nov 25 16:31:29 EST 2008

On Nov 25, 2008, at 2:55 PM, Stuart Clarke wrote:

> I have a second GUI button which I am having trouble with. This  
> button will only work once the first button has been selected and  
> the data processed. This second button or RUN button is meant to  
> pass to another method in my code which will then run searches on  
> the already processed data. To do this I have the following code:
> mineEVT = FXMenuCommand.new(minerMenu,  
> "Run...").connect(SEL_COMMAND, method(:minecompleteEVT))
> My method is minecompleteEVT(). However upon running this code i get  
> the following error:
> c:/ruby/lib/ruby/gems/1.8/gems/fxruby-1.6.16-x86-mswin32-60/lib/ 
> fox16/responder2
> .rb:55:in `minecompleteEVT': wrong number of arguments (3 for 0)  
> (ArgumentError)

What does your minecompleteEVT() method look like? It should take  
three arguments:

	def minecompleteEVT(sender, sel, data)

When you click the button and FXRuby calls this method, it will pass  
in (1) a reference to the object (e.g. the FXButton) that's sending  
the message, (2) the message type and (3) any associated message data.

Hope this helps,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20081125/92844bb2/attachment.html>

More information about the fxruby-users mailing list