[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.rcp] Re: Forms API

Thanks for effort, too!
I missed the SWT.FLAT flag and now I use the CCombo.

Rene

"Nicole" <nicole_kidding@xxxxxxxxx> schrieb im Newsbeitrag 
news:ck4s2j$46p$1@xxxxxxxxxxxxxx
> From my previous experiences, Combo should not be used in Forms. Use the
> CCombo instead, and use the SWT.FLAT style to give it a flat look. Hope
> this helps.
>
> Regards,
> Nicole
>
> Mike Evans wrote:
>
>> For your border problem, use :
>>    toolkit.paintBordersfor( form.getBody() );
>> The call must be made on the direct parent of the controls.
>> Make sure you include :
>>    setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
>> on any controls not directly created by the toolkit.
>
>> As for the button sizes - they will be the width of the columns but
>> these are not equal unless you explicitly state:
>>    layout.makeColumnsEqualWidth=true;
>> However this will not be very pretty.  Better would be a separate parent
>> composite for the buttons:
>>    Composite buttonsParent = ...
>>    buttonsParent.new GridLayout( numberOfButtons );
>>    Button button1 = ....
>>    button1.setLayoutData( new GridData( 
>> GridData.HORIZONTAL_ALIGN_FILL  ) );
>
>> Hope this helps,
>
>> Mike E.
>
>
>
>
>> Teichgraf wrote:
>> > I have a View and in that I have some controls. I read the article 
>> > from:
>> >
> http://dev.eclipse.org/viewcvs/index.cgi/~checkout~/pde-ui-home/working/EclipseForms/EclipseForms.html
>> >
>> > The problem is, the borders aren't drawn like they should (flat). For 
>> > the
>> > combobox they are drawn 3d. And for the ListViewer.getList() no borders
> are
>> > drawn and even for the TextBox, which I created using the Toolkit no
> borders
>> > are drawn. If I set the flag SWT.BORDER in the Constructor of the 
>> > Textbox
> or
>> > the List a 3D Border is drawn not the flat one. ???????????????????
>> > And the 3 last Buttons, should be all in one row everyone has two 
>> > columns,
>> > so they should be the same size or? But they are not!
>> > I have also tested the TableWrapLayout.
>> > ??????????????????????
>> >
>> >
>> > Code (without Eventhandling):
>> >
> ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
>> >
>> > public void createPartControl(Composite parent)
>> > {
>> >     /*+++++++++++ Form  +++++++++++++++*/
>> >     toolkit = new FormToolkit(parent.getDisplay());
>> >     form = toolkit.createScrolledForm(parent);
>> >
>> >     /*++++++++++++++ Layout Form ++++++++++++++++++*/
>> >     GridLayout layout = new GridLayout();
>> >     layout.numColumns = 6;
>> >     form.getBody().setLayout(layout);
>> >
>> >      /*++++++++++++++ Filter Label ++++++++++++++++++*/
>> >     filterLab = toolkit.createLabel(form.getBody(), "Filter:", 
>> > SWT.CENTER);
>> >     filterLab.setLayoutData(new GridData(GridData.CENTER));
>> >
>> >      /*++++++++++++++ Filter Combo ++++++++++++++++++*/
>> >     filterCombo = new Combo(form.getBody(), SWT.DROP_DOWN);
>> >     toolkit.adapt(filterCombo);
>> >     GridData filterComboLData = new GridData();
>> >     filterComboLData.verticalAlignment = GridData.CENTER;
>> >     filterComboLData.horizontalAlignment = GridData.FILL;
>> >     filterComboLData.grabExcessHorizontalSpace = true;
>> >     filterComboLData.horizontalSpan = 4;
>> >     filterCombo.setLayoutData(filterComboLData);
>> >     // tested if this works, but no better result:
>> > //      filterCombo.setData(FormToolkit.KEY_DRAW_BORDER,
>> > FormToolkit.TEXT_BORDER);
>> > //      toolkit.paintBordersFor(parent);
>> >
>> >      /*++++++++++++++ Sort Button ++++++++++++++++++*/
>> >     sortBtn = toolkit.createButton(form.getBody(), "Sorted", SWT.TOGGLE 
>> > |
>> > SWT.CENTER);
>> >     GridData sortBtnLData = new GridData();
>> >     sortBtnLData.verticalAlignment = GridData.CENTER;
>> >     sortBtnLData.horizontalAlignment = GridData.FILL;
>> >     sortBtn.setLayoutData(sortBtnLData);
>> >
>> >     /*+++++++++++++++ ListEditor +++++++++++++++++++++++*/
>> >     viewer = new ListViewer(form.getBody(), SWT.MULTI | SWT.H_SCROLL |
>> >                                   SWT.VIRTUAL | SWT.V_SCROLL | 
>> > SWT.BORDER);
>> >     toolkit.adapt(viewer.getList(), true, true);
>> >     GridData viewerLData = new GridData();
>> >     viewerLData.grabExcessHorizontalSpace = true;
>> >     viewerLData.grabExcessVerticalSpace= true;
>> >     viewerLData.horizontalAlignment = GridData.FILL;
>> >     viewerLData.verticalAlignment = GridData.FILL;
>> >     viewerLData.horizontalSpan = 6;
>> >     viewer.getList().setLayoutData(viewerLData);
>> >
>> >     /*++++++++++++ Textbox +++++++++*/
>> >     listEntryTxt = toolkit.createText(form.getBody(), "");
>> >     GridData listEntryLData = new GridData();
>> >     listEntryLData.horizontalAlignment = GridData.FILL;
>> >     listEntryLData.verticalAlignment = GridData.CENTER;
>> >     listEntryLData.grabExcessHorizontalSpace = true;
>> >     listEntryLData.horizontalSpan = 6;
>> >     listEntryTxt.setLayoutData(listEntryLData);
>> >
>> >     /*++++++++++++++++++ Change Button ++++++++++++++++++++*/
>> >     changeBtn = toolkit.createButton(form.getBody(), "Change",
>> >                                      SWT.PUSH | SWT.CENTER);
>> >     GridData changeBtnLData = new GridData();
>> >     changeBtnLData.verticalAlignment = GridData.CENTER;
>> >     changeBtnLData.horizontalAlignment= GridData.FILL;
>> >     changeBtnLData.grabExcessHorizontalSpace = true;
>> >     changeBtnLData.horizontalSpan = 2;
>> >     changeBtn.setLayoutData(changeBtnLData);
>> >
>> >     /*++++++++++++++++++ Insert Button ++++++++++++++++++++*/
>> >     insertBtn = toolkit.createButton(form.getBody(), "Insert",
>> >                                      SWT.PUSH | SWT.CENTER);
>> >     GridData insertBtnLData = new GridData();
>> >     insertBtnLData.verticalAlignment = GridData.CENTER;
>> >     insertBtnLData.horizontalAlignment = GridData.FILL;
>> >     insertBtnLData.grabExcessHorizontalSpace = true;
>> >     insertBtnLData.horizontalSpan = 2;
>> >     insertBtn.setLayoutData(insertBtnLData);
>> >
>> >     /*++++++++++++++++++ Delete Button ++++++++++++++++++++*/
>> >     deleteBtn = toolkit.createButton(form.getBody(), "Delete",
>> >                                      SWT.PUSH | SWT.CENTER);
>> >      GridData deleteBtnLData = new GridData();
>> >     deleteBtnLData.verticalAlignment = GridData.CENTER;
>> >     deleteBtnLData.horizontalAlignment = GridData.FILL;
>> >     deleteBtnLData.grabExcessHorizontalSpace = true;
>> >     deleteBtnLData.horizontalSpan = 2;
>> >     deleteBtn.setLayoutData(deleteBtnLData);
>> >
>> >     //With or without this, the borders are not drawn for listEntryTxt 
>> > and
>> > viewer
>> >     //filterCombo has a 3D Border!  ???????????????
>> >     toolkit.paintBordersFor(parent);
>> > }
>> >
>> >
> ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
>> > Thanks in advance!
>> > Rene
>> >
>> >
>
>
>