Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » TabBar. Uninitialized member
TabBar. Uninitialized member [message #19877] Thu, 29 January 2009 05:39 Go to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
In the code below, which is called indirectly from TabBar::TabBar(), sz is not initialized.

bool TabScrollBar::IsScrollable() const
{
	// Note: sz already 'fixed'
	return total > sz.cx && sz.cx > 0;
}


That can be reproduced using DockingExample1. As long as Size() is not initialized by design, it should be initialized explicitly in TabBar::TabBar().


Regards,
Novo
Re: TabBar. Uninitialized member [message #20804 is a reply to message #19877] Thu, 09 April 2009 01:41 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

One more little bug. Happens when all the tabs are closed and after that parent window is being closed. Parent window invokes Accept() for all the children, and TabBar::GetData() is called. Due to one can`t set TabBar::SetCursor(-1) before all it`s tabs are closed, TabBar tries to Get(0) and fails with ASSERT.
There are many ways to correct this. The simplest one is checking if there are any tabs in TabBar before trying to Get anything:

TabBar.h, line 268:
	virtual Value GetData() const			{ return HasCursor() ? Get(active) : Value(); }

change with:
	virtual Value GetData() const			{ return (GetCount() && HasCursor()) ? Get(active) : Value(); }


Re: TabBar. Uninitialized member [message #20822 is a reply to message #20804] Fri, 10 April 2009 18:19 Go to previous messageGo to next message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

A little proposal.
Each tab corresponds to some object. Adding a tab is made with adding some Value to TabBar internal list. Most of time this Value is String, which is drawn inside tab.
So imagine that user`s made something with one of controls associated with current tab. What do I do?
1) First of all, I pass my internal objects Vector to determine which of them corresponds to current tab
2) Do some action

I think it will be better to add tabs with a pair of (Value,Value) (like in DropList). One may hold "title" information (like String) while another will hold some reference info (like index, pointer or event One<MyTabbedClass>).
Re: TabBar. Uninitialized member [message #21444 is a reply to message #20822] Wed, 20 May 2009 15:26 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello all

I fully agree with Mindtraveller

Mindtraveller wrote on Fri, 10 April 2009 18:19

A little proposal.
Each tab corresponds to some object. Adding a tab is made with adding some Value to TabBar internal list. Most of time this Value is String, which is drawn inside tab.
So imagine that user`s made something with one of controls associated with current tab. What do I do?
1) First of all, I pass my internal objects Vector to determine which of them corresponds to current tab
2) Do some action

I think it will be better to add tabs with a pair of (Value,Value) (like in DropList). One may hold "title" information (like String) while another will hold some reference info (like index, pointer or event One<MyTabbedClass>).


I am using TabBar for opening files. To manage them I need full path but I would like to put in tab String only the file name.

Now as far as I know this is not possible so I have to put the full path in the tab String.

Best regards
Koldo


Best regards
Iñaki
Re: TabBar. Uninitialized member [message #21445 is a reply to message #21444] Wed, 20 May 2009 16:56 Go to previous messageGo to next message
mrjt is currently offline  mrjt
Messages: 705
Registered: March 2007
Location: London
Contributor
Quote:

I am using TabBar for opening files. To manage them I need full path but I would like to put in tab String only the file name.

Now as far as I know this is not possible so I have to put the full path in the tab String.


Actually, in the current SVN version what you want to do is pretty easy. You have three choices:
- Use a Display (will only work properly for a top-aligned TabBar, but that is almost all cases)
- Inherit and overload ParseLabel
- Inherit and overload PaintTabData (this is intended for more complex scenarios requiring left/right/bottom alignment support).
I would suggets using a Display, as I would personally like to get rid of ParseLabel. The Bazaar/QuickTabsTest/FileTabs class is an example of using the TabBar to implement TheIde QuickTabs. It also uses tab stacking and used the third method of Paint overloading to display additional stacking info.

Having said all of that, I actually agree with you. Up until now the package has largely been the result of just adding what myself and Unodgs needed on top of his original QuickTabs class without discussion since we didn't know anyone else was using it. Perhaps we should have that discussion now so we can tidy it up some? I'm happy to do some work on it next week (off to the Monacco GP in the meantime Smile), and maybe even write some docs. But I'd like Uno's input before I start since I know he's using the TabBar in an Ide branch at the moment. I'll PM him.

Any other feature requests while we're at it?

Edit: And apologies to Mindtraveller for missing his posts before, the bug has been noted and fixed

[Updated on: Wed, 20 May 2009 17:06]

Report message to a moderator

Re: TabBar. Uninitialized member [message #21446 is a reply to message #21445] Wed, 20 May 2009 17:39 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello mrjt

Thank you for your answer!. I would not like to press you but I like this control Smile .

Well, I have done a new Display. It is not very clean as I do not want to change the Display. I want only to display other text.

One thing: I have done this fix:

TabBar& SetDisplay(const Display &d) 	{ display = &d; Refresh(); return *this; }


The return *this; was not included in the original code.

Waiting for your code...

Best regards
Koldo


Best regards
Iñaki
Re: TabBar. Uninitialized member [message #21447 is a reply to message #19877] Wed, 20 May 2009 22:19 Go to previous message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello mrjt

Finally I have failed using a Display.

More things to add to the Santa letter...: Smile

- An interesting feature would be to add to the "WhenClose" callback the possibility of avoiding the closing of the tab. Now also the tab is visually closed before WhenClose function is called.

- I would ask you to put an example of "grouping" and "stacking" features, as I do not understand them well.

Best regards
Koldo


Best regards
Iñaki
Previous Topic: Cairo
Next Topic: OfficeAutomation documented
Goto Forum:
  


Current Time: Thu Mar 28 13:13:36 CET 2024

Total time taken to generate the page: 0.01057 seconds