Hi! I discovered WxRuby2 and WxSugar a short while ago (1.9.1) and I really like its professional look and the platform independance. But especially the simplification and ''rubyfication'' that you already achieved and are planning for 1.9.2 (event handlers) is funstuff! Thanks a lot! And with Ruby 1.9/2 the keyword constructors will be even nicer with the new hash syntax: From http://eigenclass.org/hiki/Changes+in+Ruby+1.9#l6 New literal hash syntax [Ruby2] {a: "foo"} # => {:a=>"foo"} So we gain: TreeCtrl.new(parent, :pos => [5, 25], :size => [100, 300] ) TreeCtrl.new(parent, pos: [5, 25], size: [100, 300] ) Aside from the earned praise, I found a glitch in samples/minimal/minimal.rb: - # PNG is a good choice for cross-platofrm icons + # PNG is a good choice for cross-platform icons icon_file = File.join( File.dirname(__FILE__), ''mondrian.png'') - self.icon = Wx::Icon.new(icon_file) + self.icon = Wx::Icon.new(icon_file, Wx::BITMAP_TYPE_PNG) Without Wx::BITMAP_TYPE_PNG it does not recognize the icon on my system: WinXP, ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32], gem: wxruby-1.9.1-i386-mswin32 How about to assume Wx::BITMAP_TYPE_ANY if none given? Again thanks a lot for your work! Regards, Dirk
Dirk Traulsen wrote:> <snip> > Aside from the earned praise, I found a glitch in > samples/minimal/minimal.rb: > - # PNG is a good choice for cross-platofrm icons > + # PNG is a good choice for cross-platform icons > icon_file = File.join( File.dirname(__FILE__), ''mondrian.png'') > - self.icon = Wx::Icon.new(icon_file) > + self.icon = Wx::Icon.new(icon_file, Wx::BITMAP_TYPE_PNG) > > Without Wx::BITMAP_TYPE_PNG it does not recognize the icon on my > system: > WinXP, > ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32], > gem: wxruby-1.9.1-i386-mswin32 > > How about to assume Wx::BITMAP_TYPE_ANY if none given? > > > Again thanks a lot for your work! > > Regards, > Dirk >Hey Dirk, Happy to hear your enjoying wxRuby as much as I have, since I''ve discovered it way back in the 0.6.0 phase. It''s taken a lot of work to get it to the 1.9 series all together, and we have a good development team working it over piece by piece. I myself, am not much of a contributor in the way of the core work. I make up some tutorials, working on a Demo right now for one of the tutorial''s I posted to wxRuby''s Wiki, and therefore can''t say to much on this, other then that I have ran into this problem myself from time to time. I believe that Alex will be more then happy to throw this in, as it should be the default for sure. We are planning to re-vamp a lot of the Demos, since a lot of the core API has changed, since their original conception. And I''m going to be paying a close eye on what demos work, and what demos don''t work, so that we can further get these Demos into line with what changes have been made. Thanks for the report, and keep them coming. It is, as of right now, only a few people that are working on the core, so every able hand, and eye out there, is more then welcome. L8ers, Mario Steele
Hi Dirk Dirk Traulsen wrote:> And with Ruby 1.9/2 the keyword constructors will be even nicer with > the new hash syntax: > From http://eigenclass.org/hiki/Changes+in+Ruby+1.9#l6 > New literal hash syntax [Ruby2] > {a: "foo"} # => {:a=>"foo"} > So we gain: > TreeCtrl.new(parent, :pos => [5, 25], :size => [100, 300] ) > TreeCtrl.new(parent, pos: [5, 25], size: [100, 300] ) >Yep, this should be good. That plus the improved performance should make ruby + wxRuby a nice deal for GUI dev.> Aside from the earned praise, I found a glitch in > samples/minimal/minimal.rb: > - # PNG is a good choice for cross-platofrm icons > + # PNG is a good choice for cross-platform icons > >This was something I added, but I was wrong. PNG is not a good choice for cross-platform *Frame* icons. It''s good for other icons (eg in ListCtrl, TreeCtrl) but it seems wxWidgets requires .ico for Windows and .png or .xpm for OS X and Linux. Thanks for the spot. Alex
Am 18 Oct 2007 um 10:05 hat Alex Fenton geschrieben:> Dirk Traulsen wrote: > > Aside from the earned praise, I found a glitch in > > samples/minimal/minimal.rb: > > - # PNG is a good choice for cross-platofrm icons > > + # PNG is a good choice for cross-platform icons > > > > > This was something I added, but I was wrong. PNG is not a good choice > for cross-platform *Frame* icons. It''s good for other icons (eg in > ListCtrl, TreeCtrl) but it seems wxWidgets requires .ico for Windows > and .png or .xpm for OS X and Linux.But it is ok, you just need to tell it so: - self.icon = Wx::Icon.new(icon_file) + self.icon = Wx::Icon.new(icon_file, Wx::BITMAP_TYPE_PNG) Then .png icons work on my system: WinXP, ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32], gem: wxruby-1.9.1-i386-mswin32 And self.icon = Wx::Icon.new(icon_file, Wx::BITMAP_TYPE_ANY) does also work. Dirk
Dirk Traulsen wrote:>> This was something I added, but I was wrong. PNG is not a good choice >> for cross-platform *Frame* icons. It''s good for other icons (eg in >> ListCtrl, TreeCtrl) but it seems wxWidgets requires .ico for Windows >> and .png or .xpm for OS X and Linux. >> > > But it is ok, you just need to tell it so: > > - self.icon = Wx::Icon.new(icon_file) > + self.icon = Wx::Icon.new(icon_file, Wx::BITMAP_TYPE_PNG) > > Then .png icons work on my system: > WinXP, ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32], >Sorry, I read your first message too quickly, and the wxWidgets docs seemed to suggest that PNG wouldn''t work for a Frame icon. If someone has NT or 2000 to test that PNG icons work there too, I''d be interested to know. cheers alex
2007/10/21, Alex Fenton <alex at pressure.to>:> Dirk Traulsen wrote: > >> This was something I added, but I was wrong. PNG is not a good choice > >> for cross-platform *Frame* icons. It''s good for other icons (eg in > >> ListCtrl, TreeCtrl) but it seems wxWidgets requires .ico for Windows > >> and .png or .xpm for OS X and Linux. > >> > > > > But it is ok, you just need to tell it so: > > > > - self.icon = Wx::Icon.new(icon_file) > > + self.icon = Wx::Icon.new(icon_file, Wx::BITMAP_TYPE_PNG) > > > > Then .png icons work on my system: > > WinXP, ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32], > > > Sorry, I read your first message too quickly, and the wxWidgets docs > seemed to suggest that PNG wouldn''t work for a Frame icon. If someone > has NT or 2000 to test that PNG icons work there too, I''d be interested > to know.Alex, Dirk is right for PNG support. I''ve tested on Windows 2000 and XPM, PNG and ICO are all supported for a frame BUT you MUST specify the type Wx::BITMAP_TYPE_XPM, Wx::BITMAP_TYPE_PNG and Wx::BITMAP_TYPE_ICO respectively in the Wx::Icon.new call. If you specify the type Wx::BITMAP_TYPE_ANY, it also works so this is definitively the best choice. So I agree with Dirk for assuming that Wx::BITMAP_TYPE_ANY should be used if no type is specified. Cheers. Chauk-Mean.
Chauk-Mean P wrote:> I''ve tested on Windows 2000 and XPM, PNG and ICO are all supported for > a frame BUT you MUST specify the type Wx::BITMAP_TYPE_XPM, > Wx::BITMAP_TYPE_PNG and Wx::BITMAP_TYPE_ICO respectively in the > Wx::Icon.new call. >OK, I''ve patched the minimal sample so it uses PNG only with Wx::BITMAP_TYPE_PNG; also updated the docs.> If you specify the type Wx::BITMAP_TYPE_ANY, it also works so this is > definitively the best choice. > > So I agree with Dirk for assuming that Wx::BITMAP_TYPE_ANY should be > used if no type is specified. >The current behaviour is to assume ICO on Windows, ICON_RESOURCE on OS X and XPM on Linux/GTK. This comes from the class definitions in the Wx headers. It sounds like assuming BITMAP_TYPE_ANY might be a more useful default, but I''d like to have a look in the Wx sources to see how this works. The Wx docs seem a bit out of line with the current implementation. Thanks again, Chauk-Mean & Dirk Alex