Sorry, bad cut and paste job.

···

-----Original Message-----
From: Jacobs, Dee
Sent: Monday, August 25, 2003 7:54 AM
To: ruby-talk ML
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 19 after clicking
the button,
I get “x.rbw:19: [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_THICK
17 theButton.iconPosition =~ICON_AFTER_TEXT&~ICON_BEFORE_TEXT&
18 ~ICON_ABOVE_TEXT&~ICON_BELOW_TEXT
19 theButton.connect(SEL_COMMAND) do|sender, selector, data|
19 @theMainWindow.setIcon(@xicon)
20 sleep 10
21 exit
22 end
23
24 FXTooltip.new(theApp)
25 theApp.create
26 @theMainWindow.show
27 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.


Jacobs, Dee wrote:

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 19 after clicking
the button,
I get “x.rbw:19: [BUG] Segmentation fault”.

I’m sure this is a misunderstanding on my part as to the scope of
theMainWindow.

Works ok for me, after I changed the paths to the icons to find them on
my system. I’m running linux, and you appear to be running windows,
though. I don’t think it’s a scope problem. Maybe a windows specific bug?