Meinrad Recheis
2007-Oct-17 11:46 UTC
[fxruby-users] suggesting a fix for two annoying features
lyle, there are two things that happen regularly when coding fxruby (and tend to confuse newbies): 1) a widget is accidentally initialized with parent==nil which results in an exit without a trace where it happened. annoying. 2) a widget that is initialized as child of a parent that is already created is not displayed if we forget to create it. annoying too. the following hack fixes both problems. i am using it for a long time and it saves me a great amount of debugging time. would you like to add this to fxruby? class Fox::FXWindow def FXWindow.new *args, &block window = allocate raise TypeError.new("parent must not be nil!") unless args[0] window.send(:initialize, *args, &block) window.create if window.parent.created? return window end end cheers, -- henon
Lyle Johnson
2007-Oct-17 19:55 UTC
[fxruby-users] suggesting a fix for two annoying features
On Oct 17, 2007, at 6:46 AM, Meinrad Recheis wrote:> there are two things that happen regularly when coding fxruby (and > tend to confuse newbies): > 1) a widget is accidentally initialized with parent==nil which results > in an exit without a trace where it happened. annoying. > 2) a widget that is initialized as child of a parent that is already > created is not displayed if we forget to create it. annoying too. > > the following hack fixes both problems. i am using it for a long time > and it saves me a great amount of debugging time. would you like to > add this to fxruby?I will add bug reports for these, and they may be added in a future release.