0

right align buttons as a group inside a layout?

asked 2009-07-15 16:13:42 +0800

davout gravatar image davout
1435 3 18

ow can I set a group of buttons to align to the right side in a layout container?

I've tried...

<hbox align="end">
	<button id="ok" label="OK" />
	<space />
	<button id="apply" label="Apply" />
	<space />
	<button id="clearAll" label="Clear All" />
        <space />
	<button id="close" label="Close" />
	<space />
</hbox>


.... but it doesn't seem to work

Any ideas?

delete flag offensive retag edit

8 Replies

Sort by ยป oldest newest

answered 2009-07-15 16:24:54 +0800

jsanta gravatar image jsanta
24

Hi.
Are you using any layout such as a BorderLayout? That may help.

Another option is to place your button group inside a div:

<div style="text-align: right;">
   <hbox ...>
</div>

link publish delete flag offensive edit

answered 2009-07-15 20:32:47 +0800

terrytornado gravatar image terrytornado flag of Germany
9393 3 7 16
http://www.oxitec.de/


<?xml version="1.0" encoding="UTF-8"?>
<?taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c"?>

<zk xmlns="http://www.zkoss.org/2005/zul"
	xmlns:h="http://www.w3.org/1999/xhtml"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:a="http://www.zkoss.org/2005/zk/annotation"
	xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">


	<window id="window_BranchesDialog"
		title="${c:l('window_BranchesDialog.title')}" border="none"
		use="org.myfirm.webui.branch.BranchDialogCtrl"
		closable="true" width="450px" height="250px">


		<borderlayout id="borderlayoutBranchDialog">
			<north border="none" margins="0,0,0,0">
				<div id="divNorthBranchDialog">

					<toolbar>
						<button id="btnHelp"
							image="/images/icons/light_16x16.gif"
							tooltiptext="${c:l('btnHelp.tooltiptext')}" />
					</toolbar>


					<panel id="panel_Branch"
						title="${c:l('panel_Branch.title')}" style="margin-bottom:10px"
						border="normal" collapsible="true">
						<panelchildren>
							<grid fixedLayout="true"
								style="border:0px">
								<columns>
									<column width="150px" />
									<column width="100%" />
								</columns>
								<rows>
									<row>
										<label id="label_Branch_BraNr"
											value="${c:l('label_Branch_BraNr.value')}" />
										<textbox id="braNr"
											width="100px" />
									</row>
									<row>
										<separator bar="true"></separator>
										<separator bar="true"></separator>
									</row>
									<row>
										<label
											id="label_Branch_BraBezeichnung"
											value="${c:l('label_Branch_BraBezeichnung.value')}" />
										<textbox id="braBezeichnung"
											width="100%" />
									</row>
								</rows>
							</grid>
						</panelchildren>
					</panel>

				</div>
			</north>
			<east border="none"></east>
			<center border="none"></center>
			<west border="none"></west>

			<south border="none" margins="1,0,0,0" size="26px">
				<div id="divSouth" align="right">
					<hbox spacing="3px" style="padding:3px"
						align="end">
						<button id="btnNew" height="20"
							label="${c:l('btnNew.label')}"
							tooltiptext="${c:l('btnNew.tooltiptext')}" />
						<button id="btnEdit" height="20"
							label="${c:l('btnEdit.label')}"
							tooltiptext="${c:l('btnEdit.tooltiptext')}" />
						<button id="btnDelete" height="20"
							label="${c:l('btnDelete.label')}"
							tooltiptext="${c:l('btnDelete.tooltiptext')}" />
						<button id="btnSave" height="20"
							label="${c:l('btnSave.label')}"
							tooltiptext="${c:l('btnSave.tooltiptext')}" />
						<button id="btnClose" height="20"
							label="${c:l('btnClose.label')}"
							tooltiptext="${c:l('btnClose.tooltiptext')}" />
					</hbox>
				</div>
			</south>

		</borderlayout>

	</window>

</zk>

link publish delete flag offensive edit

answered 2009-07-15 21:31:51 +0800

klim gravatar image klim
30

Hbox is a heavy component. Still you can try:

<hbox width="100%" pack="end">
<div>
	<button id="ok" label="OK" />
	<space />
	<button id="apply" label="Apply" />
	<space />
	<button id="clearAll" label="Clear All" />
        <space />
	<button id="close" label="Close" />
	<space />
</div>
</hbox>

or even use another hbox instead of inner div

link publish delete flag offensive edit

answered 2009-08-05 08:24:51 +0800

xmedeko gravatar image xmedeko
1031 1 16
http://xmedeko.blogspot.c...

updated 2009-08-05 08:32:25 +0800

I use

<toolbar style="clear: both;">
		<div style="float: left">
		<button label="Action1" href="calendar/" />
		<button label="Action2" onClick="debug();" />
		</div>
		<div style="float: right;">
		<button id="logout" label="Logout" onClick="logout();"/>
		</div>
</toolbar>

link publish delete flag offensive edit

answered 2009-08-05 08:27:19 +0800

xmedeko gravatar image xmedeko
1031 1 16
http://xmedeko.blogspot.c...

updated 2009-08-05 09:15:49 +0800

Hmm, it works in IE8, but not in FF3 :-(

This works for me in IE and FF as well:

<toolbar width="100%"  >
		<span>
		<button label="Action1" href="calendar/" />
		<space />
		<button label="Action2" />
		</span>
		<span style="position: absolute; right:3px">
		<button id="logout" label="Logout" onClick="logout();"/>
		</span>
</toolbar>

link publish delete flag offensive edit

answered 2010-07-15 05:07:38 +0800

moloch gravatar image moloch
606 1 13

Hello,
and when i use ZK 5? nothing of your solutions works... first i try on FF
Has anyone an idea?

link publish delete flag offensive edit

answered 2010-07-20 17:57:53 +0800

twiegand gravatar image twiegand
1807 3

Why not just use a floating div? Consider:

<div style="float:right;">
	<button id="ok" label="OK" />
	<space spacing="5px" orient="vertical"/>
	<button id="apply" label="Apply" />
	<space spacing="5px" orient="vertical"/>
	<button id="clearAll" label="Clear All" />
	<space spacing="5px" orient="vertical"/>
	<button id="close" label="Close" />
</div>

This works in ZK 5.0.3, FireFox 3.x, Chrome 5.x, IE 7, etc...

Hope this is of value...

Todd

link publish delete flag offensive edit

answered 2010-07-21 01:23:32 +0800

moloch gravatar image moloch
606 1 13

thanks allot twiegand, it works.

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: 2009-07-15 16:13:42 +0800

Seen: 3,227 times

Last updated: Jul 21 '10

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