On my windows build, I just noticed that the background of my
TextCtrl''s
is grey by default, and when I try to set the default style I get the error:
TestTextCtrl.rb:15:in `set_default_style'': undefined method `''
for
#<Wxruby2::TextCtrl:0x360a0c4> (NoMethodError)
from TestTextCtrl.rb:15:in `initialize''
from TestTextCtrl.rb:24:in `on_init''
from TestTextCtrl.rb:30
Using the following (probably overly verbose) program:
require ''wx''
include Wx
class MyFrame < Frame
def initialize(title)
super(nil, -1, title)
@top_sizer = BoxSizer.new( Wx::VERTICAL )
@panel = Panel.new(self)
@panel.set_auto_layout(true)
@panel.set_sizer(@top_sizer)
@test_text_ctrl = TextCtrl.new(@panel, -1, "")
style = @test_text_ctrl.get_default_style()
style.set_background_colour(WHITE)
@test_text_ctrl.set_default_style(style)
@top_sizer.add(@test_text_ctrl, 0, Wx::EXPAND | Wx::RIGHT, 20)
end
end
class MyApp < App
def on_init()
frame = MyFrame.new("TextCtrl Test")
frame.show(TRUE)
end
end
$g_app = MyApp.new
$g_app.main_loop()
This is in spite of the fact that "set_default_style" appears to be
correctly generated when I run rake.
Any ideas on what might be causing this and/or how to fix it?
--Mark Ping
This appears to be another SWIG bug. SWIG is somehow generating calls
to empty names, as evidenced from SetStyle in TextCtrl.cpp:
result = rb_funcall(swig_get_self(), rb_intern(""),
3,obj0,obj1,obj2);
This is happening a good bit. I''ll see if I can find out why.
Roy
Mark Ping wrote:> On my windows build, I just noticed that the background of my
TextCtrl''s
> is grey by default, and when I try to set the default style I get the
error:
>
> TestTextCtrl.rb:15:in `set_default_style'': undefined method
`'' for
> #<Wxruby2::TextCtrl:0x360a0c4> (NoMethodError)
> from TestTextCtrl.rb:15:in `initialize''
> from TestTextCtrl.rb:24:in `on_init''
> from TestTextCtrl.rb:30
>
>
> Using the following (probably overly verbose) program:
>
> require ''wx''
> include Wx
>
> class MyFrame < Frame
> def initialize(title)
> super(nil, -1, title)
> @top_sizer = BoxSizer.new( Wx::VERTICAL )
> @panel = Panel.new(self)
> @panel.set_auto_layout(true)
> @panel.set_sizer(@top_sizer)
> @test_text_ctrl = TextCtrl.new(@panel, -1, "")
>
> style = @test_text_ctrl.get_default_style()
> style.set_background_colour(WHITE)
> @test_text_ctrl.set_default_style(style)
>
>
> @top_sizer.add(@test_text_ctrl, 0, Wx::EXPAND | Wx::RIGHT, 20)
> end
> end
>
> class MyApp < App
> def on_init()
> frame = MyFrame.new("TextCtrl Test")
> frame.show(TRUE)
> end
> end
>
> $g_app = MyApp.new
> $g_app.main_loop()
>
> This is in spite of the fact that "set_default_style" appears to
be
> correctly generated when I run rake.
>
> Any ideas on what might be causing this and/or how to fix it?
>
> --Mark Ping
>
> _______________________________________________
> wxruby-users mailing list
> wxruby-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/wxruby-users
>
>
>
>
This is a bug in SWIG, but also a bug in our header files. SWIG does warn us that we have multiple definitions of the same function. I will produce some patch files for the affected headers. The bottom line is that SetStyle is defined twice in wxTextCtrl.h. So are HitTest and SetMaxLength. Roy Roy Sutton wrote:> This appears to be another SWIG bug. SWIG is somehow generating calls > to empty names, as evidenced from SetStyle in TextCtrl.cpp: > > result = rb_funcall(swig_get_self(), rb_intern(""), 3,obj0,obj1,obj2); > > This is happening a good bit. I''ll see if I can find out why. > > Roy > > Mark Ping wrote: > >> On my windows build, I just noticed that the background of my TextCtrl''s >> is grey by default, and when I try to set the default style I get the error: >> >> TestTextCtrl.rb:15:in `set_default_style'': undefined method `'' for >> #<Wxruby2::TextCtrl:0x360a0c4> (NoMethodError) >> from TestTextCtrl.rb:15:in `initialize'' >> from TestTextCtrl.rb:24:in `on_init'' >> from TestTextCtrl.rb:30 >> >> >> Using the following (probably overly verbose) program: >> >> require ''wx'' >> include Wx >> >> class MyFrame < Frame >> def initialize(title) >> super(nil, -1, title) >> @top_sizer = BoxSizer.new( Wx::VERTICAL ) >> @panel = Panel.new(self) >> @panel.set_auto_layout(true) >> @panel.set_sizer(@top_sizer) >> @test_text_ctrl = TextCtrl.new(@panel, -1, "") >> >> style = @test_text_ctrl.get_default_style() >> style.set_background_colour(WHITE) >> @test_text_ctrl.set_default_style(style) >> >> >> @top_sizer.add(@test_text_ctrl, 0, Wx::EXPAND | Wx::RIGHT, 20) >> end >> end >> >> class MyApp < App >> def on_init() >> frame = MyFrame.new("TextCtrl Test") >> frame.show(TRUE) >> end >> end >> >> $g_app = MyApp.new >> $g_app.main_loop() >> >> This is in spite of the fact that "set_default_style" appears to be >> correctly generated when I run rake. >> >> Any ideas on what might be causing this and/or how to fix it? >> >> --Mark Ping >> >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users >> >> >> >> >> > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > > > >
On Thu, 2006-08-24 at 15:52 -0400, Roy Sutton wrote:> This is a bug in SWIG, but also a bug in our header files. SWIG does > warn us that we have multiple definitions of the same function. I will > produce some patch files for the affected headers. The bottom line is > that SetStyle is defined twice in wxTextCtrl.h. So are HitTest and > SetMaxLength.True. We should fix this.> > This appears to be another SWIG bug. SWIG is somehow generating calls > > to empty names, as evidenced from SetStyle in TextCtrl.cpp: > > > > result = rb_funcall(swig_get_self(), rb_intern(""), 3,obj0,obj1,obj2); > > > > This is happening a good bit. I''ll see if I can find out why.Also true, although not for set_default_style. In fact, it kind of looks like it is happening for the methods that were mentioned twice in the .h file.> >> On my windows build, I just noticed that the background of my TextCtrl''s > >> is grey by default, and when I try to set the default style I get the error: > >> > >> TestTextCtrl.rb:15:in `set_default_style'': undefined method `'' for > >> #<Wxruby2::TextCtrl:0x360a0c4> (NoMethodError) > >> from TestTextCtrl.rb:15:in `initialize'' > >> from TestTextCtrl.rb:24:in `on_init'' > >> from TestTextCtrl.rb:30For me, with the code now in CVS (which has this afternoon''s patches), the posted sample runs without errors. And the text background is white. But when I change the code to try to set the color to RED, the background remains white. I can call TextCtrl#set_background_colour and it works. Kevin
Roy Sutton
2006-Aug-26 19:56 UTC
[Wxruby-users] TextCtrl Background (was: TreeCtrl background?)
Mark Ping wrote:> On my windows build, I just noticed that the background of my TextCtrl''s > is grey by default, and when I try to set the default style I get the error: > >You know, I just noticed that they were grey as well. They should be the system default and I think it''s been a recent change that caused this. Furthermore, the Dialog demo shows another error besides the grey background. The tab stops aren''t working correctly. Labels shouldn''t be tab stops. Roy
I can confirm that the tab stops and the background color used to work on previous builds. I had an old .so file sitting around and I tried it out. Roy Roy Sutton wrote:> Mark Ping wrote: > >> On my windows build, I just noticed that the background of my TextCtrl''s >> is grey by default, and when I try to set the default style I get the error: >> >> >> > You know, I just noticed that they were grey as well. They should be > the system default and I think it''s been a recent change that caused this. > > Furthermore, the Dialog demo shows another error besides the grey > background. The tab stops aren''t working correctly. Labels shouldn''t > be tab stops. > > Roy > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > > > >