Hi all, I have an FX GUI which does a number of things. It has two tabs which are two hold two different sets of data. My GUI has a menu which stipulates the contents of each tab. Clicking on the menu and open brings up a dialog box, as i the user select a folder it passed that folder (path) to a method which then scans the directory for files of certain type and prints the contents onto the GUI. 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) Why am I getting this error when I dont seem to passing any arguements? I take it I am not understanding something. Thanks in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20081125/05561c2c/attachment.html>
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) ... end 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, Lyle -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20081125/92844bb2/attachment.html>
Ah yes, I should have included that, see below: ? def minecompleteEVT(sender, sel, ptr) ??? @evtrievefindings.push "Hello" ? ??? if @evtrievefindings.length != 0 ????? @mineresults.text = @evtrievefindngs.join("\n") ??? end? ? end Basically clicking the run button will run the following method, please note the above is just an example and not the contents of the actual method. Many thanks --- On Tue, 25/11/08, Lyle Johnson <lyle at lylejohnson.name> wrote: From: Lyle Johnson <lyle at lylejohnson.name> Subject: Re: [fxruby-users] Method calls with menus To: fxruby-users at rubyforge.org Date: Tuesday, 25 November, 2008, 9:31 PM 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) ... end 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, Lyle_______________________________________________ fxruby-users mailing list fxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/fxruby-users -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20081125/95f78583/attachment.html>
On Nov 25, 2008, at 3:31 PM, Stuart Clarke wrote:> Ah yes, I should have included that, see below:<snip> It is unclear from your response: Are you saying that once you added those missing arguments to the method definition, it started working? Or are you saying that the argument list for minecompleteEVT() was already correct and it''s still not working? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20081125/bdf6501e/attachment.html>
Sorry. ? I already had that code in my method and I still get the same error which to me doesn''t make any sense. My method that gives the error looks like: ? ? def minecompleteEVT(sender, sel, ptr) ??? @evtrievefindings.push "Hello" ? ??? if @evtrievefindings.length != 0 ????? @mineresults.text = @evtrievefindngs.join("\n") ??? end? ? end ? Many thanks. If you need more of my code, I can get it to you. --- On Tue, 25/11/08, Lyle Johnson <lyle at lylejohnson.name> wrote: From: Lyle Johnson <lyle at lylejohnson.name> Subject: Re: [fxruby-users] Method calls with menus To: fxruby-users at rubyforge.org Date: Tuesday, 25 November, 2008, 10:28 PM On Nov 25, 2008, at 3:31 PM, Stuart Clarke wrote: Ah yes, I should have included that, see below: <snip> It is unclear from your response: Are you saying that once you added those missing arguments to the method definition, it started working? Or are you saying that the argument list for minecompleteEVT() was already correct and it''s still not working?_______________________________________________ fxruby-users mailing list fxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/fxruby-users -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20081126/47bc8138/attachment-0001.html>
I have fixed that problem now, it was not liking being public to the entire class. However I am getting an error like so which is new and I have not changed any of my code. I have simpily broke it down into 2 steps: ?syntax error, unexpected tCONSTANT, expecting '')'' More strange is the data that is causing this error is commented out see below: #@evtrievefindings.push "Number of sucessful local logons: #{locallogon}" Thanks --- On Tue, 25/11/08, Lyle Johnson <lyle at lylejohnson.name> wrote: From: Lyle Johnson <lyle at lylejohnson.name> Subject: Re: [fxruby-users] Method calls with menus To: fxruby-users at rubyforge.org Date: Tuesday, 25 November, 2008, 10:28 PM On Nov 25, 2008, at 3:31 PM, Stuart Clarke wrote: Ah yes, I should have included that, see below: <snip> It is unclear from your response: Are you saying that once you added those missing arguments to the method definition, it started working? Or are you saying that the argument list for minecompleteEVT() was already correct and it''s still not working?_______________________________________________ fxruby-users mailing list fxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/fxruby-users -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20081126/8e813ec8/attachment.html>
On Nov 26, 2008, at 3:44 PM, Stuart Clarke wrote:> I have fixed that problem now, it was not liking being public to the > entire class. However I am getting an error like so which is new and > I have not changed any of my code. I have simpily broke it down into > 2 steps: > > syntax error, unexpected tCONSTANT, expecting '')'' > > More strange is the data that is causing this error is commented out > see below: > > #@evtrievefindings.push "Number of sucessful local logons: > #{locallogon}"Is there any way you can post the revised code (or send it off-list if you''d prefer)? It looks like you have a syntax error somewhere in this *.rb file, probably somewhere *before* the line that it''s actually reporting as having the error. When I get a syntax error like this and I just can''t see where it is, I find it sometimes helps to comment out sections of the code until it starts working, and then focus in on the most recently commented out section (which is likely to be where the problem lies). -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/fxruby-users/attachments/20081126/12837735/attachment.html>