Permalink
Browse files

added an attention, sample 65

  • Loading branch information...
1 parent 2d3d1f7 commit 57562acd4cbddab6b64abaa4a1d33054af8474ac @ashbb committed Feb 8, 2009
View
@@ -2,7 +2,7 @@ Shoes Tutorial Note
===================
**- For the Shoes App Rookie Creators -**
-Feb. 6th, 2009 by ashbb (Satoshi Asakawa)
+Feb. 8th, 2009 by ashbb (Satoshi Asakawa)
Table of contents
-----------------
@@ -27,7 +27,7 @@ Table of contents
- [00504 App object and coding style (sample16.rb, sample17.rb, sample18.rb, sample47.rb)](http://github.com/ashbb/shoes_tutorial_html/tree/master/mdowns/00504_App_object_and_coding_style.mdown)
- [00505 Built-in Constants and methods](http://github.com/ashbb/shoes_tutorial_html/tree/master/mdowns/00505_Built-in_Constants_and_methods.mdown)
- [00506 Scope: A tip of using the YAML file (sample19.rb, sample19-1.rb)](http://github.com/ashbb/shoes_tutorial_html/tree/master/mdowns/00506_Scope__A_tip_of_using_the_YAML_file.mdown)
- - [00507 keypress, mouse and clipboard (sample20.rb, sample21.rb)](http://github.com/ashbb/shoes_tutorial_html/tree/master/mdowns/00507_keypress,_mouse_and_clipboard.mdown)
+ - [00507 keypress, mouse and clipboard (sample20.rb, sample21.rb, sample65.rb)](http://github.com/ashbb/shoes_tutorial_html/tree/master/mdowns/00507_keypress,_mouse_and_clipboard.mdown)
- [00508 the Widget class (sample22.rb, sample49.rb)](http://github.com/ashbb/shoes_tutorial_html/tree/master/mdowns/00508_the_Widget_class.mdown)
- [00509 shape (sample23.rb)](http://github.com/ashbb/shoes_tutorial_html/tree/master/mdowns/00509_shape.mdown)
- [00510 mask (sample24.rb)](http://github.com/ashbb/shoes_tutorial_html/tree/master/mdowns/00510_mask.mdown)
View
@@ -1,5 +1,6 @@
Change log:
-----------
+Feb 08th, 2009: Added an attention, sample 65. <br>
Feb 06th, 2009: Added chapter 00537. <br>
Feb 05th, 2009: Added a link to Michael's blog site and a comment into gallery4.rb for BlueCloth. <br>
Feb 04th, 2009: Added gallery 4. <br>
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -62,3 +62,30 @@ We can get keypress events. <br>
**sample21.png**
![sample21.png](http://github.com/ashbb/shoes_tutorial_html/raw/master/images/sample21.png)
+
+
+ATTENTION
+---------
+I'm not sure why... But may be a bug of Shows, I guess...
+
+See the following snippet. <br>
+Case 1,3,4 will crash. Only case 2 is okay (not crash). Because it creates a new empty String object `''`, then assigns it to the `self.clipboard` instead of `p2.text` itself.
+
+*I noticed this problem when I read the code of [rotten.rb](http://github.com/citizen428/littlesteps/blob/c15ee6a7838b962cbc64bbf3c1570d116bd9c9c1/rotten/rotten.rb) created by [Michael Kohl](http://citizen428.net/).*
+
+ # sample65.rb
+ Shoes.app :width => 400, :height => 50 do
+ p1 = para
+ p2 = para
+ p3 = para
+ p4 = para
+ button('case 1'){self.clipboard = p1.text} #=> crash
+ button('case 2'){self.clipboard = p2.text.eql?('') ? '' : p2.text } #=> not crash
+ button('case 3'){self.clipboard = p3.text.eql?('') ? p3.text : p3.text } #=> crash
+ button('case 4'){self.clipboard = p4.text.equal?('') ? '' : p4.text } #=> crash
+ end
+
+**sample65.png**
+
+![sample65.png](http://github.com/ashbb/shoes_tutorial_html/raw/master/images/sample65.png)
+
View
@@ -0,0 +1,11 @@
+# sample65.rb
+Shoes.app :width => 400, :height => 50 do
+ p1 = para
+ p2 = para
+ p3 = para
+ p4 = para
+ button('case 1'){self.clipboard = p1.text} #=> crash
+ button('case 2'){self.clipboard = p2.text.eql?('') ? '' : p2.text } #=> not crash
+ button('case 3'){self.clipboard = p3.text.eql?('') ? p3.text : p3.text } #=> crash
+ button('case 4'){self.clipboard = p4.text.equal?('') ? '' : p4.text } #=> crash
+end
@@ -2,7 +2,7 @@ Shoes Tutorial Note
===================
**- For the Shoes App Rookie Creators -**
-Feb. 6th, 2009 by ashbb (Satoshi Asakawa)
+Feb. 8th, 2009 by ashbb (Satoshi Asakawa)
Table of contents
-----------------

0 comments on commit 57562ac

Please sign in to comment.