Reputation: 554
I'm designing an application and I want to set a space on the side. My problem now is, I'm using the FormLayout, and the FormAttachment can only define the percentage of the layout; so whenever the editor get wider(i have scrolledComposite in the background), the side space gets wider too, in which I hope it can remain as a same size. Does anyone has idea about how to solve this problem? thanks in advanced.
FormData data = new FormData();
data.left = new FormAttachment(5);
data.top = new FormAttachment(5);
data.right = new FormAttachment(95);
Label1.setLayoutData(data);
Upvotes: 0
Views: 56
Reputation: 111142
You can specify an offset
value on the FormAttachment
to specify the number of pixels to offset the attachment, so:
data.left = new FormAttachment(0, 50);
data.right = new FormAttachment(100, -50);
positions at the left and right with a fixed 50 pixel offset.
Upvotes: 1