From: <kel...@so...> - 2003-08-22 17:08:58
|
Hi everyone, I have a couple of questions: 1) When I use PLACEMENT_MAXIMIZED (e.g., WT_MainWindow.new.show PLACEMENT_MAXIMIZED) the window hides the Windows task bar and the application's title bar is not fully visible. Is this normal? (Note that this isn't what happens when you click on the maximize button in the top right of the app's control box). 2) I'm not sure if this is a bug, but ... I've subclassed FXIconItem (so I can do sorting). If I want to create a new item, I can say MySubClassedFXIconItem.new("string", myBigIcon, myMiniIcon, myObject). The constructor for MySubClassedFXIconItem should be: def initialize(string, bigIcon, miniIcon, object) super(string, bigIcon, miniIcon, object) end but that gives a TypeError ("wrong argument type ... expected Data") However, this works: def initialize(string, bigIcon, miniIcon, object) super(string, bigIcon, miniIcon) self.data = object end so it's not a big deal. But I think the first way is more elegant and so I'm mentioning it. 3) I'm a using a "downArrow" and "upArrow" icon to show the header that's being sorted in my FXIconList. I create the icons (hold a reference in an instance variable: ie, @upArrowIcon = FXICOIcon.new(myApp, File.open("uparrow.ico", "rb").read())) but I don't use them until a user clicks on the header. But when I try to set the icon, I get abnormal program termination WT_App.rb:22: [BUG] Segmentation fault ruby 1.8.0 (2003-08-04) [i386-mswin32] However, if I create the icons and attach them to, say, a menu item, I can now use them when the user clicks on a header (without changing anything else). Is this a GC issue? Or is it that I'm doing something wrong? Any help would be appreciated. Thanks, Karl. |
From: Lyle J. <jl...@cf...> - 2003-08-22 17:38:14
|
kel...@so... wrote: > I have a couple of questions: > 1) When I use PLACEMENT_MAXIMIZED (e.g., WT_MainWindow.new.show > PLACEMENT_MAXIMIZED) the window hides the Windows task bar and the > application's title bar is not fully visible. Is this normal? (Note > that this isn't what happens when you click on the maximize button in > the top right of the app's control box). Will check this in awhile when I can get back to a Windows box... > 2) I'm not sure if this is a bug, but ... I've subclassed FXIconItem > (so I can do sorting). If I want to create a new item, I can say > MySubClassedFXIconItem.new("string", myBigIcon, myMiniIcon, myObject). > The constructor for MySubClassedFXIconItem should be: > def initialize(string, bigIcon, miniIcon, object) > super(string, bigIcon, miniIcon, object) > end > but that gives a TypeError ("wrong argument type ... expected Data") > However, this works: > def initialize(string, bigIcon, miniIcon, object) > super(string, bigIcon, miniIcon) > self.data = object > end > so it's not a big deal. But I think the first way is more elegant and > so I'm mentioning it. This is definitely a bug, and I will add it to the list. Thanks very much for reporting this. > 3) I'm a using a "downArrow" and "upArrow" icon to show the header > that's being sorted in my FXIconList. I create the icons (hold a > reference in an instance variable: ie, @upArrowIcon = > FXICOIcon.new(myApp, File.open("uparrow.ico", "rb").read())) but I don't > use them until a user clicks on the header. But when I try to set the > icon, I get > abnormal program termination > WT_App.rb:22: [BUG] Segmentation fault > ruby 1.8.0 (2003-08-04) [i386-mswin32] > However, if I create the icons and attach them to, say, a menu item, I > can now use them when the user clicks on a header (without changing > anything else). Is this a GC issue? Or is it that I'm doing something > wrong? You probably need to call create() on those icons first. Please see this question from the FAQ: http://fox-toolkit.org/faq.html#ILLEGALICON Hope this helps, Lyle |
From: <kel...@so...> - 2003-08-22 19:40:00
|
Lyle Johnson writes: > kel...@so... wrote: > >> 3) I'm a using a "downArrow" and "upArrow" icon to show the header >> that's being sorted in my FXIconList. I create the icons (hold a >> reference in an instance variable: ie, @upArrowIcon = >> FXICOIcon.new(myApp, File.open("uparrow.ico", "rb").read())) but I don't >> use them until a user clicks on the header. But when I try to set the >> icon, I get >> abnormal program termination >> WT_App.rb:22: [BUG] Segmentation fault >> ruby 1.8.0 (2003-08-04) [i386-mswin32] >> However, if I create the icons and attach them to, say, a menu item, I >> can now use them when the user clicks on a header (without changing >> anything else). Is this a GC issue? Or is it that I'm doing something >> wrong? > > You probably need to call create() on those icons first. Please see this > question from the FAQ: > > http://fox-toolkit.org/faq.html#ILLEGALICON Yup! I've added the line "icon.create if !icon.created?" before I set the icon and it now works as expected. Thanks Lyle! Karl. |
From: Lyle J. <jl...@cf...> - 2003-08-22 19:47:59
|
kel...@so... wrote: > Yup! I've added the line "icon.create if !icon.created?" before I set > the icon and it now works as expected. It is always safe (and cheap) to call FXIcon#create, even if the icon has already been created, so you can drop the "if !icon.created?" part if you wish. As an aside, one of the things I love about Ruby's expressiveness is that you could just as well have written that line: icon.create unless icon.created? Sometimes I think 'unless' is one of my favorite Ruby keywords ;) Cheers, Lyle |