CookSwt Reference: Layout Tags


 

 

Support This Project

 

stats counter

 

Logo SourceForge.net Logo IntelliJ IDEA

Layouts


filllayout

Class: org.eclipse.swt.layout.FillLayout

For FormLayout, it is necessary first create all the widgets that are inside the composite, then create reference the widgets using idref in the FormAttachment and FormData constraints.

Example:

<composite>
	<filllayout type="HORIZONTAL" spacing="5" marginheight="5" marginwidth="5">
		<button text="1">
		<button text="2">
		<button text="3">
		<button text="4">
	</filllayout>
</composite>

formlayout

Class: org.eclipse.swt.layout.FormLayout

Example:

<composite>
	<formlayout>
		<label id="button_1" text="this is"/>
		<!-- SWT Text is renamed to textarea tag to avoid a conflict with common text tags -->
		<textarea id="button_2" text="for gui builders only" style="READ_ONLY | BORDER"/>
		<textarea id="button_3" text="extra extra long long long .......... field" style="READ_ONLY | BORDER"/>

		<!-- FormLayout is the like SpringLayout, only slightly easier to use, but
			 somewhat less control -->
		<formdata>
			<formattachment setas="left" numerator="0" offset="5"/>
			<formattachment setas="right" numerator="25" offset="0"/>
			<idref ctor="button_1"/>
		</formdata>

		<formdata>
			<formattachment setas="left" offset="5">
				<idref ctor="button_1"/>
			</formattachment>
			<formattachment setas="right" numerator="100" offset="-5"/>
			<idref ctor="button_2"/>
		</formdata>

		<formdata>
			<formattachment setas="top" offset="5">
				<idref ctor="button_2"/>
			</formattachment>
			<formattachment setas="bottom" numerator="100" offset="-5"/>
			<formattachment setas="right" numerator="100" offset="-5"/>
			<formattachment setas="left" numerator="0" offset="5"/>
			<idref ctor="button_3"/>
		</formdata>

	</formlayout>
</composite>

gridlayout

Class: org.eclipse.swt.layout.GridLayout

Example:

<composite>
	<gridlayout numcolumns="2" horizontalspacing="5" verticalspacing="5" marginheight="5" marginwidth="5">
		<griddata grabexcesshorizontalspace="true" horizontalalignment="BEGINNING">
			<button text="BEGINNING"/>
		</griddata>
		<griddata grabexcesshorizontalspace="true" horizontalalignment="CENTER">
			<button text="CENTER"/>
		</griddata>
		<griddata grabexcesshorizontalspace="true" horizontalalignment="END">
			<button text="END"/>
		</griddata>
		<griddata grabexcesshorizontalspace="true" horizontalalignment="FILL">
			<button text="FILL"/>
		</griddata>
		<griddata style="VERTICAL_ALIGN_FILL | HORIZONTAL_ALIGN_CENTER" horizontalspan="2">
			<button text="VERTICAL_ALIGN_FILL | HORIZONTAL_ALIGN_CENTER horizontalspan=2"/>
		</griddata>
		<griddata style="FILL_BOTH">
			<button text="FILL_BOTH"/>
		</griddata>
		<griddata style="FILL_BOTH">
			<button text="FILL_BOTH"/>
		</griddata>
	</gridlayout>
</composite>

rowlayout

Class: org.eclipse.swt.layout.RowLayout

The RowData constraint is optional.

Example:

<composite>
	<rowlayout type="HORIZONTAL" spacing="5" marginheight="5" marginwidth="5">
		<rowdata width="50" height="50">
			<button text="1"/>
		</rowdata>
		<button text="2"/>
		<button text="3"/>
		<button text="4"/>
	</rowlayout>
</composite>

(c) Copyright 2004-2007 Heng Yuan. All rights reserved.

Valid XHTML 1.0! Valid CSS!