Help with TABS!

[xml]<control id="edit_tabs" name="nifty-tabs"

childLayout="vertical" x="110" y="110" height="200px" width="400px">

<control id="tab_1" name="nifty-tab" caption="tab 1" />

<control id="tab_2" name="nifty-tab" caption="tab 2" />



</control>[/xml]





this code displays the tabs properly, but the problem is, the width of the nifty-tab is relative to the width of nifty-tabs!



so when i run this code, the panel created by nifty-tabs has a width too widened and the nifty-tab which creates the button is not of the width of the panel! i tried to set the width of the nifty-tab but it didnt work.



so need help on how to set the width of the buttons in nifty-tab!

set the panel’s latout to horizontal :roll: .

i did, it didnt work.

after setting it to horizontal in the first control of nifty-tabs, the widtn of the button is gettin lesser, and still extra space is left there!



the problem is still the same.

read the manual.

the thing i want to do is, increase the width of the button of a tab.

read, it doesnt say how to increase the width of the button tab! :frowning:

http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Tutorials

@ojasgosar: It may be useful for you http://sourceforge.net/apps/mediawiki/nifty-gui/index.php?title=Nifty_Standard_Controls_%28Nifty_1.3%29

it aint there, i have gone through that thing like a lotta times, what m talking is about tabs, and specific width of the button tab is not changing with the width attribute! whats the way i can do it?

It this whatcha u talkin bout?



http://sourceforge.net/apps/mediawiki/nifty-gui/nfs/project/n/ni/nifty-gui/f/f5/Standard-controls-tabs.png



It is in the link I gave you.

yea, but the link doesnt mention on how to change the width of the Tab 1(button), are u getting my point?

i m able to get that on ma gui, but i want to change the width of the button, which m unable to!

I don’t know if it’s possible to resize a tab, but and about resizing its panel?Did you already try that?

yea if m resizing the panel, the button is getting re-sized relatively. so that’s not what i want!



i want to individually re-size both button and panel.

Couldu taka print screen?





[xml]<control id=“edit_tabs” name=“nifty-tabs”

childLayout=“horizontal” x=“10” y=“410” height=“500px”

width=“500px” visible=“false”>

<control id=“tab_1” name=“nifty-tab” caption=“tab 1”

width=“50%” />

<control id=“tab_2” name=“nifty-tab” caption=“tab 2” />



</control>[/xml]



do u see the width=“50%” in tab_1 ? it doesnt work at all!







[xml]<control id=“edit_tabs” name=“nifty-tabs”

childLayout=“horizontal” x=“10” y=“410” height=“500px”

width=“1000px” visible=“false”>

<control id=“tab_1” name=“nifty-tab” caption=“tab 1”

width=“50%” />

<control id=“tab_2” name=“nifty-tab” caption=“tab 2” />



</control>[/xml]

@void256?

@glaucomardano said:
@void256?


@ractoc? ;)

I’ve just looked into it and it seems like the tab width is hard coded at the moment:



[java] private void createTabButton(final String tabId, final String buttonCaption) {

Element tabButtonPanel = elmnt.findElementByName("#tab-button-panel");

if (tabButtonPanel.findElementByName(tabId + “-button”) == null) {

new ButtonBuilder(tabId + “-button”) {



{

style(“nifty-button”);

childLayout(ChildLayoutType.Horizontal);

interactOnClick(“switchTab(” + tabId + “)”);

width(percentage(25)); // can’t change that currently from outside I think

height(percentage(100));

label(buttonCaption);

}

}.build(nifty, nifty.getCurrentScreen(), tabButtonPanel);

}

}[/java]

1 Like

Ah yes, I’ve been meaning to fix this to a more flexible method. But then I got sidetracked with work on the TreeBoxControl…

I’ll set about fixing this tonight. There will probably be two new attributes for this: button-width and button-height. Since the general width and height are used for the tabs control as a whole.

1 Like

thanks for looking into it! :slight_smile:



ill wait till its fixed :slight_smile:



thank you! :slight_smile:

i spent one whole day, figuring that out!

cheer’s!