nobody at rubyforge.org
2006-Nov-23 07:23 UTC
[Wxruby-development] [754] trunk/wxruby2/samples/bigdemo: Rubified samples and added in missing client data sample code
<!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>[754] trunk/wxruby2/samples/bigdemo: Rubified samples and added in missing client data sample code</title> </head> <body> <div id="msg"> <dl> <dt>Revision</dt> <dd>754</dd> <dt>Author</dt> <dd>roys</dd> <dt>Date</dt> <dd>2006-11-23 02:23:55 -0500 (Thu, 23 Nov 2006)</dd> </dl> <h3>Log Message</h3> <pre>Rubified samples and added in missing client data sample code</pre> <h3>Modified Paths</h3> <ul> <li><a href="#trunkwxruby2samplesbigdemowxComboBoxrbw">trunk/wxruby2/samples/bigdemo/wxComboBox.rbw</a></li> <li><a href="#trunkwxruby2samplesbigdemowxListBoxrbw">trunk/wxruby2/samples/bigdemo/wxListBox.rbw</a></li> </ul> </div> <div id="patch"> <h3>Diff</h3> <a id="trunkwxruby2samplesbigdemowxComboBoxrbw"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/samples/bigdemo/wxComboBox.rbw (753 => 754)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/samples/bigdemo/wxComboBox.rbw        2006-11-23 07:22:28 UTC (rev 753) +++ trunk/wxruby2/samples/bigdemo/wxComboBox.rbw        2006-11-23 07:23:55 UTC (rev 754) </span><span class="lines">@@ -24,9 +24,9 @@ </span><span class="cx"> cb = Wx::ComboBox.new(self, 500, "default value", Wx::Point.new(90,50), Wx::DEFAULT_SIZE, </span><span class="cx"> sampleList, Wx::CB_DROPDOWN) </span><span class="cx"> </span><del>- evt_combobox(cb.get_id()) {|event| on_combobox(event)} - evt_text(cb.get_id()) {|event| on_evt_text(event)} - evt_text_enter(cb.get_id()) {|event| on_evt_text_enter(event)} </del><ins>+ evt_combobox(cb.get_id) {|event| on_combobox(event)} + evt_text(cb.get_id) {|event| on_evt_text(event)} + evt_text_enter(cb.get_id) {|event| on_evt_text_enter(event)} </ins><span class="cx"> cb.evt_set_focus {|event| on_set_focus(event)} </span><span class="cx"> cb.evt_kill_focus {|event| on_kill_focus(event)} </span><span class="cx"> </span><span class="lines">@@ -36,25 +36,27 @@ </span><span class="cx"> end </span><span class="cx"> </span><span class="cx"> def on_combobox(event) </span><del>- @log.write_text("evt_combobox: " + event.get_string()) </del><ins>+ cb = event.get_event_object + data = cb.get_client_data(event.get_selection) + @log.write_text("evt_combobox: #{event.get_string}\nClient Data: #{data}") </ins><span class="cx"> end </span><span class="cx"> </span><span class="cx"> def on_evt_text(event) </span><del>- @log.write_text("evt_text: " + event.get_string()) </del><ins>+ @log.write_text("evt_text: " + event.get_string) </ins><span class="cx"> end </span><span class="cx"> </span><span class="cx"> def on_evt_text_enter(event) </span><del>- @log.write_text("evt_text_enter: " + event.get_string()) </del><ins>+ @log.write_text("evt_text_enter: " + event.get_string) </ins><span class="cx"> end </span><span class="cx"> </span><span class="cx"> def on_set_focus(evt) </span><span class="cx"> @log.write_text("OnSetFocus") </span><del>- evt.skip() </del><ins>+ evt.skip </ins><span class="cx"> end </span><span class="cx"> </span><span class="cx"> def on_kill_focus(evt) </span><span class="cx"> @log.write_text("OnKillFocus") </span><del>- evt.skip() </del><ins>+ evt.skip </ins><span class="cx"> end </span><span class="cx"> end </span><span class="cx"> </span></span></pre></div> <a id="trunkwxruby2samplesbigdemowxListBoxrbw"></a> <div class="modfile"><h4>Modified: trunk/wxruby2/samples/bigdemo/wxListBox.rbw (753 => 754)</h4> <pre class="diff"><span> <span class="info">--- trunk/wxruby2/samples/bigdemo/wxListBox.rbw        2006-11-23 07:22:28 UTC (rev 753) +++ trunk/wxruby2/samples/bigdemo/wxListBox.rbw        2006-11-23 07:23:55 UTC (rev 754) </span><span class="lines">@@ -20,12 +20,12 @@ </span><span class="cx"> end </span><span class="cx"> </span><span class="cx"> def find_prefix(prefix) </span><del>- @log.write_text("Looking for prefix: " + prefix.to_s()) </del><ins>+ @log.write_text("Looking for prefix: " + prefix.to_s) </ins><span class="cx"> if prefix </span><del>- prefix.downcase!() - length = prefix.length() - 0.upto(get_count()) do |x| - text = get_string(x).to_s().downcase() </del><ins>+ prefix.downcase! + length = prefix.length + 0.upto(get_count) do |x| + text = get_string(x).to_s.downcase </ins><span class="cx"> if text[0,length] == prefix </span><span class="cx"> @log.write_text("Prefix " + prefix + " is found.") </span><span class="cx"> return x </span><span class="lines">@@ -37,9 +37,9 @@ </span><span class="cx"> end </span><span class="cx"> </span><span class="cx"> def on_key(event) </span><del>- key = event.get_key_code() </del><ins>+ key = event.get_key_code </ins><span class="cx"> if key >= 32 and key <= 127 </span><del>- @typedText += key.chr() </del><ins>+ @typedText += key.chr </ins><span class="cx"> item = find_prefix(@typedText) </span><span class="cx"> if item != -1 </span><span class="cx"> set_selection(item) </span><span class="lines">@@ -57,7 +57,7 @@ </span><span class="cx"> </span><span class="cx"> else </span><span class="cx"> @typedText = "" </span><del>- event.skip() </del><ins>+ event.skip </ins><span class="cx"> end </span><span class="cx"> end </span><span class="cx"> </span><span class="lines">@@ -78,44 +78,43 @@ </span><span class="cx"> </span><span class="cx"> Wx::StaticText.new(self, -1, "Select one:", Wx::Point.new(15,50), Wx::Size.new(65,18)) </span><span class="cx"> @lb1 = Wx::ListBox.new(self, 60, Wx::Point.new(80,50), Wx::Size.new(80,120), sampleList, Wx::LB_SINGLE) </span><del>- evt_listbox(@lb1.get_id()) {|event| on_evt_listbox(event)} - evt_listbox_dclick(@lb1.get_id()) {|event| on_evt_listbox_dclick(event)} </del><ins>+ evt_listbox(@lb1.get_id) {|event| on_evt_listbox(event)} + evt_listbox_dclick(@lb1.get_id) {|event| on_evt_listbox_dclick(event)} </ins><span class="cx"> @lb1.set_selection(3) </span><del>- @lb1.append("with data")#, "This one has data") - # set_client_data() not supported in wxRuby 0.4 - # @lb1.set_client_data(2, "This one has data") </del><ins>+ @lb1.append("with data", "This one has data") + @lb1.set_client_data(2, "This one has data") </ins><span class="cx"> </span><span class="cx"> Wx::StaticText.new(self, -1, "Select many:", Wx::Point.new(200,50), Wx::Size.new(65,18)) </span><span class="cx"> @lb2 = Wx::ListBox.new(self, 70, Wx::Point.new(280,50), Wx::Size.new(80,120), sampleList, Wx::LB_EXTENDED) </span><del>- evt_listbox(@lb2.get_id()) {|event| on_evt_multi_listbox(event)} </del><ins>+ evt_listbox(@lb2.get_id) {|event| on_evt_multi_listbox(event)} </ins><span class="cx"> @lb2.evt_right_up {|event| on_evt_right_button(event)} </span><span class="cx"> @lb2.set_selection(0) </span><span class="cx"> </span><span class="cx"> sampleList += ["test a", "test aa", "test aab", "test ab", "test abc", "test abcc", "test abcd"] </span><del>- sampleList.sort!() </del><ins>+ sampleList.sort! </ins><span class="cx"> Wx::StaticText.new(self, -1, "Find typed prefix:", Wx::Point.new(15,250)) </span><span class="cx"> fp = FindPrefixListBox.new(self, -1, Wx::Point.new(110,250), Wx::Size.new(80,120), sampleList, Wx::LB_SINGLE) </span><span class="cx"> fp.set_selection(0) </span><span class="cx"> end </span><span class="cx"> </span><span class="cx"> def on_evt_listbox(event) </span><del>- @log.write_text("evt_listbox: " + event.get_string() + " " + event.get_selection().to_s()) </del><ins>+ @log.write_text("evt_listbox: #{event.get_string}, #{event.is_selection}, #{event.get_selection}, #{event.get_client_data}") </ins><span class="cx"> end </span><span class="cx"> </span><span class="cx"> def on_evt_listbox_dclick(event) </span><del>- @log.write_text("evt_listbox_dclick: " + @lb1.get_selection().to_s()) - @lb1.delete(@lb1.get_selection()) </del><ins>+ @log.write_text("evt_listbox_dclick: " + @lb1.get_selection.to_s) + @lb1.delete(@lb1.get_selection) </ins><span class="cx"> end </span><span class="cx"> </span><span class="cx"> def on_evt_multi_listbox(event) </span><del>- @log.write_text("evt_multi_listbox: (" + @lb2.get_selections().to_s() + ")") </del><ins>+ @log.write_text("evt_multi_listbox: (" + @lb2.get_selections.to_s + ")") </ins><span class="cx"> end </span><span class="cx"> </span><span class="cx"> def on_evt_right_button(event) </span><del>- @log.write_text("evt_right_button: " + event.get_position().to_s()) - if event.get_event_object().get_id() == 70 - selections = @lb2.get_selections() - selections.reverse!() </del><ins>+ @log.write_text("evt_right_button: " + event.get_position.to_s) + if event.get_event_object.get_id == 70 + selections = @lb2.get_selections + selections.reverse! </ins><span class="cx"> selections.each do |index| </span><span class="cx"> @lb2.delete(index) </span><span class="cx"> end </span></span></pre> </div> </div> </body> </html>
Seemingly Similar Threads
- [752] trunk/wxruby2: Fix for Bug #6810: ListBox#get_selections should return an array of selections
- [757] trunk/wxruby2/samples/bigdemo/wxListBox.rbw: Made presentation of results of ListBox.get_selections clearer
- Fwd: HA cluster - strange communication between nodes
- Loop question
- heartbeat configuration for lb