Thank you Alex for the answer to my previous question -- it was exactly what I was looking for! Moving on, I have some bugs to report: I''m using the Wx::Notebook class and it looks to me like Wx::NB_LEFT, Wx::NB_RIGHT, and Wx::NB_BOTTOM are defined incorrectly. To get my tabs to appear on the bottom, for example, I find I have to use Wx::NB_LEFT. Same symptom in samples/bigdemo/WxNotebook.rbw -- the constructor uses Wx::NB_BOTTOM but the tabs appear on the right. Off by 1? I''m also having trouble with images in tabs -- they seem to randomly disappear on resizing. Has anyone else seen this? It''s not hard to repro, but it''s not happening all the time, either. And, now that I am educated about Windows XP style controls and manifest files, I''m noticing that Wx::Notebook tabs seem to ignore them if they''re placed anywhere but at the top. In other words, I get the version 6 style if the tabs are at the top, and the version 5 style if they''re anywhere else. Kind regards, Peralta
peralta at sonic.net wrote:> I''m using the Wx::Notebook class and it looks to me > like Wx::NB_LEFT, Wx::NB_RIGHT, and Wx::NB_BOTTOM are > defined incorrectly. To get my tabs to appear on the > bottom, for example, I find I have to use Wx::NB_LEFT. > Same symptom in samples/bigdemo/WxNotebook.rbw -- the > constructor uses Wx::NB_BOTTOM but the tabs appear on > the right. Off by 1? >Thanks very much for the report. It seems the values of the constants changed in wxWidgets between version 2.6 and 2.8, so when we upgraded to target 2.8 the wxRuby values went out by one. I''ll fix for the next release, but for reference, the correct values are: NB_DEFAULT = 0 NB_TOP = 1 NB_BOTTOM = 2 NB_LEFT = 4 NB_RIGHT = 8> I''m also having trouble with images in tabs -- they > seem to randomly disappear on resizing. Has anyone > else seen this? It''s not hard to repro, but it''s not > happening all the time, either. >I haven''t seen this. Can you reproduce in one of the samples? Note that current Windows UI guidelines discourage the use of icons in tabs: http://msdn2.microsoft.com/en-us/library/aa511493.aspx> And, now that I am educated about Windows XP style > controls and manifest files, I''m noticing that > Wx::Notebook tabs seem to ignore them if they''re > placed anywhere but at the top. In other words, I > get the version 6 style if the tabs are at the top, > and the version 5 style if they''re anywhere else. >I get the same result. I can''t think that I''ve ever seen the XP-style "glow"/rounded tabs other than on the top in an application, and my guess is that those tabs are only available on the top in the Windows XP UI. Note that side/bottom tabs won''t work anyway on OS X. You might have a look into Wx::AuiNotebook (see the aui.rb sample) as an alternative. wxWidgets 2.8 added some other "book" controls (TreeBook, ToolBook) but they aren''t yet available in wxRuby. cheers alex cheers Alex
peralta at sonic.net
2007-Nov-09 16:38 UTC
[wxruby-users] Wx::Notebook tabs, bug reports on...
>> I''m also having trouble with images in tabs -- they >> seem to randomly disappear on resizing. Has anyone >> else seen this? It''s not hard to repro, but it''s not >> happening all the time, either. >> > I haven''t seen this. Can you reproduce in one of the samples?None of the samples use images in tabs, as far as I can see, but I have a small test program that exhibits the problem. I honestly can''t figure out what sequence of resize operations triggers the bug, but all I have to do is resize the window repeatedly, including maximizing and restoring it, and eventually the tab images go away. My environment, FWIW: ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32] wxruby-1.9.0-i386-mswin32 Windows XP Professional 5.1.2600 Here''s my test program: -------------------------------------------------------------- require "wx" include Wx class MyNotebook < Notebook def initialize( parent ) super(parent, -1, Wx::DEFAULT_POSITION, Wx::DEFAULT_SIZE ) il = Wx::ImageList.new(26,18) my_img = il.add( Wx::Bitmap.new( Image.new( "test.png", BITMAP_TYPE_PNG)) ) set_image_list( il ) %w[ Apples Oranges Bananas ].each{ |d| win = Panel.new( self, -1 ) add_page( win, d, false, my_img ) } end end class MyApp < App def on_init frame = Frame.new(nil, -1, "Title") MyNotebook.new( frame ) frame.show() end end MyApp.new.main_loop
peralta at sonic.net wrote:> And, now that I am educated about Windows XP style > controls and manifest files, I''m noticing that > Wx::Notebook tabs seem to ignore them if they''re > placed anywhere but at the top. In other words, I > get the version 6 style if the tabs are at the top, > and the version 5 style if they''re anywhere else. >Hello there Peralta, The thing about the Notebook Tabs on Left, Right and bottom with the version 6 style, Windows naturally does not have this functionality by default. If you go to Windows API, and look at the TabControl, you will find nothing on how to draw the Notebook Tabs on Left, Right or Bottom. What wxWidgets does is draws the default Tab style, for when it''s done on the left, right or bottom of the Notebook control. Other GUI Toolkits do the same thing. So unfortunatly, there no way to get natural Windows XP Styles, with the Tabs being in a different area. L8ers, Mario Steele
peralta at sonic.net
2007-Nov-11 13:43 UTC
[wxruby-users] Wx::Notebook tabs, bug reports on...
Alex wrote:> Note that current Windows UI guidelines discourage the use of icons intabs:> http://msdn2.microsoft.com/en-us/library/aa511493.aspxThis UI guidelines page has been very interesting reading! It recommends using "clearly recognizable icons [in tabs] if there might be insufficient space to display meaningful labels", which is just the use I have in mind.> I can''t think that I''ve ever seen the XP-style > "glow"/rounded tabs other than on the top in an application...On the above-mentioned page there is an example of "correct" use of images in tabs, and the tabs are on the bottom.> You might have a look into Wx::AuiNotebook (see the aui.rb sample) as an > alternative. wxWidgets 2.8 added some other "book" controls (TreeBook, > ToolBook) but they aren''t yet available in wxRuby.Thanks, I''ll take a look. And Mario wrote:> If you go to Windows API, and look at the TabControlIf you get a chance, could you please provide a link to this? I googled around but couldn''t find it. (I am admittedly completely unfamiliar with Windows API documentation. Not that I plan to do any Windows API coding, but it might be educational reading.) Thanks all, Peralta
Hi peralta at sonic.net wrote:> I honestly can''t figure out what sequence of resize operations > triggers the bug, but all I have to do is resize the window > repeatedly, including maximizing and restoring it, and eventually > the tab images go away. > > My environment, FWIW: > ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32] > wxruby-1.9.0-i386-mswin32 > Windows XP Professional 5.1.2600 > > Here''s my test programThanks for the test case - that was very helpful. Having worked with it I''m pretty sure this is down to Ruby''s garbage collection prematurely destroying the ImageList (repeated resizing accumulates Event and Size objects, which eventually triggers GC). wxRuby should protect an assigned image list in this situation. It should be a simple fix for the next wxRuby release with a DISOWN typemap, but in the meantime holding a reference to the image list as an instance variable of your Notebook should provide a workaround. Let me know if this doesn''t seem to help. cheers alex