org.eclipse.swt.layout.FormAttachment

Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html

Contributors: IBM Corporation - initial API and implementation Port to the D programming language: Frank Benoit <benoit@tionex.de>

Members

Classes

FormAttachment
class FormAttachment

Instances of this class are used to define the edges of a control within a <code>FormLayout</code>. <p> <code>FormAttachments</code> are set into the top, bottom, left, and right fields of the <code>FormData</code> for a control. For example: <pre> FormData data = new FormData(); data.top = new FormAttachment(0,5); data.bottom = new FormAttachment(100,-5); data.left = new FormAttachment(0,5); data.right = new FormAttachment(100,-5); button.setLayoutData(data); </pre> </p> <p> A <code>FormAttachment</code> defines where to attach the side of a control by using the equation, y = ax + b. The "a" term represents a fraction of the parent composite's width (from the left) or height (from the top). It can be defined using a numerator and denominator, or just a percentage value. If a percentage is used, the denominator is set to 100. The "b" term in the equation represents an offset, in pixels, from the attachment position. For example: <pre> FormAttachment attach = new FormAttachment (20, -5); </pre> specifies that the side to which the <code>FormAttachment</code> object belongs will lie at 20% of the parent composite, minus 5 pixels. </p> <p> Control sides can also be attached to another control. For example: <pre> FormAttachment attach = new FormAttachment (button, 10); </pre> specifies that the side to which the <code>FormAttachment</code> object belongs will lie in the same position as the adjacent side of the <code>button</code> control, plus 10 pixels. The control side can also be attached to the opposite side of the specified control. For example: <pre> FormData data = new FormData (); data.left = new FormAttachment (button, 0, SWT.LEFT); </pre> specifies that the left side of the control will lie in the same position as the left side of the <code>button</code> control. The control can also be attached in a position that will center the control on the specified control. For example: <pre> data.left = new FormAttachment (button, 0, SWT.CENTER); </pre> specifies that the left side of the control will be positioned so that it is centered between the left and right sides of the <code>button</code> control. If the alignment is not specified, the default is to attach to the adjacent side. </p>

Meta