I am following a sample located here in the samples folder on the official Shoes github repo. I saw that the programmer defined a class Book
which inherited from Shoes
. I have a relatively large program coming along with shoes that I'm porting for 3.x, and I wanted to split all of my different classes into smaller files to make it easier on me. I have a file like so
#this class essentially sets up user interface
class Interface < Shoes
def initialize
flow do
@shed = button "New"
@editbutton = button "Edit"
@employees = button "Employees"
@sdays = button "Special Days"
@makenote = button "Make Note"
@backbutton = button "Go Back"
end
end
end
My main file looks like so
$LOAD_PATH << "."
require 'loader' #all of these are other classes i have defined
require 'interface' #contains the interface class
require 'schutil'
Shoes.app title: "Baesler's Scheduling Application", width: 1024, height: 768, resizable: true do
Interface.new
end
First of all, in the sample I provided, the programmer never had to use a block with Shoes.app. I don't know how, but his class got initialized with shoes when it was ran. That was my original intention, but when I try that (the code above without ever calling Interface.init), nothing shows up in Shoes, but it does load. However, using the above code as-is, I get the following error:
NoMethodError: undefined method 'flow' for nil:NilClass
If it helps at all, I am using the Shoes 4 preview 3 gem and am running Windows 8.1 64 bit. What am I doing wrong? Is this a bug in the Shoes codebase, or am I doing this wrong? Any help would be greatly appreciated.
You are overwriting the initialize method which breaks the whole setup of shoes (it needs to get an app instance on which to call the flow method for instance).
You are also following a
url
sample without using any actualurl
calls.A widget might suit your use case better.
Personally I rather resort to defining methods within an app and then calling those :)