rubymotion-community / sugarcube

Some sugar for your cocoa. RubyMotion helpers.
Other
422 stars 66 forks source link

sugarcube-events doesn't work when you don't require sugarcube-constants #149

Closed dmarkow closed 10 years ago

dmarkow commented 10 years ago

I only required sugarcube-events and couldn't get it to work, until I realized it was calling .uicontrolevent on the events symbol argument passed in to .on().

I'm new to sugarcube, so I'm not sure if it would be appropriate to explicitly require sugarcube-constants inside of sugarcube-events?

It does look like some of the files do something like this, e.g. sugarcube-core.rb has:

require File.join(File.dirname(__FILE__), 'sugarcube-coregraphics.rb')
require File.join(File.dirname(__FILE__), 'sugarcube-to_s.rb')
colinta commented 10 years ago

You can use the built in constants, like UIControlEventTouchUpInside, instead of the .uicontrolevent method. On Aug 13, 2014 5:28 PM, "Dylan Markow" notifications@github.com wrote:

I only required sugarcube-events and couldn't get it to work, until I realized it was calling .uicontrolevent on the events symbol argument passed in to .on().

I'm new to sugarcube, so I'm not sure if it would be appropriate to explicitly require sugarcube-constants inside of sugarcube-events?

It does look like some of the files do something like this, e.g. sugarcube-core.rb https://github.com/rubymotion/sugarcube/blob/master/lib/sugarcube-core.rb has:

require File.join(File.dirname(FILE), 'sugarcube-coregraphics.rb')require File.join(File.dirname(FILE), 'sugarcube-to_s.rb')

— Reply to this email directly or view it on GitHub https://github.com/rubymotion/sugarcube/issues/149.

colinta commented 10 years ago

Does that make sense?

dmarkow commented 10 years ago

Oops, sorry for not replying. Yes, makes sense, something like this?

button.on(UIControlEventTouchUpInside) { my_code }
colinta commented 10 years ago

Yup, that should work!