Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » SWT Rendering inner Group Box on a Custom Field(Must I do something special?)
SWT Rendering inner Group Box on a Custom Field [message #1266598] Fri, 07 March 2014 17:57 Go to next message
João Rebelo is currently offline João RebeloFriend
Messages: 28
Registered: December 2013
Junior Member
Hi,

I have a custom field which beside some other stuff I want it render a GroupBox after the initialization:

  public class TestGroupBox extends AbstractGroupBox {

    @Override
    protected int getConfiguredGridColumnCount() {
      return 1;
    }

    @Override
    protected boolean getConfiguredGridUseUiHeight() {
      return false;
    }

    @Override
    protected double getConfiguredGridWeightY() {
      return 1.0;
    }

    @Override
    protected boolean getConfiguredLabelVisible() {
      return false;
    }

    @Order(10)
    public class TestField1 extends AbstractStringField {

    }

    @Order(20)
    public class TestField2 extends AbstractStringField {

    }
  }


After creating the model:

          TestGroupBox testField = new TestGroupBox();
          testField.setParentFieldInternal(aSplittedField);


and send it to the rendering layer I have a composite where I would render the GroupBox. In terms of code it would be like:

    container.setLayout(new FormLayout());

    ISwtScoutFormField<IFormField> aSwtFormField = getEnvironment().createFormField(container, configuredField);

    FormData centralFormData = new FormData();
    centralFormData.top = new FormAttachment(0, 0);
    centralFormData.bottom = new FormAttachment(100, 0);
    centralFormData.left = new FormAttachment(0, 0);
    centralFormData.right = new FormAttachment(100, 0);
    aSwtFormField.getSwtContainer().setLayoutData(centralFormData);

    //Force refresh calculation
    container.getParent().layout();


I'm using the FormLayout to enforce the GroupBox Container to occupy all space, but unfortunately the inner fields (2 StringFields) are overlaying each other. (as shown in printscreen, using the help of CSS Spy).

index.php/fa/17680/0/

May I just be missing something on the GroupBox configuration?
Should I be doing something more on instantiating the GroupBox or preparing its rendering?
Is it possible that the fact of GroupBox parent has a FormLayout it might affect its internal LogicalGridLayout?
Some other idea??

Regards
João

ps: For really good reason I really need this behavior which I know it isn't Scout standard! Wink


Re: SWT Rendering inner Group Box on a Custom Field [message #1269172 is a reply to message #1266598] Tue, 11 March 2014 13:33 Go to previous messageGo to next message
André Morais is currently offline André MoraisFriend
Messages: 9
Registered: December 2013
Junior Member
Hi,

I also have the same issue when trying to set a FormLayoutData on a TreeField in the same way.
The TreeField only fills horizontally and not vertically. Therefore a scroll bar appears to navigate the tree.

I think it is not a problem in the TreeField Configuration.


Best Regards,
Re: SWT Rendering inner Group Box on a Custom Field [message #1269995 is a reply to message #1269172] Wed, 12 March 2014 11:37 Go to previous message
João Rebelo is currently offline João RebeloFriend
Messages: 28
Registered: December 2013
Junior Member
On a "hammered" attempt to render the GroupBox I've switched it's inner Layouts & Layout Datas (in the continuation of previous code):

    aSwtFormField.getSwtContainer().setLayoutData(centralFormData);

    ((Composite) aSwtFormField.getSwtContainer().getChildren()[0]).setLayout(new GridLayout(1, false));

    for (Control control : ((Composite) aSwtFormField.getSwtContainer().getChildren()[0]).getChildren()) {
      control.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    }

    container.getParent().layout();


Resulting in my fields from the Group Box laying out correctly.
Obviously this is a dummy test which wouldn't work with generic FormFields, but it do points to the fact that something is missing for the Layout.

Any help on the matter would be great.

Regards
João
Previous Topic:Sort and preselect in SmartFields
Next Topic:Get old value of radio button group after/while changing
Goto Forum:
  


Current Time: Tue Mar 19 06:38:54 GMT 2024

Powered by FUDForum. Page generated in 0.01439 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top