From: "Jacobs, Dee" Date: 2003-08-25T20:54:07+09:00 Subject: Can you help me understand the scope problem that occurs at line 18 in my example below? I initially set the main window icon to yicon at line 9 which works correctly. When I try to set the main window icon to xicon at line 18 after clicking the button, I get "x.rbw:18: [BUG] Segmentation fault". I'm sure this is a misunderstanding on my part as to the scope of theMainWindow. Dee Jacobs 1 require 'fox' 2 include Fox 3 theApp = FXApp.new() 4 puts "-------------------" 5 @xicon = FXPNGIcon.new(theApp, File.open("h:/fxruby/icons/kill.png", "rb").read) 6 @yicon = FXPNGIcon.new(theApp, File.open("h:/fxruby/icons/small.png", "rb").read) 7 @zicon = FXPNGIcon.new(theApp, File.open("h:/fxruby/icons/12x18.png", "rb").read) 8 @theMainWindow = FXMainWindow.new(theApp, "Hello") 9 @theMainWindow.setIcon(@yicon) 10 theButton=FXButton.new(@theMainWindow, "Hello\nWorld!") 11 theButton.setIcon(@zicon) 12 myFont=FXFont.new(theApp,"times",20,FONTWEIGHT_BOLD) 13 theButton.font=myFont 14 theButton.tipText = "Push Me!" 15 theButton.textColor=0x008800 16 theButton.frameStyle = FRAME_RAISED|FRAME_THICKtheButton.iconPosition = ~ICON_AFTER_TEXT&~ICON_BEFORE_TEXT& 17 ~ICON_ABOVE_TEXT&~ICON_BELOW_TEXT theButton.connect(SEL_COMMAND) do |sender, selector, data| 18 @theMainWindow.setIcon(@xicon) 19 sleep 10 20 exit 21 end 22 23 FXTooltip.new(theApp) 24 theApp.create 25 @theMainWindow.show 26 theApp.run > > -------------------------------------------------------------------------- > -------------- > This is a PRIVATE message. If you are not the intended recipient, please > delete without copying and kindly advise us by e-mail of the mistake in > delivery. NOTE: Regardless of content, this e-mail shall not operate to > bind CSC to any order or other contract unless pursuant to explicit > written agreement or government initiative expressly permitting the use of > e-mail for such purpose. > -------------------------------------------------------------------------- > -------------- Are you auto-extracting e-mail addresses? Then uce@ftc.gov and report@fraud.org should be of special interest. ---------------------------------------------------------------------------- ------------