0

scroll tabpanel

asked 2011-05-19 13:33:12 +0800

airton gravatar image airton
78 1

Hi.

This works on zul:

<tabpanel style="overflow:auto;">

but doesn't work on java:

Tabpanel tp = new Tabpanel();
tp.setStyle("overflow:auto;");

How to get it?

Thanks.

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2011-05-19 20:26:13 +0800

benbai gravatar image benbai
2228 6
http://www.zkoss.org

updated 2011-05-19 20:26:52 +0800

create a new Tabpanel then add to Tabpanels as follows

<zk>
	<zscript>
		import org.zkoss.zul.Tabpanel;
		import org.zkoss.zul.Tabpanels;
		import org.zkoss.zul.Div;
		public void setAuto(Tabpanels tbs) {
			Tabpanel tb1 = new Tabpanel();
			tb1.setStyle("overflow: auto;");
			Div div1 = new Div();
			div1.setStyle("background:#E6D92C");
			div1.setHeight("900px");
			div1.setParent(tb1);
			tb1.setParent(tbs);
		}
	</zscript>
	
	<hbox>
		<tabbox width="250px" height="200px">
			<tabs>
				<tab label="Tab 1" closable="true"/>
			</tabs>
			<tabpanels id="tbs">
				
			</tabpanels>
		</tabbox>
	</hbox>
	<button label="1234" onClick="setAuto(tbs)" />
</zk>

or change style dynamically

<zk>
	<zscript>
		public void setAuto() {
			tb1.setStyle("overflow: auto;");
			tb1.invalidate();
		}
	</zscript>

	<tabbox width="250px" height="200px">
		<tabs>
			<tab label="Tab 1" closable="true"/>
		</tabs>
		<tabpanels>
			<tabpanel id="tb1">This is panel 1
				<div style="background:#E6D92C" width="80px" height="900px"/>
			</tabpanel>
		</tabpanels>
	</tabbox>

	<button label="1234" onClick="setAuto()" />
</zk>

link publish delete flag offensive edit

answered 2011-05-20 08:11:00 +0800

airton gravatar image airton
78 1

I've tested a div in my code (like you've done on your first example) and the tabpanel scrolled. Good!

But I need a file in the tabpanel as shown bellow and so the scroll bar didn't appear. Any hint?

<zk>
	<zscript>
		import org.zkoss.zul.Tabpanel;
		import org.zkoss.zul.Tabpanels;
		import org.zkoss.zul.Div;
		public void setAuto(Tabpanels tbs) {
			Tabpanel tb1 = new Tabpanel();
			tb1.setStyle("overflow: auto;");
			
			/*
			Div div1 = new Div();
			div1.setStyle("background:#E6D92C");
			div1.setHeight("900px");
			div1.setParent(tb1);
			*/
			
	                Window jM = (Window) Executions.createComponents("window1234.zul", tb1, null);
	                jM.doEmbedded();		
			
			tb1.setParent(tbs);
		}
	</zscript>
	
	<hbox>
		<tabbox width="250px" height="200px">
			<tabs>
				<tab label="Tab 1" closable="true"/>
			</tabs>
			<tabpanels id="tbs">
				
			</tabpanels>
		</tabbox>
	</hbox>
	<button label="1234" onClick="setAuto(tbs)" />
</zk>

window1234.zul:

<?page title="window1234" contentType="text/html;charset=UTF-8"?>
<zk>
	<window border="none" width="100%" height="100%">
		
		<label value="window1234" style="color:#66CC33;font-size:20px" />
		<separator/>
		
   		<vbox>
	   		<label value="Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."/>
   		</vbox>
				
	</window>
</zk>

link publish delete flag offensive edit

answered 2011-05-20 08:42:55 +0800

airton gravatar image airton
78 1

I've found the problem: width and height setted to window. Without them the tabpanel scrolls the window1234.zul content.

Thanks a lot for your help.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2011-05-19 13:33:12 +0800

Seen: 590 times

Last updated: May 20 '11

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More