From lists at ruby-forum.com Tue Apr 1 01:36:42 2008 From: lists at ruby-forum.com (Stone Piano) Date: Tue, 1 Apr 2008 07:36:42 +0200 Subject: [wxruby-users] wxRIDE Finally Available In-Reply-To: References: Message-ID: <7ee8e91bad9b70c4d331395d2ff4e05b@ruby-forum.com> Well done on getting this project out. I like ruby (though I'm new), and I like wxWidgets, so I'm keen on getting this running. I have ubuntu Linux running. I checked out the code with: root at opal:/home/rhys/wxride# svn checkout svn://rubyforge.org/var/svn/wxride/trunk Then I cd into the trunk directory. Then try to run the program but get this error: root at opal:/home/stone/wxride# cd trunk/ root at opal:/home/stone/wxride/trunk# ruby wxRIDE.rb ./lib/ui/AboutDialog.rb:13: uninitialized constant WxRide::AboutDialog::RUBY_PATCHLEVEL (NameError) from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require' from wxRIDE.rb:94 root at opal:/home/stone/wxride/trunk# Is any kind and wise soul able to tell me how to resolve this? Many thanks, StonePiano -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Tue Apr 1 04:24:25 2008 From: mario at ruby-im.net (Mario Steele) Date: Tue, 1 Apr 2008 03:24:25 -0500 Subject: [wxruby-users] wxRIDE Finally Available In-Reply-To: <7ee8e91bad9b70c4d331395d2ff4e05b@ruby-forum.com> References: <7ee8e91bad9b70c4d331395d2ff4e05b@ruby-forum.com> Message-ID: Hey Stone, Thanks for the kind interest and support for wxRIDE. wxRIDE now has a User and Development list, and I'd prefer to keep chatter about wxRIDE limited to it's own list. Just so you know, you can subcribe to them. As for your problem, the error is coming from the fact that your Ruby doesn't set RUBY_PATCHLEVEL for some reason, when it should be. If you don't mind me asking, what version of Ruby are you running? You can find out by typing in ruby --version on a command line, and it'll tell ya. If you could though, please reply to this email on wxride-users at rubyforge.org. Thanks, On Tue, Apr 1, 2008 at 12:36 AM, Stone Piano wrote: > Well done on getting this project out. I like ruby (though I'm > new), and I like wxWidgets, so I'm keen on getting this running. > > I have ubuntu Linux running. I checked out the code with: > root at opal:/home/rhys/wxride# svn checkout > svn://rubyforge.org/var/svn/wxride/trunk > > Then I cd into the trunk directory. > Then try to run the program but get this error: > > root at opal:/home/stone/wxride# cd trunk/ > root at opal:/home/stone/wxride/trunk# ruby wxRIDE.rb > ./lib/ui/AboutDialog.rb:13: uninitialized constant > WxRide::AboutDialog::RUBY_PATCHLEVEL (NameError) > from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in > `gem_original_require' > from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in > `require' > from wxRIDE.rb:94 > root at opal:/home/stone/wxride/trunk# > > > Is any kind and wise soul able to tell me how to resolve this? > > Many thanks, > StonePiano > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ http://rubyforge.org/projects/vwmc/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080401/47bd75ba/attachment-0001.html From lists at ruby-forum.com Mon Apr 7 18:12:51 2008 From: lists at ruby-forum.com (Paul w Florczykowski) Date: Tue, 8 Apr 2008 00:12:51 +0200 Subject: [wxruby-users] Some problems with Wx::Grid Message-ID: <68adf8c45d1a7f50fbf1a74d6fb1e4f2@ruby-forum.com> Recently I have been writing an app making some use of the Grid control, and I have experienced some problems with it. After playing around with the grid for a while I sometimes succeed to make the cells appear outside of the window, as if the actual grid would be placed in the top left corner of the screen, while it actually is in rather small window in the center of th screen. I attach a screenshot for better clarity. The occurance of the error is always accompanied by changing of the cell "marker"/cursor from beeing thick black rectangle to beeing thin grey rectangle, and can be provoked by inputing random data in the grid and scrolling fast to the right by pressing down the left arrow key, and repeting that couple of times. Im using Ruby 1.8.6 and WxRuby 1.9.5. I know it may be hard to tell but if anyone sees any errors in my code I'd be gratefull for pointing them out. Here is how the grid is made: class ImageGrid < Grid def initialize(parent, image) @rows = 100; @cols = 100 @img = image super(parent, -1) self.create_grid(@rows, at cols) set_default_cell_alignment(ALIGN_CENTRE, ALIGN_CENTRE) # this event will actually come when text is entered in 1 cell evt_grid_range_select() do |e| # deselection gives whole table... top_row = e.get_top_row left_col = e.get_left_col bottom_row = e.get_bottom_row right_col = e.get_right_col # after cursor has left the cell... could be because of edit cur_row = get_grid_cursor_row cur_col = get_grid_cursor_col # input, not range selection if top_row == 0 and left_col == 0 and bottom_row == @rows-1 and right_col == @cols-1 # ... # range selection, not input else # ... end end # ...grid range select event end # ...initialize end # ...class ImageGrid Best regards, Paul W Florczykowski Attachments: http://www.ruby-forum.com/attachment/1695/GridShot.JPG -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Wed Apr 9 21:56:37 2008 From: lists at ruby-forum.com (Nilu Senevi) Date: Thu, 10 Apr 2008 03:56:37 +0200 Subject: [wxruby-users] Detaching Controls Message-ID: <1ecf6fd358feca41db8d5741d741bee0@ruby-forum.com> Hi, Does anyone know how to detach controls from a panel or frame? What I want to do is click a button and redraw a new UI without the button. Is there any possible was to do this? Thank you for any help in advance. :D -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Wed Apr 9 22:06:48 2008 From: alex at pressure.to (Alex Fenton) Date: Thu, 10 Apr 2008 03:06:48 +0100 Subject: [wxruby-users] Detaching Controls In-Reply-To: <1ecf6fd358feca41db8d5741d741bee0@ruby-forum.com> References: <1ecf6fd358feca41db8d5741d741bee0@ruby-forum.com> Message-ID: <47FD7638.3090508@pressure.to> Nilu Senevi wrote: > Does anyone know how to detach controls from a panel or frame? What I > want to do is click a button and redraw a new UI without the button. If your layout is controlled by sizers, use Sizer#remove or Sizer#detach, then call destroy on the removed Window. You may need to call Sizer#layout afterwards to adjust to the new window contents. If not, just call Window#destroy. It's one of the rare occasions that calling this directly is useful. http://wxruby.rubyforge.org/doc/window.html#Window_destroy http://wxruby.rubyforge.org/doc/sizer.html#Sizer_remove alex From mario at ruby-im.net Thu Apr 10 01:37:54 2008 From: mario at ruby-im.net (Mario Steele) Date: Thu, 10 Apr 2008 00:37:54 -0500 Subject: [wxruby-users] Detaching Controls In-Reply-To: <47FD7638.3090508@pressure.to> References: <1ecf6fd358feca41db8d5741d741bee0@ruby-forum.com> <47FD7638.3090508@pressure.to> Message-ID: Another way, if your planning to re-use the control, is to call hide()/show(false) on the button, then call layout() on the window, to re-draw the controls. Hide will make it invisible, so that it's no longer there. An example: begin require 'rubygems' rescue LoadError end require 'wx' class MyFrame < Wx::Frame include Wx def initialize(*args) super @button1 = Button.new(self,1000,"Hide Me!") @button2 = Button.new(self,1001,"Show other button") hbox = BoxSizer.new(HORIZONTAL) hbox.add(@button1,1,ALL) hbox.add(@button2,1,ALL) set_sizer(hbox) evt_button(1000) do @button1.show(false) layout() end evt_button(1001) do @button1.show(true) layout() end end end Wx::App.run do MyFrame.new(nil,:title=>"Button Hiding Example",:size=>[200,60]).show() end L8ers, On Wed, Apr 9, 2008 at 9:06 PM, Alex Fenton wrote: > Nilu Senevi wrote: > > Does anyone know how to detach controls from a panel or frame? What I > > want to do is click a button and redraw a new UI without the button. > If your layout is controlled by sizers, use Sizer#remove or > Sizer#detach, then call destroy on the removed Window. You may need to > call Sizer#layout afterwards to adjust to the new window contents. > > If not, just call Window#destroy. It's one of the rare occasions that > calling this directly is useful. > > http://wxruby.rubyforge.org/doc/window.html#Window_destroy > http://wxruby.rubyforge.org/doc/sizer.html#Sizer_remove > > alex > > > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ http://rubyforge.org/projects/vwmc/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080410/5adc476a/attachment.html From lists at ruby-forum.com Thu Apr 10 04:59:24 2008 From: lists at ruby-forum.com (Nilu Senevi) Date: Thu, 10 Apr 2008 10:59:24 +0200 Subject: [wxruby-users] Detaching Controls In-Reply-To: References: <1ecf6fd358feca41db8d5741d741bee0@ruby-forum.com> <47FD7638.3090508@pressure.to> Message-ID: Thank you Mario for the quick reply. I will try it out:D -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Apr 10 05:01:52 2008 From: lists at ruby-forum.com (Nilu Senevi) Date: Thu, 10 Apr 2008 11:01:52 +0200 Subject: [wxruby-users] Detaching Controls In-Reply-To: <47FD7638.3090508@pressure.to> References: <1ecf6fd358feca41db8d5741d741bee0@ruby-forum.com> <47FD7638.3090508@pressure.to> Message-ID: <468d4e3f5cf3c9cb950a99e0a374ba0f@ruby-forum.com> Thanks Alex. I will try it out :D -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sun Apr 13 22:32:49 2008 From: lists at ruby-forum.com (Daniel Washburn) Date: Mon, 14 Apr 2008 04:32:49 +0200 Subject: [wxruby-users] Problem with runtime error/segfault Message-ID: <3fd5ef906acc270be8b876d961094ca8@ruby-forum.com> Set all the alarms to something, it doesn't matter what except sometime in the future and out of the way except for #1. Set the first alarm on, to maybe 2 minutes from the time you run the program. Every time I run it I get a segfault or a runtime error. What's wrong? # Only works if turned on before it goes off on the the day that it will $statusChoice = ["On", "Off"] $hourChoice = ["00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23"] $minChoice = ["00", "15", "30", "45"] $secChoice = ["00", "15", "30", "45"] require "Wx" include Wx require 'on-off.rb' require 'Sets1.rb' class SetsFrame < Frame def initialize() super(nil, -1, 'Settings') choices = ['Alarm # 1', 'Alarm # 2', 'Alarm # 3', 'Alarm # 4'] @setsPanel = Panel.new(self) $whichAlarm = ComboBox.new(@setsPanel, -1, 'Alarm # 1', DEFAULT_POSITION, DEFAULT_SIZE, choices, CB_READONLY) @editButton = Button.new(@setsPanel, -1, 'Edit') evt_button(@editButton.get_id()) {|event|editButtonClick(event)} @setsPanelSizer = BoxSizer.new(VERTICAL) @setsPanel.set_sizer(@setsPanelSizer) @setsPanel.sizer.add($whichAlarm, 0, GROW|ALL, 2) @setsPanel.sizer.add(@editButton, 0, GROW|ALL, 2) show() end def editButtonClick(event) $whichAlarmVal = $whichAlarm.get_value() if $whichAlarmVal == 'Alarm # 1' require 'Sets1.rb' elsif $whichAlarmVal == 'Alarm # 2' require 'Sets2.rb' elsif $whichAlarmVal == 'Alarm # 3' require 'Sets3.rb' elsif $whichAlarmVal == 'Alarm # 4' require 'Sets4.rb' else # Nothings end EditFrame.new end end class EditFrame < Frame def initialize() super(nil, -1, 'Edit') @aPanel = Panel.new(self) @someText = StaticText.new(@aPanel, -1, "Edit", DEFAULT_POSITION, DEFAULT_SIZE, ALIGN_CENTER) @comboStatus = ComboBox.new(@aPanel, -1, $statusDef, DEFAULT_POSITION, DEFAULT_SIZE, $statusChoice, CB_READONLY) @hourText = StaticText.new(@aPanel, -1, "Hours") @comboHour = ComboBox.new(@aPanel, -1, $hourDef, DEFAULT_POSITION, DEFAULT_SIZE, $hourChoice, CB_DROPDOWN) @minText = StaticText.new(@aPanel, -1, "Minutes") @comboMin = ComboBox.new(@aPanel, -1, $minDef, DEFAULT_POSITION, DEFAULT_SIZE, $minChoice, CB_DROPDOWN) @secText = StaticText.new(@aPanel, -1, "Seconds") @comboSec = ComboBox.new(@aPanel, -1, $secDef, DEFAULT_POSITION, DEFAULT_SIZE, $secChoice, CB_DROPDOWN) @textAlarm = StaticText.new(@aPanel, -1, "Alarm Text") @alarmText = TextCtrl.new(@aPanel, -1, $textDef, DEFAULT_POSITION, DEFAULT_SIZE, TE_MULTILINE) @dayText = StaticText.new(@aPanel, -1, "Days") @checkSun = CheckBox.new(@aPanel, -1, "Sunday") @checkMon = CheckBox.new(@aPanel, -1, "Monday") @checkTue = CheckBox.new(@aPanel, -1, "Tuesday") @checkWed = CheckBox.new(@aPanel, -1, "Wednesday") @checkThu = CheckBox.new(@aPanel, -1, "Thursday") @checkFri = CheckBox.new(@aPanel, -1, "Friday") @checkSat = CheckBox.new(@aPanel, -1, "Saturday") @saveButton = Button.new(@aPanel, -1, 'Save') @defButton = Button.new(@aPanel, -1, 'Return to Defaults') evt_button(@saveButton.get_id()) {|event|saveButtonClick(event)} evt_button(@defButton.get_id()) {|event|defButtonClick(event)} @aPanelSizer = BoxSizer.new(VERTICAL) @aPanel.set_sizer(@aPanelSizer) @aPanel.sizer.add(@someText, 0, GROW|ALL, 2) @aPanel.sizer.add(@comboStatus, 0, GROW|ALL, 2) @aPanel.sizer.add(@hourText, 0, GROW|ALL, 2) @aPanel.sizer.add(@comboHour, 0, GROW|ALL, 2) @aPanel.sizer.add(@minText, 0, GROW|ALL, 2) @aPanel.sizer.add(@comboMin, 0, GROW|ALL, 2) @aPanel.sizer.add(@secText, 0, GROW|ALL, 2) @aPanel.sizer.add(@comboSec, 0, GROW|ALL, 2) @aPanel.sizer.add(@textAlarm, 0, GROW|ALL, 2) @aPanel.sizer.add(@alarmText, 0, GROW|ALL, 2) @aPanel.sizer.add(@dayText, 0, GROW|ALL, 2) @aPanel.sizer.add(@checkSun, 0, GROW|ALL, 2) @aPanel.sizer.add(@checkMon, 0, GROW|ALL, 2) @aPanel.sizer.add(@checkTue, 0, GROW|ALL, 2) @aPanel.sizer.add(@checkWed, 0, GROW|ALL, 2) @aPanel.sizer.add(@checkThu, 0, GROW|ALL, 2) @aPanel.sizer.add(@checkFri, 0, GROW|ALL, 2) @aPanel.sizer.add(@checkSat, 0, GROW|ALL, 2) @aPanel.sizer.add(@saveButton, 0, GROW|ALL, 2) @aPanel.sizer.add(@defButton, 0, GROW|ALL, 2) @checkSun.set_value($sun) @checkMon.set_value($mon) @checkTue.set_value($tue) @checkWed.set_value($wed) @checkThu.set_value($thu) @checkFri.set_value($fri) @checkSat.set_value($sat) show() end def sets1 File.open('Sets1.rb', 'w') do |f| f.puts "$statusDef = \"#{$comboStatusVal}\" $hourDef = \"#{$comboHourVal}\" $minDef = \"#{$comboMinVal}\" $secDef = \"#{$comboSecVal}\" $textDef = \"#{$alarmTextVal}\" $sun = #{$checkSunVal} $mon = #{$checkMonVal} $tue = #{$checkTueVal} $wed = #{$checkWedVal} $thu = #{$checkThuVal} $fri = #{$checkFriVal} $sat = #{$checkSatVal}" end end def sets2 File.open('Sets2.rb', 'w') do |f| f.puts "$statusDef = \"#{$comboStatusVal}\" $hourDef = \"#{$comboHourVal}\" $minDef = \"#{$comboMinVal}\" $secDef = \"#{$comboSecVal}\" $textDef = \"#{$alarmTextVal}\" $sun = #{$checkSunVal} $mon = #{$checkMonVal} $tue = #{$checkTueVal} $wed = #{$checkWedVal} $thu = #{$checkThuVal} $fri = #{$checkFriVal} $sat = #{$checkSatVal}" end end def sets3 File.open('Sets3.rb', 'w') do |f| f.puts "$statusDef = \"#{$comboStatusVal}\" $hourDef = \"#{$comboHourVal}\" $minDef = \"#{$comboMinVal}\" $secDef = \"#{$comboSecVal}\" $textDef = \"#{$alarmTextVal}\" $sun = #{$checkSunVal} $mon = #{$checkMonVal} $tue = #{$checkTueVal} $wed = #{$checkWedVal} $thu = #{$checkThuVal} $fri = #{$checkFriVal} $sat = #{$checkSatVal}" end end def sets4 File.open('Sets4.rb', 'w') do |f| f.puts "$statusDef = \"#{$comboStatusVal}\" $hourDef = \"#{$comboHourVal}\" $minDef = \"#{$comboMinVal}\" $secDef = \"#{$comboSecVal}\" $textDef = \"#{$alarmTextVal}\" $sun = #{$checkSunVal} $mon = #{$checkMonVal} $tue = #{$checkTueVal} $wed = #{$checkWedVal} $thu = #{$checkThuVal} $fri = #{$checkFriVal} $sat = #{$checkSatVal}" end end def saveButtonClick(event) $comboStatusVal = @comboStatus.get_value() $comboHourVal = @comboHour.get_value() $comboMinVal = @comboMin.get_value() $comboSecVal = @comboSec.get_value() $alarmTextVal = @alarmText.get_value() $checkSunVal = @checkSun.get_value() $checkMonVal = @checkMon.get_value() $checkTueVal = @checkTue.get_value() $checkWedVal = @checkWed.get_value() $checkThuVal = @checkThu.get_value() $checkFriVal = @checkFri.get_value() $checkSatVal = @checkSat.get_value() if $comboStatusVal == "On" $boolStatus = true elsif $comboStatusVal == "Off" $boolStatus = false else # Nothings end $whichAlarmVal = $whichAlarm.get_value() if $whichAlarmVal == 'Alarm # 1' sets1 elsif $whichAlarmVal == 'Alarm # 2' sets2 elsif $whichAlarmVal == 'Alarm # 3' sets3 elsif $whichAlarmVal == 'Alarm # 4' sets4 else # Nothing end bool1 = $onOff.fetch(0) bool2 = $onOff.fetch(1) bool3 = $onOff.fetch(2) bool4 = $onOff.fetch(3) if $whichAlarmVal == 'Alarm # 1' File.open('on-off.rb', 'w') do |f| f.puts "$onOff = [#{$boolStatus}, #{bool2}, #{bool3}, #{bool4}]" end elsif $whichAlarmVal == 'Alarm # 2' File.open('on-off.rb', 'w') do |f| f.puts "$onOff = [#{bool1}, #{$boolStatus}, #{bool3}, #{bool4}]" end elsif $whichAlarmVal == 'Alarm # 3' File.open('on-off.rb', 'w') do |f| f.puts "$onOff = [#{bool1}, #{bool2}, #{$boolStatus}, #{bool4}]" end elsif $whichAlarmVal == 'Alarm # 4' File.open('on-off.rb', 'w') do |f| f.puts "$onOff = [#{bool1}, #{bool2}, #{bool3}, #{$boolStatus}]" end else # Nothing end end def defButtonClick(event) results = [] bool1 = $onOff.fetch(0) bool2 = $onOff.fetch(1) bool3 = $onOff.fetch(2) bool4 = $onOff.fetch(3) File.open('Defaults.rb', 'r').each { |line| results << line } if $whichAlarmVal == 'Alarm # 1' File.open('Sets1.rb', 'w') do |f1| f1.puts results end elsif $whichAlarmVal == 'Alarm # 2' File.open('Sets2.rb', 'w') do |f1| f1.puts results end elsif $whichAlarmVal == 'Alarm # 3' File.open('Sets3.rb', 'w') do |f1| f1.puts results end elsif $whichAlarmVal == 'Alarm # 4' File.open('Sets4.rb', 'w') do |f1| f1.puts results end else # Nothing end if $whichAlarmVal == 'Alarm # 1' File.open('on-off.rb', 'w') do |f| f.puts "$onOff = [false, #{bool2}, #{bool3}, #{bool4}]" end elsif $whichAlarmVal == 'Alarm # 2' File.open('on-off.rb', 'w') do |f| f.puts "$onOff = [#{bool1}, false, #{bool3}, #{bool4}]" end elsif $whichAlarmVal == 'Alarm # 3' File.open('on-off.rb', 'w') do |f| f.puts "$onOff = [#{bool1}, #{bool2}, false, #{bool4}]" end elsif $whichAlarmVal == 'Alarm # 4' File.open('on-off.rb', 'w') do |f| f.puts "$onOff = [#{bool1}, #{bool2}, #{bool3}, false]" end else # Nothing end end end class AlarmFrame < Frame def initialize() super(nil, -1, 'Alarm') @aPanel = Panel.new(self) @someText = StaticText.new(@aPanel, -1, "Time's up! Go to bed!", DEFAULT_POSITION, DEFAULT_SIZE, ALIGN_CENTER) @stopButton = Button.new(@aPanel, -1, 'Ok') evt_button(@stopButton.get_id()) {|event|stopButtonClick(event)} @aPanelSizer = BoxSizer.new(VERTICAL) @aPanel.set_sizer(@aPanelSizer) @aPanel.sizer.add(@someText, 0, GROW|ALL, 2) @aPanel.sizer.add(@stopButton, 0, GROW|ALL, 2) Sound.play("beep4.wav", flags = SOUND_ASYNC|SOUND_LOOP) show() end def stopButtonClick(event) Sound.stop() end end class Alarm def initialize $bool1 = $onOff.fetch(0) $bool2 = $onOff.fetch(1) $bool3 = $onOff.fetch(2) $bool4 = $onOff.fetch(3) end def one if $bool1 == true require 'Sets1.rb' t = Time.now goOff0 = $hourDef goOff1 = $minDef goOff2 = $secDef sleepTime = (goOff0.to_i*3600+goOff1.to_i*60+goOff2.to_i)-(t.strftime("%H").to_i*3600+t.strftime("%M").to_i*60+t.strftime("%S").to_i) sleep(sleepTime) AlarmFrame.new else # Nothings end end def two if $bool2 == true require 'Sets2.rb' t = Time.now goOff0 = $hourDef goOff1 = $minDef goOff2 = $secDef sleepTime = (goOff0.to_i*3600+goOff1.to_i*60+goOff2.to_i)-(t.strftime("%H").to_i*3600+t.strftime("%M").to_i*60+t.strftime("%S").to_i) sleep(sleepTime) AlarmFrame.new else # Nothings end end def three if $bool3 == true require 'Sets3.rb' t = Time.now goOff0 = $hourDef goOff1 = $minDef goOff2 = $secDef sleepTime = (goOff0.to_i*3600+goOff1.to_i*60+goOff2.to_i)-(t.strftime("%H").to_i*3600+t.strftime("%M").to_i*60+t.strftime("%S").to_i) sleep(sleepTime) AlarmFrame.new else # Nothings end end def four if $bool4 == true require 'Sets4.rb' t = Time.now goOff0 = $hourDef goOff1 = $minDef goOff2 = $secDef sleepTime = (goOff0.to_i*3600+goOff1.to_i*60+goOff2.to_i)-(t.strftime("%H").to_i*3600+t.strftime("%M").to_i*60+t.strftime("%S").to_i) sleep(sleepTime) AlarmFrame.new else # Nothings end end end class MainApp < App def on_init SetsFrame.new end end _ = Thread.new {MainApp.new.main_loop()} a = Thread.new {Alarm.new.one} b = Thread.new {Alarm.new.two} #c = Thread.new {Alarm.new.three} #d = Thread.new {Alarm.new.four} _.join a.join b.join #c.join #d.join -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Tue Apr 15 09:46:30 2008 From: alex at pressure.to (Alex Fenton) Date: Tue, 15 Apr 2008 14:46:30 +0100 Subject: [wxruby-users] Problem with runtime error/segfault In-Reply-To: <3fd5ef906acc270be8b876d961094ca8@ruby-forum.com> References: <3fd5ef906acc270be8b876d961094ca8@ruby-forum.com> Message-ID: <4804B1B6.50109@pressure.to> Hi Daniel Thanks for the report. Unfortunately I couldn't test out your code because it requires other files that you haven't included. We ask that when posting a problem or bug, you simplify your code to demonstrate the problem rather than just copying your enitre program. http://wxruby.rubyforge.org/wiki/wiki.pl?MailingLists I have a couple of suggestions on organisation and style that may help. I think you could simplify your code quite a bit and that should help iron out the bug. My main one would be to use Wx::Timer rather than ruby Threads+sleep to count down the time until the alarms go off. The way Ruby threads are designed makes them ill-suited for many uses with GUI libraries, so don't use them unless you really have to - and here, you don't. > def editButtonClick(event) > $whichAlarmVal = $whichAlarm.get_value() > if $whichAlarmVal == 'Alarm # 1' > require 'Sets1.rb' > elsif $whichAlarmVal == 'Alarm # 2' > require 'Sets2.rb' > Here you could make your code a lot simpler by using client_data. This allows you to associate any normal ruby object (eg an Alarm object) with an item in a ComboBox. So when the user clicks the edit button, you just find the Alarm object associated with the currently selected value in the ComboBox, and start editing it. You would then be able to handle an arbitrary number of Alarms. http://wxruby.rubyforge.org/doc/controlwithitems.html > @dayText = StaticText.new(@aPanel, -1, "Days") > @checkSun = CheckBox.new(@aPanel, -1, "Sunday") > @checkMon = CheckBox.new(@aPanel, -1, "Monday") > @checkTue = CheckBox.new(@aPanel, -1, "Tuesday") A CheckListBox might be better here: http://wxruby.rubyforge.org/doc/checklistbox.html > def sets1 > File.open('Sets1.rb', 'w') do |f| > f.puts "$statusDef = \"#{$comboStatusVal}\" > $hourDef = \"#{$comboHourVal}\" > $minDef = \"#{$comboMinVal}\" There are much easier and safer ways to save an object with settings to file. Look up "Marshal" or "YAML" for ruby - these will allow you to save and load Alarms with no extra work. > class Alarm > def initialize > I would design your Alarm class to have attributes for the hour, minute and second, an array for the days of the week, and a boolean to represent whether it's on or off. attr_accessor :hour, :minute, :second, :days, :active Have a look at http://www.rubycentral.com/pickaxe/tut_classes.html hth alex From lists at ruby-forum.com Tue Apr 15 17:29:09 2008 From: lists at ruby-forum.com (Gerard Rakoczy) Date: Tue, 15 Apr 2008 23:29:09 +0200 Subject: [wxruby-users] background for textctrl Message-ID: <1e04ea0bc7062c2c6ae3dc4816a1a71a@ruby-forum.com> hi, i have a small form with some textctrl. and i was wondering how to set background of them when i write something on them. i mean, i would like to give a another than default backgound color when i set focus/write something. thanks a lot in advance, because i have seen some posts, and everyone has answered in a very gentile way. this is a thing that is missed in other parts thanks again -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Tue Apr 15 18:14:19 2008 From: alex at pressure.to (Alex Fenton) Date: Tue, 15 Apr 2008 23:14:19 +0100 Subject: [wxruby-users] background for textctrl In-Reply-To: <1e04ea0bc7062c2c6ae3dc4816a1a71a@ruby-forum.com> References: <1e04ea0bc7062c2c6ae3dc4816a1a71a@ruby-forum.com> Message-ID: <480528BB.8030602@pressure.to> Hi Gerard Rakoczy wrote: > i have a small form with some textctrl. and i was wondering how to set > background of them when i write something on them. > i mean, i would like to give a another than default backgound color when > i set focus/write something. In the constructor for your TextCtrl, maybe something like: evt_set_focus { self.background_colour = Wx::RED } evt_kill_focus { self.background_colour = Wx::WHITE } I'm not sure that on all platforms, the native TextCtrl is allowed to change the background colour. But this works fine for me on OS X. cheers alex From alex at pressure.to Wed Apr 16 04:25:16 2008 From: alex at pressure.to (Alex Fenton) Date: Wed, 16 Apr 2008 09:25:16 +0100 Subject: [wxruby-users] Different (tree) event behaviors across platforms In-Reply-To: References: <47D97C7F.7020203@pressure.to> Message-ID: <4805B7EC.3080008@pressure.to> Hi Chauk-Mean Chauk-Mean P wrote: > 2008/3/13, Alex Fenton : > >> There's a few places I've been surprised by ObjectPreviouslyDeleted >> errors where events are getting sent to destroyed objects. I wonder if >> wxRuby should try to explicitly disconnect event handlers on window >> deletion - but there's nothing in the C++ docs that suggests this. >> > > This is exactly the problem I had. In the code of selection change > event, I take and put the content of the textctrl (in the right pane) > based on the selected item. But during the close of the window, the > textctrl has been already destroyed. So I received this > ObjectPreviouslyDeleted error. > > It would be really great if wxRuby can deal with this issue. > Indeed, unlike the 2 other issues, this one makes the application crash. > I've just committed a patch (SVN:1664) to fix these ObjectPreviouslyDeleted errors sending events to destroyed Wx::Windows. It seems to fix the samples; if possible, please test SVN HEAD to see whether the problem is resolved for you. thanks alex From erubin at valcom.com Wed Apr 16 14:55:07 2008 From: erubin at valcom.com (Eric Rubin) Date: Wed, 16 Apr 2008 14:55:07 -0400 Subject: [wxruby-users] Changing the color of buttons Message-ID: <000f01c89ff3$6362d570$a50ba8c0@valcom.com> I'm having trouble changing the color of Buttons in WxRuby. I'm calling set_background_colour (and set_foreground_colour) and the calls return true, but the button remains gray. In searching the documentation it seems that the problem might be related to should_inherit_colours, which can prohibit color changes, but the documentation is confusing. (Doesn't specify whether should_inherit_colours should return true or false.) Any suggestions? Eric -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080416/ae3b8b7e/attachment.html From alex at pressure.to Wed Apr 16 19:16:46 2008 From: alex at pressure.to (Alex Fenton) Date: Thu, 17 Apr 2008 00:16:46 +0100 Subject: [wxruby-users] Changing the color of buttons In-Reply-To: <000f01c89ff3$6362d570$a50ba8c0@valcom.com> References: <000f01c89ff3$6362d570$a50ba8c0@valcom.com> Message-ID: <480688DE.8040500@pressure.to> Eric Rubin wrote: > > I?m having trouble changing the color of Buttons in WxRuby. I?m > calling set_background_colour (and set_foreground_colour) and the > calls return true, but the button remains gray. > Generally a major part of wxRuby's approach is that standard native controls like Wx::Button take the standard theme colours, depending on the user's desktop settings. You don't mention what platform you're using, but I'd expect that some desktops just won't permit non-standard colours to be used here. If you could say more about what your application's trying to do here, perhaps we could suggest a better way of desiging a UI that will achieve it whilst still looking harmonious. There are several other options eg Wx::BitmapButton. alex From alex at pressure.to Fri Apr 18 03:53:05 2008 From: alex at pressure.to (Alex Fenton) Date: Fri, 18 Apr 2008 08:53:05 +0100 Subject: [wxruby-users] alpha release of Weft QDA 2 Message-ID: <48085361.6080802@pressure.to> Hi I just put out an alpha release of Weft QDA 2, an application written in wxRuby. Weft QDA is used by sociologists, anthropologists and similar for the analysis of textual data like interviews, fieldnotes and published literature. You can read more about the release: http://rubyforge.org/pipermail/weft-qda-users/2008-April/000130.html Anyway, the specific purpose of the application won't be relevant to most people here, but there might be a few things of interest in there about coding a large-ish database-backed application in wxRuby. It uses a large number of wxRuby GUI classes, with a mixture of XRC and wxSugar coding to build the interface. DialogBlocks and xrcise were used to speed up development of the main windows. It uses a hand-written object-relational mapper with an Observer mechanism to update the GUI with changes in the database. All the core classes can be used without a GUI, and this makes the GUI event-handling code pretty simple. It's packaged up so it feels like a completely native app on Windows and OS X from installation to use. I gave up on rubyscript2exe; it's fairly convenient for a quick solution for smaller apps, but limited. So on OS X I used Platypus to create the binary, and distribute it as a .dmg file. On Windows it sets up a fully-functional ruby distribution via the NullSoft Installer System (NSIS). This give smaller downloads, and make it feel like a compiled app (with some tweaking, in the rakefiles). Anyway, if anyone's interested in knowing more on these topics, I can perhaps post a wxRuby tutorial at some point. cheers alex From alec at arlross.demon.co.uk Fri Apr 18 09:42:29 2008 From: alec at arlross.demon.co.uk (Alec Ross) Date: Fri, 18 Apr 2008 14:42:29 +0100 Subject: [wxruby-users] alpha release of Weft QDA 2 In-Reply-To: <48085361.6080802@pressure.to> References: <48085361.6080802@pressure.to> Message-ID: <4Gc824LFVKCIFwNL@arlross.demon.co.uk> In message <48085361.6080802 at pressure.to>, Alex Fenton writes >Hi > >I just put out an alpha release of Weft QDA 2, an application written in >wxRuby. ... > >Anyway, if anyone's interested in knowing more on these topics, I can >perhaps post a wxRuby tutorial at some point. > +1 Thanks. Alec -- Alec Ross From l.lap at wp.pl Fri Apr 18 12:45:46 2008 From: l.lap at wp.pl (=?iso-8859-2?B?o3VrYXN6IKNhcGnxc2tp?=) Date: Fri, 18 Apr 2008 18:45:46 +0200 Subject: [wxruby-users] wxRuby / wxWigets with C++ Message-ID: Hi, I am experimenting with integration of C++ and Ruby. What exactly I would like to do is to provide an option to use Ruby and wxRuby for creation of GUI and doing algorithms in C++ and then displaying results in the openGL Canvas. I can easily use openGl / Glut in "render" function in C++ say class VisualiseGraph, build using SWIG an extention to Ruby and then use this function (that does not take any parameters and returns void) to display on the wxGLCanvas ( @canvas.evt_paint { @canvas.paint { render } } ). But I would also like to transfer the data from the form built using Ruby into some classes in C++. Like parameters: numbers and string. But I am wondering if it is possible to create controls in Ruby and then just assign then into C++ fields (the controls not values). For example class FormInCpp { wxTextField * someText; void setSomeText(wxTextField * param){ someText = param; } } then use SWIG to build extention in module say Llap and then txt = Wx::TextCtrl.new(self, -1, "val") form = Llap::FormInCpp.new form.setSomeText(txt) I thought these are in fact the same controls, they were written in C++, but I guess txt is not of type [wxTextField *], but rather # so how to get the pointer to wxTextField so I can manipulate the control from cpp class like this someText->GetValue() and then do smthing with this value. -- Kind regards, ?ukasz ?api?ski From lists at ruby-forum.com Sat Apr 19 00:51:17 2008 From: lists at ruby-forum.com (Pat Kiatchaipipat) Date: Sat, 19 Apr 2008 06:51:17 +0200 Subject: [wxruby-users] how can I set window not resize? Message-ID: <55363288c4881e0e949d11faa6af6c3c@ruby-forum.com> I try super(nil, :title => title, :size => [700, 525]) @window = Window.new(self, -1) @window.set_background_colour(WHITE) @window.set_size(700,525) @window.resizable(false) resizable is not fuction declare. can I make it in other way? -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sat Apr 19 01:36:01 2008 From: lists at ruby-forum.com (Pat Kiatchaipipat) Date: Sat, 19 Apr 2008 07:36:01 +0200 Subject: [wxruby-users] use bitmapButton with mouseEvent? Message-ID: <61d78ff612353b31b18a66450fc1cb32@ruby-forum.com> hi. I want to make button that can change picture when mouse is entering and can click to use function. and this is my code. @button2 = BitmapButton.new(@window, -1, @picturebox1_bmp, Point.new(248,89), Size.new(53, 53)) @button2.evt_mouse_events{ |event| evtmouse2(event) } evt_button(@button2.get_id()) { |event| evtbtn2()} def evtmouse2(event) if event.entering == true @button2.set_bitmap_label(@picturebox2_bmp) end if event.leaving == true @button2.set_bitmap_label(@picturebox1_bmp) end end def evtbtn2() #mycode end It work normally when I use mouse enter the button it can change picture. but when I click on it. it can't use evtbtn2. what I doing wrong?? I try to use event.left_down to capture when mouse was clicked. It work but the button show was not pushed. how can I solve it? -- Posted via http://www.ruby-forum.com/. From bureaux.sebastien at neuf.fr Sat Apr 19 03:52:14 2008 From: bureaux.sebastien at neuf.fr (sebastien) Date: Sat, 19 Apr 2008 09:52:14 +0200 Subject: [wxruby-users] BusyCursor Message-ID: <000601c8a1f2$4fc6df10$0201a8c0@sebastien> Bonjour Alex. Quand je place "BusyCursor.busy do.....end" dans un "begin/rescue" et que j'ai une exception qui se l?ve, comment est-ce que je peut faire pour pouvoir stoper "BusyCursor" ? partir de rescue? car j'ai le "BusyCursor" qui continu son ex?cution. merci sebastien http://beusse.liveror.com/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080419/3f28612a/attachment.html From alex at pressure.to Sat Apr 19 04:45:27 2008 From: alex at pressure.to (Alex Fenton) Date: Sat, 19 Apr 2008 09:45:27 +0100 Subject: [wxruby-users] BusyCursor In-Reply-To: <000601c8a1f2$4fc6df10$0201a8c0@sebastien> References: <000601c8a1f2$4fc6df10$0201a8c0@sebastien> Message-ID: <4809B127.6070407@pressure.to> Salut sebastien wrote: > Quand je place "BusyCursor.busy do.....end" dans un "begin/rescue" et > que j'ai une exception qui se l?ve, comment est-ce que je peut faire > pour pouvoir stoper "BusyCursor" ? partir de rescue? car j'ai le > "BusyCursor" qui continu son ex?cution. [ Sebastien asked - when I use "BusyCursor.busy do .. end" within a begin/rescue clause, and an exception is raised, the BusyCursor continues - how can I can I stop it? ] J'ai rencontr? le m?me probl?me. Je l'ai r?solu avec 'ensure', comme ci-dessus: [I ran into the same problem. I resolved it with ensure, like this:] begin Wx::BusyCursor do #long code end rescue ensure a_frame.cursor = Wx::Cursor.new(Wx::CURSOR_ARROW) end Selon moi, nous devrons le d?panner dans wxRuby http://rubyforge.org/tracker/index.php?func=detail&aid=19646&group_id=35&atid=218 [In my opinion, this is something we should fix in wxRuby - bug added] alex From alex at pressure.to Sat Apr 19 05:10:06 2008 From: alex at pressure.to (Alex Fenton) Date: Sat, 19 Apr 2008 10:10:06 +0100 Subject: [wxruby-users] how can I set window not resize? In-Reply-To: <55363288c4881e0e949d11faa6af6c3c@ruby-forum.com> References: <55363288c4881e0e949d11faa6af6c3c@ruby-forum.com> Message-ID: <4809B6EE.9040007@pressure.to> Pat Kiatchaipipat wrote: > I try > > super(nil, :title => title, :size => [700, 525]) > @window = Window.new(self, -1) > @window.set_background_colour(WHITE) > @window.set_size(700,525) > @window.resizable(false) > > resizable is not fuction declare. can I make it in other way? > try super(nil, :title => title, :size => [700, 525], :style => Wx::DEFAULT_FRAME_STYLE ^ Wx::RESIZE_BORDER) alex From lists at ruby-forum.com Sat Apr 19 06:48:41 2008 From: lists at ruby-forum.com (Pat Kiatchaipipat) Date: Sat, 19 Apr 2008 12:48:41 +0200 Subject: [wxruby-users] how can I set window not resize? In-Reply-To: <4809B6EE.9040007@pressure.to> References: <55363288c4881e0e949d11faa6af6c3c@ruby-forum.com> <4809B6EE.9040007@pressure.to> Message-ID: <549b296a2d5bab8eac20f31a0f3cbdd0@ruby-forum.com> yeah it work! but in the middle of top-botton it can use show in maximize. it can't change?? -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Sat Apr 19 07:06:43 2008 From: alex at pressure.to (Alex Fenton) Date: Sat, 19 Apr 2008 12:06:43 +0100 Subject: [wxruby-users] how can I set window not resize? In-Reply-To: <549b296a2d5bab8eac20f31a0f3cbdd0@ruby-forum.com> References: <55363288c4881e0e949d11faa6af6c3c@ruby-forum.com> <4809B6EE.9040007@pressure.to> <549b296a2d5bab8eac20f31a0f3cbdd0@ruby-forum.com> Message-ID: <4809D243.2040306@pressure.to> Pat Kiatchaipipat wrote: > yeah it work! but in the middle of top-botton it can use show in > maximize. it can't change?? > http://wxruby.rubyforge.org/doc/frame.html - please use :style => Wx::DEFAULT_FRAME_STYLE ^ Wx::RESIZE_BORDER ^ Wx::MAXIMIZE_BOX alex From alex at pressure.to Sat Apr 19 07:26:34 2008 From: alex at pressure.to (Alex Fenton) Date: Sat, 19 Apr 2008 12:26:34 +0100 Subject: [wxruby-users] wxRuby / wxWigets with C++ In-Reply-To: References: Message-ID: <4809D6EA.2010207@pressure.to> ?ukasz ?api?ski wrote: > I am experimenting with integration of C++ and Ruby. What exactly I would > like to do is to provide an option to use Ruby and wxRuby for creation of > GUI and doing algorithms in C++ and then displaying results in the openGL > Canvas. > I wasn't totally clear what you wanted - do you want to end up with a ruby script that calls some C++ extensions, or a compiled C programme that calls wxRuby to do a GUI. I think the latter will be harder... > But I would also like to transfer the data from the form built using Ruby > into some classes in C++. Like parameters: numbers and string. But I am > wondering if it is possible to create controls in Ruby and then just > assign then into C++ fields (the controls not values). Not quite sure how this would work. Unless the interface of your C++ library is very complex, it might be easier to do it the other way around, ie create a simple ruby wrapper around your C++ library (using SWIG or RICE) then use Ruby to transfer the values into the C library. Is there a particular reason this won't work for you? > I thought these are in fact the same controls, they were written in C++, > but I guess txt is not of type [wxTextField *], but rather > # > so how to get the pointer to wxTextField so I can manipulate the control > from cpp class like this > > someText->GetValue() SWIG provides a lot of useful functions for doing this, if you want. See http://www.swig.org/Doc1.3/Ruby.html#Ruby_nn50 in particular, SWIG_ConvertPtr which converts a VALUE to the underlying C++ object. It's generally used little directly, as it's easier to use %extend to write methods in which the placeholder variable $self refers to the C++ object. alex From lists at ruby-forum.com Sat Apr 19 09:25:44 2008 From: lists at ruby-forum.com (Pat Kiatchaipipat) Date: Sat, 19 Apr 2008 15:25:44 +0200 Subject: [wxruby-users] how can I set window not resize? In-Reply-To: <4809D243.2040306@pressure.to> References: <55363288c4881e0e949d11faa6af6c3c@ruby-forum.com> <4809B6EE.9040007@pressure.to> <549b296a2d5bab8eac20f31a0f3cbdd0@ruby-forum.com> <4809D243.2040306@pressure.to> Message-ID: <2dcccb48eca3f993afb2acb8b744608c@ruby-forum.com> thx you :) -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Sat Apr 19 09:33:06 2008 From: alex at pressure.to (Alex Fenton) Date: Sat, 19 Apr 2008 14:33:06 +0100 Subject: [wxruby-users] use bitmapButton with mouseEvent? In-Reply-To: <61d78ff612353b31b18a66450fc1cb32@ruby-forum.com> References: <61d78ff612353b31b18a66450fc1cb32@ruby-forum.com> Message-ID: <4809F492.7080505@pressure.to> Pat Kiatchaipipat wrote: > hi. I want to make button that can change picture when mouse is entering > and can click to use function. and this is my code. > > > @button2 = BitmapButton.new(@window, -1, @picturebox1_bmp, > Point.new(248,89), Size.new(53, 53)) > @button2.evt_mouse_events{ |event| evtmouse2(event) } > evt_button(@button2.get_id()) { |event| evtbtn2()} > > > def evtmouse2(event) > if event.entering == true > @button2.set_bitmap_label(@picturebox2_bmp) > end > if event.leaving == true > @button2.set_bitmap_label(@picturebox1_bmp) > end > Add 'event.skip' here > end > > > def evtbtn2() > #mycode > end > > It work normally when I use mouse enter the button it can change > picture. but when I click on it. it can't use evtbtn2. what I doing > wrong?? I try to use event.left_down to capture when mouse was clicked. > It work but the button show was not pushed. > This is a common gotcha with event handling. The explanation is here: http://wxruby.rubyforge.org/doc/event.html#Event_skip a From lists at ruby-forum.com Sat Apr 19 11:45:35 2008 From: lists at ruby-forum.com (Pat Kiatchaipipat) Date: Sat, 19 Apr 2008 17:45:35 +0200 Subject: [wxruby-users] use bitmapButton with mouseEvent? In-Reply-To: <4809F492.7080505@pressure.to> References: <61d78ff612353b31b18a66450fc1cb32@ruby-forum.com> <4809F492.7080505@pressure.to> Message-ID: thank you it work! :D -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Sat Apr 19 16:36:52 2008 From: mario at ruby-im.net (Mario Steele) Date: Sat, 19 Apr 2008 15:36:52 -0500 Subject: [wxruby-users] use bitmapButton with mouseEvent? In-Reply-To: <61d78ff612353b31b18a66450fc1cb32@ruby-forum.com> References: <61d78ff612353b31b18a66450fc1cb32@ruby-forum.com> Message-ID: Hello Pat, On Sat, Apr 19, 2008 at 12:36 AM, Pat Kiatchaipipat wrote: > hi. I want to make button that can change picture when mouse is entering > and can click to use function. and this is my code. > > > @button2 = BitmapButton.new(@window, -1, @picturebox1_bmp, > Point.new(248,89), Size.new(53, 53)) > @button2.evt_mouse_events{ |event| evtmouse2(event) } > evt_button(@button2.get_id()) { |event| evtbtn2()} > > > def evtmouse2(event) > if event.entering == true > @button2.set_bitmap_label(@picturebox2_bmp) > end > if event.leaving == true > @button2.set_bitmap_label(@picturebox1_bmp) > end > end > > > def evtbtn2() > #mycode > end > > It work normally when I use mouse enter the button it can change > picture. but when I click on it. it can't use evtbtn2. what I doing > wrong?? I try to use event.left_down to capture when mouse was clicked. > It work but the button show was not pushed. how can I solve it? > -- Another, easier way to implement this type of functionality, is to use the following given methods: BitmapButton#set_bitmap_focus() BitmapButton#set_bitmap_hover() BitmapButton#set_bitmap_selected() BitmapButton#set_bitmap_disable() Though, the way you have now, gives you an idea of how to do things, this sort of thing is already implemented, just so ya know. ;-) -- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ http://rubyforge.org/projects/vwmc/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080419/1a78b126/attachment.html From mario at ruby-im.net Sat Apr 19 16:38:53 2008 From: mario at ruby-im.net (Mario Steele) Date: Sat, 19 Apr 2008 15:38:53 -0500 Subject: [wxruby-users] use bitmapButton with mouseEvent? In-Reply-To: References: <61d78ff612353b31b18a66450fc1cb32@ruby-forum.com> Message-ID: Minor change > BitmapButton#set_bitmap_disable() > Should be: BitmapButton#set_bitmap_disabled() My mistake. L8ers -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080419/e85834b9/attachment-0001.html From lists at ruby-forum.com Sun Apr 20 09:28:54 2008 From: lists at ruby-forum.com (Andreas Warberg) Date: Sun, 20 Apr 2008 15:28:54 +0200 Subject: [wxruby-users] chart extension for wxRuby? In-Reply-To: <47A22486.3080303@pressure.to> References: <478C9F46.1030306@pressure.to> <47A1737C.7060602@pressure.to> <47A22486.3080303@pressure.to> Message-ID: <28d948f373c7332b3bb5059ae3764d51@ruby-forum.com> Alex Fenton wrote: > require 'scruffy' > require 'wx' > > class Chart < Wx::Window > attr_reader :graph > def initialize(*args) > super > evt_paint :on_paint > @graph = Scruffy::Graph.new(:title => "Monthly Profits") > graph.add(:line, 'John', [100, -20, 30, 60]) > graph.add(:line, 'Sara', [120, 50, -80, 20]) > end > > def on_paint > paint do | dc | > graph.render(dc, :width => size.width, :height => size.height) > end > end > end > > > Wx::App.run do > frame = Wx::Frame.new(nil, :title => 'chart demo') > chart = Chart.new(frame) > frame.show > end This won't run. I get 'in `render': wrong number of arguments (2 for 1) (ArgumentError)' when I copy your example verbatim. Removing the extra argument in render and rerunning gives me: C:/ruby/lib/ruby/gems/1.8/gems/scruffy-0.2.2/lib/scruffy/graph.rb:131:in `render': undefined method '[]' for # (NoMethodError) I would like to render a graph directly to the screen - is this possibly using scruffy / wxruby? Regards Andreas -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Sun Apr 20 10:10:05 2008 From: alex at pressure.to (Alex Fenton) Date: Sun, 20 Apr 2008 15:10:05 +0100 Subject: [wxruby-users] chart extension for wxRuby? In-Reply-To: <28d948f373c7332b3bb5059ae3764d51@ruby-forum.com> References: <478C9F46.1030306@pressure.to> <47A1737C.7060602@pressure.to> <47A22486.3080303@pressure.to> <28d948f373c7332b3bb5059ae3764d51@ruby-forum.com> Message-ID: <480B4EBD.6010105@pressure.to> Andreas Warberg wrote: > Alex Fenton wrote: > >> require 'scruffy' >> require 'wx' >> >> class Chart < Wx::Window >> >> ... > This won't run. I get 'in `render': wrong number of arguments (2 for 1) > (ArgumentError)' when I copy your example verbatim. > I think you've misunderstood the purpose of the example. It was just to show a set up where a scruffy graph would render using a wxRuby DC (device context) rather than to an SVG object. What remains for someone with motivation to do is to convert or translate the calls that scruffy makes to an svg object inside the library (eg svg.line, svg.circle) into the equivalent DC calls (dc.draw_line, dc.draw_circle). The relevant parts of scruffy to look at are in the components and layers directory. Probably it would be easiest to create a bridge class that translates svg calls as dc calls. Then you could use the the Scruffy library unmodified. I did enough to persuade myself that this was likely a viable approach, but have no particular interest in pursuing at the moment. > I would like to render a graph directly to the screen - is this possibly > using scruffy / wxruby? No, not directly without you or someone else doing some work. The other approach would be to wrap a C++ wxWidgets component that renders SVG (such as wxArt2D) in Ruby. This is probably harder. alex alex From alex at pressure.to Sun Apr 20 10:15:28 2008 From: alex at pressure.to (Alex Fenton) Date: Sun, 20 Apr 2008 15:15:28 +0100 Subject: [wxruby-users] chart extension for wxRuby? In-Reply-To: <28d948f373c7332b3bb5059ae3764d51@ruby-forum.com> References: <478C9F46.1030306@pressure.to> <47A1737C.7060602@pressure.to> <47A22486.3080303@pressure.to> <28d948f373c7332b3bb5059ae3764d51@ruby-forum.com> Message-ID: <480B5000.2050901@pressure.to> Andreas Warberg wrote: > I would like to render a graph directly to the screen - is this possibly > using scruffy / wxruby? Or, the simplest route would just to be to install a ruby extension that renders SVG to PNG or some other raster format that wxRuby can read, and then display that. I think ImageMagick can rasterize SVG in this way. alex From lists at ruby-forum.com Mon Apr 21 07:52:51 2008 From: lists at ruby-forum.com (Andreas Warberg) Date: Mon, 21 Apr 2008 13:52:51 +0200 Subject: [wxruby-users] chart extension for wxRuby? In-Reply-To: <480B4EBD.6010105@pressure.to> References: <478C9F46.1030306@pressure.to> <47A1737C.7060602@pressure.to> <47A22486.3080303@pressure.to> <28d948f373c7332b3bb5059ae3764d51@ruby-forum.com> <480B4EBD.6010105@pressure.to> Message-ID: <4ec26cbeeeb327191fcbf38423d6eb48@ruby-forum.com> Alex Fenton wrote: > I think you've misunderstood the purpose of the example. It was just to > show a set up where a scruffy graph would render using a wxRuby DC > (device context) rather than to an SVG object. > > What remains for someone with motivation to do is to convert or > translate the calls that scruffy makes to an svg object inside the > library (eg svg.line, svg.circle) into the equivalent DC calls > (dc.draw_line, dc.draw_circle). The relevant parts of scruffy to look at > are in the components and layers directory. You're right I did misunderstand. I might pursue your first suggestion to create the svg and the load it as an image, though it is suboptimal. I understand you can divert the output procedure to the screen but since it is not a part of the "standard package" - and I thus need to write it myself - I don't think it is a good route to take, considering time and reliability. Thanks! Andreas -- Posted via http://www.ruby-forum.com/. From lucaslevin at gmail.com Mon Apr 21 08:00:34 2008 From: lucaslevin at gmail.com (Lucas Levin) Date: Mon, 21 Apr 2008 22:00:34 +1000 Subject: [wxruby-users] wxRuby segfault on exit Message-ID: <1208779234.15216.3.camel@lucascomputer> Hi, All programs I make with wxruby crash when they are closed. This happens with the examples as well. Is this fixed in the svn? I tried building the svn from source, but once I compiled and installed it, I got some question about a missing symbol when running my program. Thanks, Lucas From alex at pressure.to Mon Apr 21 08:08:25 2008 From: alex at pressure.to (Alex Fenton) Date: Mon, 21 Apr 2008 13:08:25 +0100 Subject: [wxruby-users] wxRuby segfault on exit In-Reply-To: <1208779234.15216.3.camel@lucascomputer> References: <1208779234.15216.3.camel@lucascomputer> Message-ID: <480C83B9.8050802@pressure.to> Lucas Levin wrote: > All programs I make with wxruby crash when they are closed. This happens > with the examples as well. > Please say which platform you're on, and what version you're using. And could you show us some simple, complete code that demonstrates the error, or at least indicate which sample(s) you're talking about? > Is this fixed in the svn? > There is a fix in SVN for a longstanding irritating bug which could crashes on closing frames under some circumstances, if event handlers were attached. But without knowing more about your bug, it's hard to know whether this is the problem - but it sounds quite possible. With SVN head I now have no crashes on exit on any sample. > I tried building the svn from source, but once I compiled and installed > it, I got some question about a missing symbol when running my program. > Again, can you give us a clue about what symbol was missing? And what wxWidgets you are building against? alex From lists at ruby-forum.com Mon Apr 21 08:39:36 2008 From: lists at ruby-forum.com (Andreas Warberg) Date: Mon, 21 Apr 2008 14:39:36 +0200 Subject: [wxruby-users] Transparent line in Frame Message-ID: <7c83d0dbe249ef046e1d8572c1b2af3f@ruby-forum.com> Hi Thanks for a great GUI toolkit! I want to draw transparent lines in a Frame. I have the following setup but my lines are not transparent. My colour object is created using: transparent_blue = Colour.new(0,0,255,100) and I draw lines using a pen with this colour: @pen = Pen.new(transparent_blue) In evt_paint of frame I have: dc.set_pen(@pen) dc.draw_line(x1,y1,x2,y2) The line is blue but there is no transparency. I set the alpha level to 100 where 255 is supposed to be completely opaque. I'm on Windows XP SP2 and C:\>ruby --version ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32] Please help! Regards, Andreas -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Mon Apr 21 08:56:00 2008 From: alex at pressure.to (Alex Fenton) Date: Mon, 21 Apr 2008 13:56:00 +0100 Subject: [wxruby-users] Transparent line in Frame In-Reply-To: <7c83d0dbe249ef046e1d8572c1b2af3f@ruby-forum.com> References: <7c83d0dbe249ef046e1d8572c1b2af3f@ruby-forum.com> Message-ID: <480C8EE0.1090901@pressure.to> Andreas Warberg wrote: > I want to draw transparent lines in a Frame. I have the following setup > but my lines are not transparent. The standard DC doesn't support transparency (except on OS X I think). But you can instead use wxGraphicsContext which fully supports transparency, antialiasing and other advanced drawing tools like splines and transforms. You create one from an ordinary DC like this: paint.do | dc | gdc = Wx::GraphicsContext.create(dc) gdc.stroke_line(0, 0, 500, 500) # etc end Unfortunately the wxWidgets developers decided to make the API to GraphicsContext different to DC, but the results are worth it for graphical apps. alex From lists at ruby-forum.com Mon Apr 21 10:20:40 2008 From: lists at ruby-forum.com (Andreas Warberg) Date: Mon, 21 Apr 2008 16:20:40 +0200 Subject: [wxruby-users] Transparent line in Frame In-Reply-To: <480C8EE0.1090901@pressure.to> References: <7c83d0dbe249ef046e1d8572c1b2af3f@ruby-forum.com> <480C8EE0.1090901@pressure.to> Message-ID: <07e4eb20d17a4ea0024bd8aaefa43151@ruby-forum.com> Alex Fenton wrote: > The standard DC doesn't support transparency (except on OS X I think). > But you can instead use wxGraphicsContext which fully supports > transparency, antialiasing and other advanced drawing tools like splines > and transforms. You create one from an ordinary DC like this: > > paint.do | dc | > gdc = Wx::GraphicsContext.create(dc) > gdc.stroke_line(0, 0, 500, 500) > # etc > end Thanks! I'm having a bit of trouble, though. Here is a small example I use: require 'wx' include Wx App.run do frame = Frame.new(nil, :title => 'GraphicsContext example', :width => [300,400]) frame.evt_paint do frame.paint do |dc| gdc = GraphicsContext.create(dc) siz = dc.size h, w = siz.height, siz.width #dc.draw_line(0,0,w,h) gdc.stroke_line(0,0,w,h) end end frame.show end It should draw / stroke a diagonal line in the frame. This works if I use draw_line. What am I missing? :) Andreas -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Mon Apr 21 10:34:41 2008 From: alex at pressure.to (Alex Fenton) Date: Mon, 21 Apr 2008 15:34:41 +0100 Subject: [wxruby-users] Transparent line in Frame In-Reply-To: <07e4eb20d17a4ea0024bd8aaefa43151@ruby-forum.com> References: <7c83d0dbe249ef046e1d8572c1b2af3f@ruby-forum.com> <480C8EE0.1090901@pressure.to> <07e4eb20d17a4ea0024bd8aaefa43151@ruby-forum.com> Message-ID: <480CA601.1000204@pressure.to> Andreas Warberg wrote: > Thanks! I'm having a bit of trouble, though. Here is a small example I > use: > > require 'wx' > include Wx > > App.run do > frame = Frame.new(nil, :title => 'GraphicsContext example', :width => > [300,400]) > > frame.evt_paint do > frame.paint do |dc| > gdc = GraphicsContext.create(dc) > siz = dc.size > h, w = siz.height, siz.width > #dc.draw_line(0,0,w,h) > gdc.pen = Wx::Pen.new( Wx::Colour.new(255, 0, 0, 128), 20) > gdc.stroke_line(0,0,w,h) > end > end > > frame.show > end > > It should draw / stroke a diagonal line in the frame. This works if I > use draw_line. > > What am I missing? :) It seems with GraphicsContext, you need to set some sort of pen before starting drawing - there is no default pen when it's first created. alex From lists at ruby-forum.com Mon Apr 21 10:47:05 2008 From: lists at ruby-forum.com (Andreas Warberg) Date: Mon, 21 Apr 2008 16:47:05 +0200 Subject: [wxruby-users] Transparent line in Frame In-Reply-To: <480CA601.1000204@pressure.to> References: <7c83d0dbe249ef046e1d8572c1b2af3f@ruby-forum.com> <480C8EE0.1090901@pressure.to> <07e4eb20d17a4ea0024bd8aaefa43151@ruby-forum.com> <480CA601.1000204@pressure.to> Message-ID: <676ceac24ccef9321de36018132d876d@ruby-forum.com> Alex Fenton wrote: > Andreas Warberg wrote: >> frame.evt_paint do >> frame.paint do |dc| >> gdc = GraphicsContext.create(dc) >> siz = dc.size >> h, w = siz.height, siz.width >> #dc.draw_line(0,0,w,h) >> > gdc.pen = Wx::Pen.new( Wx::Colour.new(255, 0, 0, 128), 20) >> What am I missing? :) > It seems with GraphicsContext, you need to set some sort of pen before > starting drawing - there is no default pen when it's first created. > > alex Thanks! -- Posted via http://www.ruby-forum.com/. From Peter_Ellis at nrel.gov Mon Apr 21 20:18:52 2008 From: Peter_Ellis at nrel.gov (Ellis, Peter) Date: Mon, 21 Apr 2008 18:18:52 -0600 Subject: [wxruby-users] chart extension for wxRuby? In-Reply-To: <4ec26cbeeeb327191fcbf38423d6eb48@ruby-forum.com> References: <478C9F46.1030306@pressure.to><47A1737C.7060602@pressure.to><47A22486.3080303@pressure.to><28d948f373c7332b3bb5059ae3764d51@ruby-forum.com><480B4EBD.6010105@pressure.to> <4ec26cbeeeb327191fcbf38423d6eb48@ruby-forum.com> Message-ID: I just wanted to report back to the list on one chart-making technique that has been working out well for me so far. I am using a popular open source scientific and mathematical plotting package called Gnuplot. http://www.gnuplot.info/ To use Gnuplot I started with a Ruby wrapper called rgplot (found on RubyForge). http://rubyforge.org/projects/rgplot After playing with rgplot a while, I came to the conclusion that the interface wasn't really suited for my needs, so I studied the code, learned a few key things, and ultimately came away with the one or two lines of code that setup the pipe between Ruby and Gnuplot. Then I wrote my own proof-of-concept wrapper to plot a couple of charts: clustered bar charts, stacked bar charts, line graphs, etc. Unfortunately, my wrapper is not really good enough for public consumption, but I can explain how it works and you might be able to use the same idea for your own applications. Basically, Gnuplot is run as a subprocess from Ruby. You pass whatever commands and data you want to Gnuplot through a stream to that subprocess. When it's done plotting, Gnuplot writes an image file to disk (JPG or other format). Finally you create a Wx::Image from the image file and draw it as Wx::Bitmap on a dc. You can get pretty nice looking charts out of Gnuplot but you might have to work at it. The Gnuplot syntax can be a pain, but it does come with a lot of example files that help a lot. It also has an interactive GUI that is handy for testing command syntax. One thing that Gnuplot cannot do is pie charts. However, if you really need pie charts, they would be easy enough to implement yourself by drawing directly with wx. To implement your own wrapper for Gnuplot, I definitely recommend studying rgplot (or use it "as is", if it works for you). One thing to look out for is that Gnuplot will be running asynchronously from whatever else you are doing in Ruby or wx. So I use the on_timer event to watch for the image file to be completed. After a lot of experimentation, I found that (File.exists?(path) and File.size(path) > 0) is the best test to see if the image file is actually ready to be loaded into wx. Also, if you need to create multiple charts at the same time, you will need to write a manager that sequentially feeds jobs to Gnuplot and then collects the resulting images. I was able to do that without too much trouble, again using the on_timer event. Maybe someday I'll be able to put together a wrapper that I would be willing to share. At the moment I'm not working on this actively, but I hope to get back to it in a few months. Best of luck, P -----Original Message----- From: wxruby-users-bounces at rubyforge.org [mailto:wxruby-users-bounces at rubyforge.org] On Behalf Of Andreas Warberg Sent: Monday, April 21, 2008 5:53 AM To: wxruby-users at rubyforge.org Subject: Re: [wxruby-users] chart extension for wxRuby? Alex Fenton wrote: > I think you've misunderstood the purpose of the example. It was just to > show a set up where a scruffy graph would render using a wxRuby DC > (device context) rather than to an SVG object. > > What remains for someone with motivation to do is to convert or > translate the calls that scruffy makes to an svg object inside the > library (eg svg.line, svg.circle) into the equivalent DC calls > (dc.draw_line, dc.draw_circle). The relevant parts of scruffy to look at > are in the components and layers directory. You're right I did misunderstand. I might pursue your first suggestion to create the svg and the load it as an image, though it is suboptimal. I understand you can divert the output procedure to the screen but since it is not a part of the "standard package" - and I thus need to write it myself - I don't think it is a good route to take, considering time and reliability. Thanks! Andreas -- Posted via http://www.ruby-forum.com/. _______________________________________________ wxruby-users mailing list wxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users From lists at ruby-forum.com Mon Apr 21 21:54:49 2008 From: lists at ruby-forum.com (Daniel Washburn) Date: Tue, 22 Apr 2008 03:54:49 +0200 Subject: [wxruby-users] Problem with runtime error/segfault In-Reply-To: <4804B1B6.50109@pressure.to> References: <3fd5ef906acc270be8b876d961094ca8@ruby-forum.com> <4804B1B6.50109@pressure.to> Message-ID: Thanks Alex, I'll look into that and see if I can't figure it out. As you can see I'm still a bit new to everything, so thanks again for your trouble. -- Posted via http://www.ruby-forum.com/. From lucaslevin at gmail.com Tue Apr 22 02:27:08 2008 From: lucaslevin at gmail.com (Lucas Levin) Date: Tue, 22 Apr 2008 16:27:08 +1000 Subject: [wxruby-users] wxRuby segfault on exit In-Reply-To: <480C83B9.8050802@pressure.to> References: <1208779234.15216.3.camel@lucascomputer> <480C83B9.8050802@pressure.to> Message-ID: <1208845628.8050.38.camel@lucascomputer> On reflection, that probably wasn't anywhere near enough info. ? > Please say which platform you're on, and what version you're using. And > could you show us some simple, complete code that demonstrates the > error, or at least indicate which sample(s) you're talking about? I'm running GNOME version 2.22.1 on Ubuntu 8.04 release candidate (it is possible this is the problem, I'll use a livecd later to check on an earlier ubuntu). I'm using the gem retrieved using 'gem install wxruby', which is 1.9.5. As for some code none of the samples I tried worked. Here is nothing.rb (minus comments): begin require 'rubygems' rescue LoadError end require 'wx' Wx::App.run do frame = Wx::Frame.new(nil, :title => "Minimal wxRuby App") frame.show end Gives this: minimal/nothing.rb:13: [BUG] Segmentation fault ruby 1.8.6 (2007-09-24) [i486-linux] Aborted ? > Again, can you give us a clue about what symbol was missing? And what > wxWidgets you are building against? I'm using 2.8.7.1, BUT I also have version 2.6.3.2 runtime installed for VLC. I don't have the i18n package or the wx-common package installed. As the the missing symbol, I don't know right now but I'll get back to you. If it is of any significance, during installation it said the PrinterDC component would be skipped for some reason. Thanks, Lucas From alex at pressure.to Tue Apr 22 04:09:28 2008 From: alex at pressure.to (Alex Fenton) Date: Tue, 22 Apr 2008 09:09:28 +0100 Subject: [wxruby-users] wxRuby segfault on exit In-Reply-To: <1208845628.8050.38.camel@lucascomputer> References: <1208779234.15216.3.camel@lucascomputer> <480C83B9.8050802@pressure.to> <1208845628.8050.38.camel@lucascomputer> Message-ID: <480D9D38.1070207@pressure.to> Hi Lucas Levin wrote: > I'm running GNOME version 2.22.1 on Ubuntu 8.04 release candidate (it is > possible this is the problem, I'll use a livecd later to check on an > earlier ubuntu). I'm using the gem retrieved using 'gem install wxruby', > which is 1.9.5. > I use current 7.10 Ubuntu, so no need to test there to see if it's the distro. The binary gem you installed was built on that. > As for some code none of the samples I tried worked. Here is nothing.rb > > OK, there's something wrong if nothing.rb isn't working. Most of the bugs that have been fixed in SVN since 1.9.5 are pretty esoteric. > Gives this: > minimal/nothing.rb:13: [BUG] Segmentation fault > ruby 1.8.6 (2007-09-24) [i486-linux] > One thing springs to mind here. The ruby-core team decided it was a good idea to change bits of ruby's GC code between two patch levels of ruby 1.8.6 and this created a problem in wxRuby which is now fixed in SVN. This would show up as something like "object allocation during GC" error message. Could you try running it under gdb please? The binary is stripped so it may give anything useful, but worth a shot. gdb --args ruby -rubygems minimal/nothing.rb Then at the gdb prompt: > r Then when it crashes: > whe And post back the first 20-odd lines of what results. >> Again, can you give us a clue about what symbol was missing? And what >> wxWidgets you are building against? >> > I'm using 2.8.7.1, BUT I also have version 2.6.3.2 runtime installed for VLC. > The binary gem includes a statically linked version of wxWidgets so your system version shouldn't matter. It will matter if you're building yourself against a distro package. > I don't have the i18n package or the wx-common package installed. > As the the missing symbol, I don't know right now but I'll get back to you. > > If it is of any significance, during installation it said the PrinterDC component would be skipped for some reason. That's normal on GTK. If that's the only component being skipped, it's trying to build everything else including all optional components like Scintillla, MediaCtrl, OpenGL. wxRuby's configure should detect if these aren't available and skip them, but it could be that this hasn't happened and that's the reason for the missing symbol. If we knew the symbol that would pin it down cheers alex From lucaslevin at gmail.com Tue Apr 22 08:28:24 2008 From: lucaslevin at gmail.com (Lucas Levin) Date: Tue, 22 Apr 2008 22:28:24 +1000 Subject: [wxruby-users] wxRuby segfault on exit In-Reply-To: <480D9D38.1070207@pressure.to> References: <1208779234.15216.3.camel@lucascomputer> <480C83B9.8050802@pressure.to> <1208845628.8050.38.camel@lucascomputer> <480D9D38.1070207@pressure.to> Message-ID: <1208867304.8489.15.camel@lucascomputer> > I use current 7.10 Ubuntu, so no need to test there to see if it's the > distro. The binary gem you installed was built on that. Does that mean we can assume it the fact I'm running 8.04 that's causing the problem? Upgrading to the rc has caused me nothing but trouble, I'll be patient in the future:) > One thing springs to mind here. The ruby-core team decided it was a good > idea to change bits of ruby's GC code between two patch levels of ruby > 1.8.6 and this created a problem in wxRuby which is now fixed in SVN. > This would show up as something like "object allocation during GC" error > message. Not getting a message like that. > Could you try running it under gdb please? The binary is stripped so it > may give anything useful, but worth a shot. Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 0xb7cf4b60 (LWP 9268)] 0xb5234f74 in ?? () from /lib/libselinux.so.1 (gdb) whe #0 0xb5234f74 in ?? () from /lib/libselinux.so.1 #1 0x00000060 in ?? () #2 0xb5223000 in ?? () #3 0x0001816c in ?? () #4 0xb523aff4 in ?? () from /lib/libselinux.so.1 #5 0xb523aff4 in ?? () from /lib/libselinux.so.1 #6 0xb523ba84 in ?? () from /lib/libselinux.so.1 #7 0xbf94e458 in ?? () #8 0xb522e64e in ?? () from /lib/libselinux.so.1 #9 0x00000000 in ?? () libselinux? how odd. Unless it runs underneath the hood, I don't think I use it. > > If it is of any significance, during installation it said the PrinterDC component would be skipped for some reason. > That's normal on GTK. If that's the only component being skipped, it's > trying to build everything else including all optional components like > Scintillla, MediaCtrl, OpenGL. wxRuby's configure should detect if these > aren't available and skip them, but it could be that this hasn't > happened and that's the reason for the missing symbol. If we knew the > symbol that would pin it down See the last post for the symbol. Thanks! From alex at pressure.to Tue Apr 22 10:14:18 2008 From: alex at pressure.to (Alex Fenton) Date: Tue, 22 Apr 2008 15:14:18 +0100 Subject: [wxruby-users] wxRuby segfault on exit In-Reply-To: <1208867304.8489.15.camel@lucascomputer> References: <1208779234.15216.3.camel@lucascomputer> <480C83B9.8050802@pressure.to> <1208845628.8050.38.camel@lucascomputer> <480D9D38.1070207@pressure.to> <1208867304.8489.15.camel@lucascomputer> Message-ID: <480DF2BA.4010100@pressure.to> Lucas Levin wrote: >> I use current 7.10 Ubuntu, so no need to test there to see if it's the >> distro. The binary gem you installed was built on that. >> > Does that mean we can assume it the fact I'm running 8.04 that's causing the problem? > Upgrading to the rc has caused me nothing but trouble, I'll be patient in the future:) > It could be, or it could just be that that version of Ubuntu has upgraded to ruby 1.8.6-p114 and that's causing problems. Rather than trying to compile wxRuby yourself, you could also see if ruby-1.8.6-p110 works if you compile it yourself. http://rubyforge.org/frs/?group_id=426 I will likely move onto 8.04 when it's ready and offered by Ubuntu's update manager, so future gems will target that. >> One thing springs to mind here. The ruby-core team decided it was a good >> idea to change bits of ruby's GC code between two patch levels of ruby >> 1.8.6 and this created a problem in wxRuby which is now fixed in SVN. >> This would show up as something like "object allocation during GC" error >> message. >> > Not getting a message like that. > OK, but that's what I would expect if it were this bug that ruby-core introduced. >> Could you try running it under gdb please? The binary is stripped so it >> may give anything useful, but worth a shot. >> > libselinux? how odd. Unless it runs underneath the hood, I don't think I > use it. > Unfortunately there's not much useful left in there, because the binary in the gem is stripped to reduce size. >>> If it is of any significance, during installation it said the PrinterDC component would be skipped for some reason. >>> >> That's normal on GTK. If that's the only component being skipped, it's >> trying to build everything else including all optional components like >> Scintillla, MediaCtrl, OpenGL. wxRuby's configure should detect if these >> aren't available and skip them, but it could be that this hasn't >> happened and that's the reason for the missing symbol. If we knew the >> symbol that would pin it down >> > See the last post for the symbol. I don't think you've posted it? alex From awarrier at berkeley.edu Tue Apr 22 11:45:38 2008 From: awarrier at berkeley.edu (Ajithkumar Warrier) Date: Tue, 22 Apr 2008 08:45:38 -0700 Subject: [wxruby-users] Bitmap toggle button Message-ID: <77d2136d0804220845y339be79u38d02b02d89a028a@mail.gmail.com> Hi, How do I make a bitmap toggle button? I tried making a toggle button and then drawing onto it, but that didn't work. Also, I tried a bitmap button but that wouldn't remain pressed like a toggle button. Thanks for any help, warrior From alex at pressure.to Tue Apr 22 12:35:58 2008 From: alex at pressure.to (Alex Fenton) Date: Tue, 22 Apr 2008 17:35:58 +0100 Subject: [wxruby-users] Bitmap toggle button In-Reply-To: <77d2136d0804220845y339be79u38d02b02d89a028a@mail.gmail.com> References: <77d2136d0804220845y339be79u38d02b02d89a028a@mail.gmail.com> Message-ID: <480E13EE.8050106@pressure.to> Ajithkumar Warrier wrote: > How do I make a bitmap toggle button? I tried making a toggle button > and then drawing onto it, but that didn't work. Also, I tried a bitmap > button but that wouldn't remain pressed like a toggle button. There's nothing in standard wxRuby and wxWidgets like that, apart from a "toggle" tool in a Wx::ToolBar. If you search for "wxBitmapButton bitmap" you'll turn up references to several wxWidgets C++ classes that do this. Maybe you could adapt the code from one of those to Ruby. alex From alex at pressure.to Tue Apr 22 12:40:15 2008 From: alex at pressure.to (Alex Fenton) Date: Tue, 22 Apr 2008 17:40:15 +0100 Subject: [wxruby-users] Bitmap toggle button In-Reply-To: <77d2136d0804220845y339be79u38d02b02d89a028a@mail.gmail.com> References: <77d2136d0804220845y339be79u38d02b02d89a028a@mail.gmail.com> Message-ID: <480E14EF.6050301@pressure.to> Ajithkumar Warrier wrote: > How do I make a bitmap toggle button? I tried making a toggle button > and then drawing onto it, but that didn't work. Also, I tried a bitmap > button but that wouldn't remain pressed like a toggle button. Also, you might adapt from wxPython's GenBitmapToggleButton. The python code should be easier to translate into wxRuby. http://svn.wxwidgets.org/svn/wx/wxPython/trunk/wx/lib/buttons.py a From awarrier at berkeley.edu Tue Apr 22 13:06:19 2008 From: awarrier at berkeley.edu (Ajithkumar Warrier) Date: Tue, 22 Apr 2008 10:06:19 -0700 Subject: [wxruby-users] Bitmap toggle button In-Reply-To: <480E14EF.6050301@pressure.to> References: <77d2136d0804220845y339be79u38d02b02d89a028a@mail.gmail.com> <480E14EF.6050301@pressure.to> Message-ID: <77d2136d0804221006s58483882k74e81b80931e7bf7@mail.gmail.com> Thanks Alex, wxPython's GenBitmapToggleButton seems to rely heavily on the toggle mixin, and it might require more digging in than I had originally intended. I'll try it later and keep posted. On Tue, Apr 22, 2008 at 9:40 AM, Alex Fenton wrote: > Ajithkumar Warrier wrote: > > How do I make a bitmap toggle button? I tried making a toggle button > > and then drawing onto it, but that didn't work. Also, I tried a bitmap > > button but that wouldn't remain pressed like a toggle button. > Also, you might adapt from wxPython's GenBitmapToggleButton. The python > code should be easier to translate into wxRuby. > > http://svn.wxwidgets.org/svn/wx/wxPython/trunk/wx/lib/buttons.py > > > > a > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > From lists at ruby-forum.com Wed Apr 23 06:24:39 2008 From: lists at ruby-forum.com (Andreas Warberg) Date: Wed, 23 Apr 2008 12:24:39 +0200 Subject: [wxruby-users] Black background using paint_buffered Message-ID: <7152d40c27957a000ada2e4b4de334e2@ruby-forum.com> Hi, To avoid flickering during screen updates in a Frame on Windows I recently switched from paint do | dc | #... end to paint_buffered do | dc | #... end The background colour of the Frame is set to WHITE, which is respected under paint, but is replaced by BLACK under paint_buffered. The painting jobs seems fine, though all my black lines become invisible :P Is there something I can do to sort this out? Perhaps supply my own buffer... Thank you! Regards, Andreas -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Wed Apr 23 06:34:34 2008 From: alex at pressure.to (Alex Fenton) Date: Wed, 23 Apr 2008 11:34:34 +0100 Subject: [wxruby-users] Black background using paint_buffered In-Reply-To: <7152d40c27957a000ada2e4b4de334e2@ruby-forum.com> References: <7152d40c27957a000ada2e4b4de334e2@ruby-forum.com> Message-ID: <480F10BA.2@pressure.to> Andreas Warberg wrote: > To avoid flickering during screen updates in a Frame on Windows I > recently switched from > > paint do | dc | > #... > end > > to > > paint_buffered do | dc | > #... > end > > The background colour of the Frame is set to WHITE, which is respected > under paint, but is replaced by BLACK under paint_buffered. > > The painting jobs seems fine, though all my black lines become invisible > :P > > Is there something I can do to sort this out? Perhaps supply my own > buffer... > Yes, you can pass your own buffer as an optional argument to paint_buffered. It should be a Wx::Bitmap of the appropriate height and width. I will see if the ruby code that does paint_buffered could make the bitmap background match the window's. a From mario at ruby-im.net Wed Apr 23 06:45:05 2008 From: mario at ruby-im.net (Mario Steele) Date: Wed, 23 Apr 2008 05:45:05 -0500 Subject: [wxruby-users] Black background using paint_buffered In-Reply-To: <480F10BA.2@pressure.to> References: <7152d40c27957a000ada2e4b4de334e2@ruby-forum.com> <480F10BA.2@pressure.to> Message-ID: Dang you Alex, You beat me to it. :P Actually, another suggestion, would be to use Wx::DC#draw_rectangle(), in which you set the Pen and Brush with the color you want to use. Simple Example (Not Tested): pen = Wx::Pen.new(Wx::WHITE) brush = Wx::Brush.new() brush.colour(Wx::WHITE) dc.set_pen(pen) dc.set_brush(brush) dc.draw_rectangle(0,0,self.width,self.height) .... do your drawing here .... L8ers, On Wed, Apr 23, 2008 at 5:34 AM, Alex Fenton wrote: > Andreas Warberg wrote: > > To avoid flickering during screen updates in a Frame on Windows I > > recently switched from > > > > paint do | dc | > > #... > > end > > > > to > > > > paint_buffered do | dc | > > #... > > end > > > > The background colour of the Frame is set to WHITE, which is respected > > under paint, but is replaced by BLACK under paint_buffered. > > > > The painting jobs seems fine, though all my black lines become invisible > > :P > > > > Is there something I can do to sort this out? Perhaps supply my own > > buffer... > > > Yes, you can pass your own buffer as an optional argument to > paint_buffered. It should be a Wx::Bitmap of the appropriate height and > width. > > I will see if the ruby code that does paint_buffered could make the > bitmap background match the window's. > > a > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Mario Steele http://www.trilake.net http://www.ruby-im.net http://rubyforge.org/projects/wxruby/ http://rubyforge.org/projects/wxride/ http://rubyforge.org/projects/vwmc/ -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080423/473e4348/attachment.html From lists at ruby-forum.com Wed Apr 23 06:55:38 2008 From: lists at ruby-forum.com (Andreas Warberg) Date: Wed, 23 Apr 2008 12:55:38 +0200 Subject: [wxruby-users] Black background using paint_buffered In-Reply-To: References: <7152d40c27957a000ada2e4b4de334e2@ruby-forum.com> <480F10BA.2@pressure.to> Message-ID: <9f66df0f59fdef7745520f9f4fcc6101@ruby-forum.com> Mario Steele wrote: > pen = Wx::Pen.new(Wx::WHITE) > brush = Wx::Brush.new() > brush.colour(Wx::WHITE) > > dc.set_pen(pen) > dc.set_brush(brush) > dc.draw_rectangle(0,0,self.width,self.height) > > .... do your drawing here .... Thanks for this workaround. I now have flicker free updates AND a white background :) I'm looking forward to your update, Alex. Thanks guys - I'm enjoying wxruby :) -- Posted via http://www.ruby-forum.com/. From chutsu at gmail.com Wed Apr 23 07:05:51 2008 From: chutsu at gmail.com (Christopher Choi) Date: Wed, 23 Apr 2008 12:05:51 +0100 Subject: [wxruby-users] wxruby with wxglade? Message-ID: <44d1b9970804230405s46cec848w2c789fa9e7e39f1@mail.gmail.com> Hi I've been trying to find out how to use wxglade with ruby in google, but I haven't been able to find anything on the topic so far, so I was wondering what do you guys use instead? I mean you don't really hand code all the gui stuff do you, you must have some visual gui designer available? I'm new to Gui so please be kind! Thanks Chris -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20080423/98b81ae7/attachment.html From alex at pressure.to Wed Apr 23 07:10:20 2008 From: alex at pressure.to (Alex Fenton) Date: Wed, 23 Apr 2008 12:10:20 +0100 Subject: [wxruby-users] wxruby with wxglade? In-Reply-To: <44d1b9970804230405s46cec848w2c789fa9e7e39f1@mail.gmail.com> References: <44d1b9970804230405s46cec848w2c789fa9e7e39f1@mail.gmail.com> Message-ID: <480F191C.9020106@pressure.to> Christopher Choi wrote: > I've been trying to find out how to use wxglade with ruby in google, > but I haven't been able to find anything on the topic so far, so I was > wondering what do you guys use instead? I mean you don't really hand > code all the gui stuff do you, you must have some visual gui designer > available? Use wxGlade but save the resulting files as "XRC". This is an XML format you can load into ruby. http://wxruby.rubyforge.org/wiki/wiki.pl?Using_GUI_Designers http://wxruby.rubyforge.org/wiki/wiki.pl?UsingXRCise And see the example 'samples/xrc/xrc_sample.rb' a From lucaslevin at gmail.com Thu Apr 24 03:36:18 2008 From: lucaslevin at gmail.com (Lucas Levin) Date: Thu, 24 Apr 2008 17:36:18 +1000 Subject: [wxruby-users] wxRuby segfault on exit In-Reply-To: <480DF2BA.4010100@pressure.to> References: <1208779234.15216.3.camel@lucascomputer> <480C83B9.8050802@pressure.to> <1208845628.8050.38.camel@lucascomputer> <480D9D38.1070207@pressure.to> <1208867304.8489.15.camel@lucascomputer> <480DF2BA.4010100@pressure.to> Message-ID: <1209022578.7988.29.camel@lucascomputer> > It could be, or it could just be that that version of Ubuntu has > upgraded to ruby 1.8.6-p114 and that's causing problems. Rather than > trying to compile wxRuby yourself, you could also see if ruby-1.8.6-p110 > works if you compile it yourself. $ ruby --version ruby 1.8.6 (2007-09-24 patchlevel 111) [i486-linux] I don't think I can be bothered installing a whole new ruby, I'll just live with it until you upgrade.:) Lucas From lucaslevin at gmail.com Mon Apr 28 04:44:41 2008 From: lucaslevin at gmail.com (Lucas Levin) Date: Mon, 28 Apr 2008 18:44:41 +1000 Subject: [wxruby-users] LC_REPORT ListCtrl Confusion Message-ID: <1209372281.9065.2.camel@lucascomputer> Hi, I'm having some trouble allowing the user to edit a multi-column listctrl. I can do the first column fine, simply by calling ListCtrl::edit_label in the activate event, but it seems impossible to do this for the other columns for two reasons. 1, the activate event doesn't allow you to get the column, and 2, edit_label onl;y works for the first column. Thanks, Lucas From alex at pressure.to Mon Apr 28 05:49:59 2008 From: alex at pressure.to (Alex Fenton) Date: Mon, 28 Apr 2008 10:49:59 +0100 Subject: [wxruby-users] LC_REPORT ListCtrl Confusion In-Reply-To: <1209372281.9065.2.camel@lucascomputer> References: <1209372281.9065.2.camel@lucascomputer> Message-ID: <48159DC7.3020508@pressure.to> Hi Lucas Levin wrote: > I'm having some trouble allowing the user to edit a multi-column > listctrl. I can do the first column fine, simply by calling > ListCtrl::edit_label in the activate event, but it seems impossible to > do this for the other columns for two reasons. 1, the activate event > doesn't allow you to get the column, and 2, edit_label onl;y works for > the first column. > I can't find a reference right now, but I have a feeling that only the first column is editable - I think because not all the native controls support editing of secondary columns. You might look into Wx::Grid, which does support this. Its appearance is highly customisable so you could make it look more like a ListCtrl if you wished. a From alex at pressure.to Tue Apr 29 16:16:17 2008 From: alex at pressure.to (Alex Fenton) Date: Tue, 29 Apr 2008 21:16:17 +0100 Subject: [wxruby-users] follow-up on displaying graphs etc Message-ID: <48178211.5090402@pressure.to> Hi Just a quick follow-up on the recent thread about displaying images eg graphs generated by other libraries such as gnuplot, scruffy, rmagick etc. The upcoming 1.9.6 release of wxRuby will support loading images from arbitrary IO-like objects such as Files, Sockets and StringIO. Hopefully this will be easier and more direct than messing around with writing to and reading from Tempfiles. cheers alex From lists at ruby-forum.com Wed Apr 30 13:59:53 2008 From: lists at ruby-forum.com (Ryan Lewis) Date: Wed, 30 Apr 2008 19:59:53 +0200 Subject: [wxruby-users] MediaCtrl with no parent? Message-ID: Hiyas, I'm trying to make a mediactrl with no parent or with my application as the parent, so it can play music in the background (I'm making a simple alarm app), but I cant seem to get it workin. Any ideas or does it need to have a frame as a parent? -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Wed Apr 30 14:08:39 2008 From: alex at pressure.to (Alex Fenton) Date: Wed, 30 Apr 2008 19:08:39 +0100 Subject: [wxruby-users] MediaCtrl with no parent? In-Reply-To: References: Message-ID: <4818B5A7.7060208@pressure.to> Ryan Lewis wrote: > Hiyas, I'm trying to make a mediactrl with no parent or with my > application as the parent, so it can play music in the background (I'm > making a simple alarm app), but I cant seem to get it workin. Any ideas > or does it need to have a frame as a parent? > Yes. Only descendants of Wx::TopLevelWindow - either Frames or Dialogs - can have no parent. Any other Wx::Window has to have a valid parent. If you want to show no Frame at all, just use Frame#hide. If you want a minimal frame, you could use Wx::MiniFrame or perhaps a shaped frame - there is an example of the latter in bigdemo.rb. alex From alex at pressure.to Wed Apr 30 21:01:46 2008 From: alex at pressure.to (Alex Fenton) Date: Thu, 01 May 2008 02:01:46 +0100 Subject: [wxruby-users] wxRuby 1.9.6 Message-ID: <4819167A.2010808@pressure.to> I'm happy to announce that the latest version of wxRuby is available now from Rubyforge. This release contains many bugfixes, enhancements and a few additional features, and it's a recommended upgrade. == INSTALLATION == The release can be downloaded from: http://rubyforge.org/frs/?group_id=35&release_id=21668 Or installed via rubygems for Windows, Linux and OS X: (sudo) gem install wxruby Note that the upcoming ruby version 1.8.7 is NOT supported (see below) == WHAT'S NEW == This release contained a record number of changes among recent releases; these are detailed in full in the ChangeLog, but highlights include: * New MingW build for Windows (somewhat experimental - see below) * Added AboutDialogInfo and AnimationCtrl GUI classes * Added ToolBar and Animation helper classes * Substantial improvements to Image class such as raw data manipulation and reading to IO * Minor syntax enhancements and additional methods in existing classes * Many fixes to long-standing and newly identified bugs, crashers, and memory leaks * Additions to the samples and documentation == PLATFORMS AND RUBY VERSIONS == A quick note on where wxRuby is going with regards to ruby versions. Firstly, the One-Click Installer on Windows is likely to move over to compiling with MingW (gcc on Windows) instead of the Microsoft toolchain. This is very good news for wxRuby - we're currently relying on old, unsupported and unavailable versions of MSVC. wxRuby under MingW is also significantly faster, and will make it easier for contributors on Windows to work on the core library. However at present a few classes are not available - eg GLCanvas For more information, see: http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/4056d40003e05728/5d4ebedd430dec4a Note that the -mingw build will NOT work with the current OCI - you must use the gem tagged -mswin32 With regard to ruby versions, 1.8.6 is currently the preferred version, although recent 1.8.x releases should work. The emerging 1.9.x releases will be fully supported, although there is a bug in ruby 1.9.0 which currently breaks important functionality in wxRuby. The upcoming ruby 1.8.7 version introduces numerous internal and API changes that are not backwards compatible, and cause a real headache for library maintainers. There are no plans to support this version at present. == BUGS ETC == The bugfixes for this release mean that the bug list on Rubyforge is down to a small list most of which can only be fixed by changes to wxWidgets. So please do report any crashes or wrong behaviour with this release to get the final stable release as good as possible. == THANKS == Thank you very much to everyone who contributed patches, bug reports and code samples to this release. Particular thanks to Mario, who has been the driving force in getting the MingW build flying. cheers alex