|
Re: Control positions are wrong ? [message #845796 is a reply to message #845695] |
Sun, 15 April 2012 12:33 |
Rüdiger Herrmann Messages: 335 Registered: July 2009 |
Senior Member |
|
|
Nicola,
SWT/RWT has the concept of a client area. The client area of a Composite
is a rectangle that describes the area within which other controls may
be placed. Use getClinentArea() to position controls inside a composite.
For example:
Rectangle clientArea = parent.getClientArea();
control.setBounds( clientArea.x, clientArea.y, 200,50 );
However, the recommended way to position widgets in SWT is to use layouts.
HTH
Rüdiger
On 15.04.2012 12:11, Nicola Zanaga wrote:
> If i create a shell and a control on position (0,0) the control is over
> the shell bar.
>
> Eclispe 4.2 with RAP 1.5M6
>
>
> Display display = new Display ();
> Shell shell = new Shell(display);
> shell.setSize(600,300);
>
> Text t = new Text(shell, SWT.BORDER);
> t.setBounds( 0, 0, 200,50 );
> t.setText("sample");
> t.setBackground( display.getSystemColor(SWT.COLOR_RED) );
> shell.open ();
> while (!shell.isDisposed ()) {
> if (!display.readAndDispatch ()) display.sleep ();
> }
> display.dispose ();
--
Rüdiger Herrmann
http://codeaffine.com
|
|
|
|
Re: Control positions are wrong ? [message #846694 is a reply to message #845835] |
Mon, 16 April 2012 08:54 |
Rüdiger Herrmann Messages: 335 Registered: July 2009 |
Senior Member |
|
|
On 15.04.2012 15:17, Nicola Zanaga wrote:
> thanks for the quick reply.
> I know the client area, but in SWT Shell doesn't consider the shell BAR
> and position (0,0) will not draw in the shell bar.
This is only true for certain platforms and widgets.
From the "SWT book", chapter 4.2 [1]:
"Very often, the location of the client area within the control is (0,
0), but this is not always the case."
>
> For compability, I think RAP should must do the same
Regarding the client area, RAP is 100 percent compatible with SWT.
--
Rüdiger Herrmann
http://codeaffine.com
[1] http://books.google.de/books/about/SWT.html?id=Z9RQAAAAMAAJ&redir_esc=y
|
|
|
|
Powered by
FUDForum. Page generated in 0.02768 seconds