0

How to center a small window in a browser page?

asked 2010-06-03 00:24:00 +0800

davout gravatar image davout
1435 3 18

Are there are any layout tricks I can use to center a window inside a browser page?

The window is set to be 500px wide by 250px height, inside a browser page of variable size.

Here's the ZUL code...

<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"
	xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd">
	<borderlayout width="100%" height="100%">
		<north height="100px"></north>
		<center>
         <window title="Welcome to SKAP" border="normal"
            width="500px" height="250px"
            apply="com.eis.skap.external.action.ExternalActionComposer">
            <grid>
               <columns>
                  <column width="140px" />
                  <column width="*" />
               </columns>
               <rows>
                  <row align="center">
                     <image
                        src="/images/logo/skap_logo_02_small.jpg" />
                     <vbox align="center">
                        <label value="Welcome to SKAP"
                           style="font: bold" />
                        <label
                           value="the organization knowledge centre" />
                     </vbox>
                  </row>
                  <row>
                     <space />
                     <space />
                  </row>
                  <row>
                     <label value="User ID" />
                     <textbox id="loginUserID" cols="20" />
                  </row>
                  <row>
                     <label value="Password" />
                     <textbox id="loginPassword" cols="20"
                        type="password" />
                  </row>
                  <row>
                     <space />
                     <space />
                  </row>
                  <row>
                     <space />
                     <button id="loginSubmit" label="Submit" />
                  </row>
               </rows>
            </grid>
         </window>
		</center>
	</borderlayout>

</zk>


Any ideas?

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2010-06-03 00:31:12 +0800

mjablonski gravatar image mjablonski
1284 3 5
http://www.jease.org/

You have to use a combination of overlapped and position-attribute like here:

<window title="Welcome" border="normal" width="500px" height="250px" position="center" mode="overlapped">
Hello World
</window>

HTH, Maik

link publish delete flag offensive edit

answered 2010-06-03 00:33:03 +0800

davout gravatar image davout
1435 3 18

Found the answer...

	<vbox height="100%" width="100%" pack="center" align="center">
		<div height="100%" width="100%" align="center">
			<window title="SKAP login" border="normal"
				width="500px" height="250px"
				apply="com.eis.skap.external.action.ExternalActionComposer">
				<grid align="left">
					<columns>
						<column width="140px" />
						<column width="*" />
					</columns>
					<rows >
						<row align="center"> 
							<image
								src="/images/logo/skap_logo_02_small.jpg" />
							<vbox align="center">
								<label value="Welcome to SKAP"
									style="font: bold" />
								<label
									value="the organization knowledge centre" />
							</vbox>
						</row>
						<row>
							<space />
							<space />
						</row>
						<row>
							<label value="User ID" />
							<textbox id="loginUserID" cols="20" />
						</row>
						<row>
							<label value="Password" />
							<textbox id="loginPassword" cols="20"
								type="password" />
						</row>
						<row>
							<space />
							<space />
						</row>
						<row>
							<space />
							<button id="loginSubmit" label="Submit" />
						</row>
					</rows>
				</grid>
			</window>
		</div>
	</vbox>

link publish delete flag offensive edit

answered 2010-09-17 07:37:32 +0800

sgilou gravatar image sgilou
48 1

THanks Maik

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: 2010-06-03 00:24:00 +0800

Seen: 2,531 times

Last updated: Sep 17 '10

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