Amazing! I've changed Widget to Shoes::Widget (thank you Theg for the
clues!) and it works!
In my current project I have (among others) a file with the customized
Table widget (from shoesbox), table_widget.rb, with a class Table
defined like:
class Table < Shoes::Widget # changed here, was: < Widget
....
end
and the main.rb with the whole Shoes.app(..,){...} thing.
Perhaps it could be helpful to explicitly write somewhere in the docs
how to split custom widgets to separate files, etc.? (1 missing
sentence IMHO).
sw
Wiadomość napisana w dniu 2009-01-23, o godz. 04:25, przez Tieg Zaharia:
Hi Szymon,
There's a builtin class in Shoes called Widget, so you have to be
more specific for Ruby to recognize your Widget class. Instead of
"Widget.do_something", try "::Widget.do_something" to specify the
top level scope. Hope that helps,
-tieg
On Thu, Jan 22, 2009 at 10:03 PM, Szymon Wrozynski <[email protected]>
wrote:
Hello everybody!
I'm a new guy here, called SW (sw, esdoubleu, simon, Szymon, etc). I
saw shoes yesterday or something and I like it very much. But I
cannot handle one thing. Is it possible to create custom widgets in
separate rb files and include them in the main shoes app file?
I saw the tricks with gems and activerecord-like things. Also I
think the 'require' will work normally with normal (standard) ruby
files, but I cannot use a custom widget class defined in other file
than the main (startup) shoes file. The console tells me the Widget
is unknown constant so it seems the Shoes is processing the required
file outside its core?
Any help will be appreciated.
regards
sw
PS. I'm hacking (also) my English (it's not my native), so please do
not mind possible bugs ;)