Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

start, finish, hover, leave events are not referring to the correct self for Shoes App, Window and Dialog #26

Open
IanTrudel opened this issue Jan 14, 2015 · 4 comments
Labels

Comments

@IanTrudel
Copy link
Collaborator

IanTrudel commented Jan 14, 2015

Shoes App, Window and Dialog will not receive the proper self reference on start, finish, hover and leave events. They will instead receive Shoes, of class Shoes, that _does not respond to instance_methods_ and such. The stack in the code below is the only one behaving properly.

Shoes.app(:title => "Shoes Events", :width => 450, :height => 250) {
   start { |n| para "Shoes: #{n}\n" }
   hover { |n| para "Shoes (hover): #{n}\n" }
   leave { |n| para "Shoes (leave): #{n}\n" }
   window(:title => "Window Events", :resizable => false) {
      start { |n| para "Window: #{n}\n" }
      hover { |n| para "Window (hover): #{n}\n" }
      leave { |n| para "Window (leave): #{n}\n" }
   }
   dialog(:title => "Dialog Events", :resizable => false) {
      start { |n| para "Dialog: #{n}\n" }
      stack {
         start { |n| para "Stack: #{n}\n" }
         finish { |n| alert "Stack: #{n}\n" }
         hover { |n| para "Stack (hover): #{n}\n" }
         leave { |n| para "Stack (leave): #{n}\n" }
         para "Hover over me!"
      }
   }
}
@ccoupe
Copy link

ccoupe commented Jan 14, 2015

The manual does discuss some of the odd behavior for how, when and why Shoes sets self. Hello->Rules. Changing those rules would require a lot of work, breaks compatibility with Shoes 2, 3, and (probably) 4. It might be easier to resurrect the WxRuby & WxSugar projects.

@IanTrudel
Copy link
Collaborator Author

Thank you for the reference. Your assessment is correct.

The manual section Hello->Rules doesn't make much sense to me. The approach taken by Shoes is flat in the hope to keep certain objects alive and breaks what would otherwise be normal Ruby behaviour. This unfortunately makes it necessary to create variables to access objects in their own block. It seems to be both a design feature and a design flaw.

Requires further investigation.

@ccoupe
Copy link

ccoupe commented Jan 14, 2015

Shoes only looks like Ruby! Repeat. Shoes only looks like Ruby! I imagine many of the newer Ruby meta-programming facilities will fail spectacularly in Shoes. Shoes is not Ruby. Shoes is not Ruby. Shoe is not ...

That part of the manual should warn experienced Rubyists more forcefully that Shoes is different. But even experienced people don't read the manual until something fails.

@IanTrudel
Copy link
Collaborator Author

That part of the manual should warn experienced Rubyists more forcefully that Shoes is different. But even experienced people don't read the manual until something fails.

I read it before but the implications were unclear at that time. Reading it again now that you provided a context proved challenging. I had to read it few times to fully understand what was going on. Sometimes the manual is prettier than useful. It would be really good with additional clarifications and better outline of what can do what, e.g. Shoes.app has access only to a subset of styles.

ccoupe pushed a commit that referenced this issue May 24, 2016
* readline.rb expects a terminal (or pty) in canonical mode. We don't have
  that on OSX. So we simulate, poorly at the momenent.
* the chances for a 'game mode' on OSX canical simulation are very very really slim.
* I didn't want to do it in Linux either, now I know why it it was a bad idea.
* Doesn't actually suck. too much. Since nobody is likely to use it. It's
* Good Enough.
This was referenced Nov 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants