nobody at rubyforge.org
2007-Jan-05 23:22 UTC
[Wxruby-development] [832] trunk/wxruby2/samples: Fix samples for TreeItemIds as integers, fix image size in treectrl sample
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!-- #msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; } #msg dt { float: left; width: 6em; font-weight: bold; } #msg dt:after { content:'':'';} #msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; } #msg dl a { font-weight: bold} #msg dl a:link { color:#fc3; } #msg dl a:active { color:#ff0; } #msg dl a:visited { color:#cc6; } h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; } #msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; } #msg ul, pre { overflow: auto; } #header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; } #patch { width: 100%; } #patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;} #patch .propset h4, #patch .binary h4 {margin:0;} #patch pre {padding:0;line-height:1.2em;margin:0;} #patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;} #patch .propset .diff, #patch .binary .diff {padding:10px 0;} #patch span {display:block;padding:0 10px;} #patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;} #patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;} #patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;} #patch .lines, .info {color:#888;background:#fff;} --></style> <title>[832] trunk/wxruby2/samples: Fix samples for TreeItemIds as integers, fix image size in treectrl sample</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>832</dd> <dt>Author</dt> <dd>brokentoy</dd> <dt>Date</dt> <dd>2007-01-05 18:22:38 -0500 (Fri, 05 Jan 2007)</dd> </dl> <h3>Log Message</h3> <pre>Fix samples for TreeItemIds as integers, fix image size in treectrl sample</pre> <h3>Modified Paths</h3> <ul> <li><a href="#trunkwxruby2samplesbigdemobigdemorb">trunk/wxruby2/samples/bigdemo/bigdemo.rb</a></li> <li><a href="#trunkwxruby2samplesbigdemowxTreeCtrlrbw">trunk/wxruby2/samples/bigdemo/wxTreeCtrl.rbw</a></li> <li><a href="#trunkwxruby2samplestreectrltreectrlrb">trunk/wxruby2/samples/treectrl/treectrl.rb</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="trunkwxruby2samplesbigdemobigdemorb"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/samples/bigdemo/bigdemo.rb (831 => 832)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/samples/bigdemo/bigdemo.rb        2007-01-05 23:19:57 UTC (rev 831) +++ trunk/wxruby2/samples/bigdemo/bigdemo.rb        2007-01-05 23:22:38 UTC (rev 832) </span><span class="lines">@@ -393,7 +393,7 @@ </span><span class="cx"> </span><span class="cx"> def on_tree_sel_changed(event) </span><span class="cx"> item = event.get_item() </span><del>- if item.is_ok </del><ins>+ if item.nonzero? </ins><span class="cx"> itemText = @tree.get_item_text(item) </span><span class="cx"> run_demo(itemText) </span><span class="cx"> end </span></span></pre></div> <a id="trunkwxruby2samplesbigdemowxTreeCtrlrbw"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/samples/bigdemo/wxTreeCtrl.rbw (831 => 832)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/samples/bigdemo/wxTreeCtrl.rbw        2007-01-05 23:19:57 UTC (rev 831) +++ trunk/wxruby2/samples/bigdemo/wxTreeCtrl.rbw        2007-01-05 23:22:38 UTC (rev 832) </span><span class="lines">@@ -158,7 +158,7 @@ </span><span class="cx"> </span><span class="cx"> def on_sel_changed(event) </span><span class="cx"> @item = event.get_item() </span><del>- if @item.is_ok </del><ins>+ if @item.nonzero? </ins><span class="cx"> @log.write_text("on_sel_changed: " + @tree.get_item_text(@item)) </span><span class="cx"> # if Wx::PLATFORM == "WXMSW" </span><span class="cx"> #@log.write_text("BoundingRect: " + @tree.get_bounding_rect(@item)) </span></span></pre></div> <a id="trunkwxruby2samplestreectrltreectrlrb"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/samples/treectrl/treectrl.rb (831 => 832)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/samples/treectrl/treectrl.rb        2007-01-05 23:19:57 UTC (rev 831) +++ trunk/wxruby2/samples/treectrl/treectrl.rb        2007-01-05 23:22:38 UTC (rev 832) </span><span class="lines">@@ -138,7 +138,7 @@ </span><span class="cx"> @imageSize = 16 </span><span class="cx"> </span><span class="cx"> # Make an image list containing small icons </span><del>- images = Wx::ImageList.new(16, 16, true) </del><ins>+ images = Wx::ImageList.new(32, 32, true) </ins><span class="cx"> # should correspond to TreeCtrlIcon_xxx enum </span><span class="cx"> Wx::BusyCursor.busy do </span><span class="cx"> icons = (1 .. 5).map do | i | </span><span class="lines">@@ -157,7 +157,7 @@ </span><span class="cx"> </span><span class="cx"> def create_buttons_image_list() </span><span class="cx"> # Make an image list containing small icons </span><del>- images = Wx::ImageList.new(size, size, true) </del><ins>+ images = Wx::ImageList.new(16, 16, true) </ins><span class="cx"> </span><span class="cx"> # should correspond to TreeCtrlIcon_xxx enum </span><span class="cx"> Wx::BusyCursor.busy do |x| </span><span class="lines">@@ -262,7 +262,7 @@ </span><span class="cx"> else </span><span class="cx"> id, cookie = get_next_child(parent_id, cookie) </span><span class="cx"> end </span><del>- if not id.is_ok </del><ins>+ if not id.nonzero? </ins><span class="cx"> return nil </span><span class="cx"> end </span><span class="cx"> </span><span class="lines">@@ -578,12 +578,12 @@ </span><span class="cx"> dest_item = event.get_item() </span><span class="cx"> @dragged_item = 0 </span><span class="cx"> </span><del>- if dest_item.is_ok && ! item_has_children(dest_item) </del><ins>+ if dest_item.nonzero? && ! item_has_children(dest_item) </ins><span class="cx"> # copy to the parent then </span><span class="cx"> dest_item = get_item_parent(dest_item) </span><span class="cx"> end </span><span class="cx"> </span><del>- unless dest_item.is_ok() </del><ins>+ unless dest_item.nonzero?() </ins><span class="cx"> Wx::log_message("OnEndDrag: can''t drop here.") </span><span class="cx"> return nil </span><span class="cx"> end </span><span class="lines">@@ -662,7 +662,7 @@ </span><span class="cx"> </span><span class="cx"> def show_popup_menu(id, pos) </span><span class="cx"> title = "" </span><del>- if id.is_ok </del><ins>+ if id.nonzero? </ins><span class="cx"> title << "Menu for " << get_item_text(id) </span><span class="cx"> else </span><span class="cx"> title = "Menu for no particular item" </span><span class="lines">@@ -973,7 +973,7 @@ </span><span class="cx"> end </span><span class="cx"> </span><span class="cx"> def check_item(item) </span><del>- unless item.is_ok </del><ins>+ unless item.nonzero? </ins><span class="cx"> message_box("Please select some item first!", </span><span class="cx"> "Tree sample error", </span><span class="cx"> Wx::OK|Wx::ICON_EXCLAMATION, self) </span><span class="lines">@@ -1028,7 +1028,7 @@ </span><span class="cx"> def on_dump_selected(event) </span><span class="cx"> if ( @treectrl.get_window_style & Wx::TR_MULTIPLE ) == 0 </span><span class="cx"> item_id = @treectrl.get_selection </span><del>- if item_id.is_ok </del><ins>+ if item_id.nonzero? </ins><span class="cx"> Wx::log_message("<TreeItem ''%s''>", </span><span class="cx"> @treectrl.get_item_text(item_id)) </span><span class="cx"> else </span></span></pre> </div> </div> </body> </html>
Apparently Analagous Threads
- TreeCtrl update
- [842] trunk/wxsugar/lib/wx_sugar/wx_classes/treectrl.rb: Fix for TreeItemIds as Integers
- [793] trunk/wxsugar/lib/wx_sugar/wx_classes/treectrl.rb: Moved traverse method in wxSugar
- [940] trunk/wxsugar/lib/wx_sugar/wx_classes/treectrl.rb: Align #traverse usage with #each in enumerable_controls.rb
- [1009] trunk/wxruby2/samples/treectrl/treectrl.rb: ok method name changed to is_ok