[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools] Re: Scrollable panes for Wizard Pages

Thanks : )  I am going to give this a try!  I thought I was using it right
but I must not have been.

matt




Veronika Irvine wrote:

> This is a multi-part message in MIME format.

> ------=_NextPart_000_0075_01C13C30.D4545D40
> Content-Type: text/plain;
> 	charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable

> Are you using ScrolledComposite correctly?

> Here are some tips:

> /**
> * A ScrolledComposite provides scrollbars and will scroll its content =
> when the user
> * uses the scrollbars.
> *
> *
> * <p>There are two ways to use the ScrolledComposite:
> *=20
> * <p>
> * 1) Set the size of the control that is being scrolled and the =
> ScrolledComposite=20
> * will show scrollbars when the contained control can not be fully seen.
> *=20
> * <code><pre>
> * public static void main (String [] args) {
> *     Display display =3D new Display ();
> *     Color red =3D display.getSystemColor(SWT.COLOR_RED);
> *     Shell shell =3D new Shell (display);
> *     shell.setLayout(new FillLayout());
> *     ScrolledComposite sc =3D new ScrolledComposite(shell, SWT.H_SCROLL =
> | SWT.V_SCROLL);
> *     Composite c =3D new Composite(sc, SWT.NONE);
> *     c.setBackground(red);
> *     sc.setContent(c);
> *     GridLayout layout =3D new GridLayout();
> *     layout.numColumns =3D 5;
> *     c.setLayout(layout);
> *     for (int i =3D 0; i < 10; i++) {
> *         Button b1 =3D new Button(c, SWT.PUSH);
> *         b1.setText("button "+i);
> *     }
> *     Point pt =3D c.computeSize(SWT.DEFAULT, SWT.DEFAULT);
> *     c.setSize(pt);
> *     shell.open ();
> *     while (!shell.isDisposed ()) {
> *         if (!display.readAndDispatch ()) display.sleep ();
> *     }
> *     display.dispose ();
> * }
> * </pre></code>
> *=20
> * 2) The second way imitates the way a browser would work. Set the =
> minimum size of
> * the control and the ScrolledComposite will show scroll bars if the =
> visible area is=20
> * less than the minimum size of the control and it will expand the size =
> of the control=20
> * if the visible area is greater than the minimum size. This requires =
> invoking=20
> * both setMinWidth(), setMinHeight() and setExpandHorizontal(), =
> setExpandVertical().
> *=20
> * <code><pre>
> * public static void main (String [] args) {
> *     Display display =3D new Display ();
> *     Color red =3D display.getSystemColor(SWT.COLOR_RED);
> *     Shell shell =3D new Shell (display);
> *     shell.setLayout(new FillLayout());
> *     ScrolledComposite sc =3D new ScrolledComposite(shell, SWT.H_SCROLL =
> | SWT.V_SCROLL);
> *     Composite c =3D new Composite(sc, SWT.NONE);
> *     c.setBackground(red);
> *     sc.setContent(c);
> *     GridLayout layout =3D new GridLayout();
> *     layout.numColumns =3D 5;
> *     c.setLayout(layout);
> *     for (int i =3D 0; i < 10; i++) {
> *         Button b1 =3D new Button(c, SWT.PUSH);
> *         b1.setText("button "+i);
> *     }
> *     Point pt =3D c.computeSize(SWT.DEFAULT, SWT.DEFAULT);
> *     sc.setExpandHorizontal(true);
> *     sc.setExpandVertical(true);
> *     sc.setMinWidth(pt.x);
> *     sc.setMinHeight(pt.y);
> *     shell.open ();
> *     while (!shell.isDisposed ()) {
> *         if (!display.readAndDispatch ()) display.sleep ();
> *     }
> *     display.dispose ();
> * }
> * </pre></code>
> *=20
> * <dl>
> * <dt><b>Styles:</b><dd>H_SCROLL, V_SCROLL
> * </dl>
> */

> ------=_NextPart_000_0075_01C13C30.D4545D40
> Content-Type: text/html;
> 	charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable

> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META http-equiv=3DContent-Type content=3D"text/html; =
> charset=3Diso-8859-1">
> <META content=3D"MSHTML 5.50.4522.1800" name=3DGENERATOR>
> <STYLE></STYLE>
> </HEAD>
> <BODY>
> <DIV><FONT face=3DArial size=3D2>Are you using ScrolledComposite=20
> correctly?</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2></FONT> </DIV>
> <DIV><FONT face=3DArial size=3D2>Here are some tips:</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2></FONT> </DIV>
> <DIV><FONT face=3DArial size=3D2>/**</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* A ScrolledComposite provides =
> scrollbars and will=20
> scroll its content when the user</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* uses the scrollbars.</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* <p>There are two ways to use =
> the=20
> ScrolledComposite:</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* </FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* <p></FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* 1) Set the size of the control that =
> is being=20
> scrolled and the ScrolledComposite </FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* will show scrollbars when the =
> contained control=20
> can not be fully seen.</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* </FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* <code><pre></FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* public static void main (String [] =
> args)=20
> {</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     Display display =
> =3D new Display=20
> ();</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     Color red =3D=20
> display.getSystemColor(SWT.COLOR_RED);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     Shell shell =3D =
> new Shell=20
> (display);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     =
> shell.setLayout(new=20
> FillLayout());</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     ScrolledComposite =
> sc =3D new=20
> ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     Composite c =3D =
> new=20
> Composite(sc, SWT.NONE);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*    =20
> c.setBackground(red);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     =
> sc.setContent(c);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     GridLayout layout =
> =3D new=20
> GridLayout();</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     layout.numColumns =
> =3D=20
> 5;</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*    =20
> c.setLayout(layout);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     for (int i =3D 0; =
> i < 10;=20
> i++) {</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*         =
> Button b1 =3D=20
> new Button(c, SWT.PUSH);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*         =

> b1.setText("button "+i);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     }</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     Point pt =3D=20
> c.computeSize(SWT.DEFAULT, SWT.DEFAULT);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     =
> c.setSize(pt);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     shell.open =
> ();</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     while =
> (!shell.isDisposed ())=20
> {</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*         =
> if=20
> (!display.readAndDispatch ()) display.sleep ();</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     }</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     display.dispose=20
> ();</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* }</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* =
> </pre></code></FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* </FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* 2) The second way imitates the way a =
> browser=20
> would work. Set the minimum size of</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* the control and the ScrolledComposite =
> will show=20
> scroll bars if the visible area is </FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* less than the minimum size of the =
> control and it=20
> will expand the size of the control </FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* if the visible area is greater than =
> the minimum=20
> size. This requires invoking </FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* both setMinWidth(), setMinHeight() =
> and=20
> setExpandHorizontal(), setExpandVertical().</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* </FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* <code><pre></FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* public static void main (String [] =
> args)=20
> {</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     Display display =
> =3D new Display=20
> ();</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     Color red =3D=20
> display.getSystemColor(SWT.COLOR_RED);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     Shell shell =3D =
> new Shell=20
> (display);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     =
> shell.setLayout(new=20
> FillLayout());</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     ScrolledComposite =
> sc =3D new=20
> ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     Composite c =3D =
> new=20
> Composite(sc, SWT.NONE);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*    =20
> c.setBackground(red);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     =
> sc.setContent(c);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     GridLayout layout =
> =3D new=20
> GridLayout();</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     layout.numColumns =
> =3D=20
> 5;</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*    =20
> c.setLayout(layout);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     for (int i =3D 0; =
> i < 10;=20
> i++) {</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*         =
> Button b1 =3D=20
> new Button(c, SWT.PUSH);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*         =

> b1.setText("button "+i);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     }</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     Point pt =3D=20
> c.computeSize(SWT.DEFAULT, SWT.DEFAULT);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*    =20
> sc.setExpandHorizontal(true);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*    =20
> sc.setExpandVertical(true);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*    =20
> sc.setMinWidth(pt.x);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*    =20
> sc.setMinHeight(pt.y);</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     shell.open =
> ();</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     while =
> (!shell.isDisposed ())=20
> {</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*         =
> if=20
> (!display.readAndDispatch ()) display.sleep ();</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     }</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*     display.dispose=20
> ();</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* }</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* =
> </pre></code></FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* </FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* <dl></FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*=20
> <dt><b>Styles:</b><dd>H_SCROLL, =
> V_SCROLL</FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>* </dl></FONT></DIV>
> <DIV><FONT face=3DArial size=3D2>*/</FONT></DIV></BODY></HTML>

> ------=_NextPart_000_0075_01C13C30.D4545D40--