Certain methods don't work (alert, confirm...)
mjohanning99 opened this issue ยท 10 comments
I've been having some issues with my Shoes. Certain methods just don't seem to work at all. When I try to create a confirm? it gives me the following error
NoMethodError: undefined method 'confirm?' for (Shoes::App:0x00000fa0 "Shoes 4"):Shoes::App Did you mean? confirm method_missing at org/jruby/RubyBasicObject.java:1657 method_missing at /home/marvin/.rvm/gems/jruby-9.1.13.0/gems/shoes-core-4.0.0.pre12/lib/shoes/app.rb:107 method_missing at /home/marvin/.rvm/rubies/jruby-9.1.13.0/lib/ruby/stdlib/forwardable.rb:189 block in postscreen at rerutwi.rb:95 eval_block at /home/marvin/.rvm/gems/jruby-9.1.13.0/gems/shoes-swt-4.0.0.pre12/lib/shoes/swt/swt_button.rb:26 block in _after_do_redefine_method_with_callback at /home/marvin/.rvm/gems/jruby-9.1.13.0/gems/after_do-0.4.0/lib/after_do.rb:99 block in click at /home/marvin/.rvm/gems/jruby-9.1.13.0/gems/shoes-swt-4.0.0.pre12/lib/shoes/swt/swt_button.rb:31 run_event_loop at /home/marvin/.rvm/gems/jruby-9.1.13.0/gems/swt-4.6.1.1/lib/swt/minimal.rb:107 event_loop at /home/marvin/.rvm/gems/jruby-9.1.13.0/gems/swt-4.6.1.1/lib/swt/minimal.rb:90 open at /home/marvin/.rvm/gems/jruby-9.1.13.0/gems/shoes-swt-4.0.0.pre12/lib/shoes/swt/app.rb:71 open_gui at /home/marvin/.rvm/gems/jruby-9.1.13.0/gems/shoes-core-4.0.0.pre12/lib/shoes/internal_app.rb:125 initialize at /home/marvin/.rvm/gems/jruby-9.1.13.0/gems/shoes-core-4.0.0.pre12/lib/shoes/app.rb:52 app at /home/marvin/.rvm/gems/jruby-9.1.13.0/gems/shoes-core-4.0.0.pre12/lib/shoes/app.rb:20 <main> at rerutwi.rb:108
I have tried this on both my Laptop and my Desktop but it doesn't work on either of them. I get basically the same error when trying to create an alert.
Hi there,
seems you are trying to call a method confirm?
- it's called confirm
- does that solve the problem?
When I try that I get the exact same error message, but it says "undefined method 'confirm', did you mean 'confirm?'"
Hi,
could you please show the offending code or even better produce a minimal sample? I'm asking because in my testing simple_dialogs.rb and simple_dialogs_outside.rb work just fine.
Thanks!
Tobi
For some reason, when I try the ones you sent it seems to work, but it doesn't work in the program I am currently making. I am not really that good at coding Ruby and especially Shoes yet, so maybe there's something I am missing here. Here is an example where an alert() should appear but it exits in an error instead. The same would happen if I used a "confirm" there.
Also, I am using the exit() method here, because Shoes.quit() also doesn't work.
@Jeytas I'm sorry but that code isn't a complete example, as in there's a Shoes.app do
or something missing. I.e. a script that we can execute and that produces the bug is ideal.
Btw. - one of my first shoes projects was also partially a twitter client. Meet infoes :)
edit: Looked at your project a bit, from what I gather it uses URLs, might be that dialogs are broken in that context not sure
Getting the same error on load using the shoes
command.
ERROR: undefined method 'alert' for (Shoes::App:0x00000fa0 "testing page"):Shoes::App
Using jruby 9.1.15.0 with shoes-4.0.0.rc1 on High Sierra
class AppComponent < Shoes
url '/', :index
url '/login', :login
def index
send('login')
end
def login
display_login
end
def display_login
alert("doesn't work")
end
end
Shoes.app width: 800, height: 600, title: 'testing page'
Thank you a lot @tedma4 !
It might be that we're not including the dialogues module for the URL stuff - I'll check it out.
edit:
Simplified example:
class AppComponent < Shoes
url '/', :index
def index
alert("doesn't work")
end
end
Shoes.app width: 800, height: 600, title: 'testing page'
FYI, I got it to work by calling the methods from the class itself. So, from my example above, calling AppComponent.alert('Does now!!!')
shows the alert
@tedma4 yup you can also call them directly on Shoes
- fix will be up in a minute :)
This seems fixed ๐