Spec Tabs : how to remove proramatically a tab ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Spec Tabs : how to remove proramatically a tab ?

Glenn Cavarlé
Hi,

I try to use Tabs with Spec and i would like to remove a tab from the TabManagerModel but it doesn't work.
TabManagerModel has a method named #removeTab: which call directly its adapter but the MorphicTabManagerAdapter hasn't the method #removeTab: ...
I looked at the TabManager class and its the same, no method to remove a tab.

A small example I would like to do :
|tab tabMgr|

tab := TabModel new
		label: 'fooTab';
		model: 
			(DynamicComposableModel new 
				layout: SpecLayout composed;
				yourself).

tabMgr := TabManagerModel new
	       	addTab: tab;
		yourself.

DynamicComposableModel new
		assign: tabMgr to: #tabs;
		layout:
			(SpecLayout composed
				add: #tabs;
				yourself);
		openWithSpec.
		
tabMgr removeTab: tab.
"or"
tabMgr removeTabNumber: 1.

The only solution (or rather a hack) i found it's to add an extension like that:
MorphicTabManagerAdapter >> removeTab: aTab
	aTab widget widget delete. 
anyone have a clue to do that nicer?

And other mistery, why the tabBar is removed when the last tab is closed ?
TabBar >> removeTab: aTab
...
	selectionHistory size = 1
		ifTrue: [ ^ self delete ].
...

If someone can enlighten me.

Regards,
Glenn Cavarlé
Reply | Threaded
Open this post in threaded view
|

Re: Spec Tabs : how to remove proramatically a tab ?

stepharo
Hi glenn

We will see what ben will answer but may be this is just that some behavior is missing or
not exercised yet. Feel free to push code that fix your problem.


Stef


On 6/5/14 01:02, Glenn Cavarlé wrote:
Hi,

I try to use Tabs with Spec and i would like to remove a tab from the
TabManagerModel but it doesn't work.
TabManagerModel has a method named #removeTab: which call directly its
adapter but the MorphicTabManagerAdapter hasn't the method #removeTab: ...
I looked at the TabManager class and its the same, no method to remove a
tab.

A small example I would like to do :


The only solution (or rather a hack) i found it's to add an extension like
that:

anyone have a clue to do that nicer?

And other mistery, why the tabBar is removed when the last tab is closed ?


If someone can enlighten me.

Regards,



-----
Glenn Cavarlé
--
View this message in context: http://forum.world.st/Spec-Tabs-how-to-remove-proramatically-a-tab-tp4758004.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Reply | Threaded
Open this post in threaded view
|

Re: Spec Tabs : how to remove proramatically a tab ?

Glenn Cavarlé
Thanks for your reply Stef,

I know that to work around Morphic like Spec does is a hard task.
I doubt that my skill in Spec are high enough to provide great solutions but if reporting problems i encountered may already help, i do ;).

Regards,
Glenn Cavarlé