# Wx::Notebook tabs, bug reports on

**URL:** <https://www.ruby-forum.com/t/wx-notebook-tabs-bug-reports-on/119665>\
**Category:** wxRuby\
**Created:** [November 9, 2007, 1:03am UTC](https://www.ruby-forum.com/t/wx-notebook-tabs-bug-reports-on/119665 "2007-11-09T01:03:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [November 9, 2007, 1:03am UTC](https://www.ruby-forum.com/t/wx-notebook-tabs-bug-reports-on/119665/1 "2007-11-09T01:03:22Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [November 9, 2007, 5:38pm UTC](https://www.ruby-forum.com/t/wx-notebook-tabs-bug-reports-on/119665/2 "2007-11-09T17:38:43Z")

</div>

> > 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

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [November 9, 2007, 12:47pm UTC](https://www.ruby-forum.com/t/wx-notebook-tabs-bug-reports-on/119665/3 "2007-11-09T12:47:35Z")

</div>

removed\_email\_address@domain.invalid 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:

> **[Microsoft Learn: Build skills that open doors in your career](https://learn.microsoft.com/en-us/)**
>
> Gain technical skills through documentation and training, earn certifications and connect with the community

> 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

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [November 11, 2007, 2:44pm UTC](https://www.ruby-forum.com/t/wx-notebook-tabs-bug-reports-on/119665/4 "2007-11-11T14:44:06Z")

</div>

Alex wrote:

> Note that current Windows UI guidelines discourage the use of icons in  
> tabs:  
> [Microsoft Learn: Build skills that open doors in your career](http://msdn2.microsoft.com/en-us/library/aa511493.aspx)

This 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 TabControl

If 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

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [November 20, 2007, 11:53am UTC](https://www.ruby-forum.com/t/wx-notebook-tabs-bug-reports-on/119665/5 "2007-11-20T11:53:09Z")

</div>

Hi

removed\_email\_address@domain.invalid wrote:

> Here’s my test program  
> Thanks 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

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [November 9, 2007, 6:24pm UTC](https://www.ruby-forum.com/t/wx-notebook-tabs-bug-reports-on/119665/6 "2007-11-09T18:24:21Z")

</div>

removed\_email\_address@domain.invalid 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 S.

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [November 21, 2007, 1:23am UTC](https://www.ruby-forum.com/t/wx-notebook-tabs-bug-reports-on/119665/7 "2007-11-21T01:23:26Z")

</div>

> … but in the meantime holding a reference to the image list as an  
> instance variable of your Notebook should provide a workaround.

That seems to do the trick, thanks!
