FormLayout WorkAround?

SWT Designer allows you to create the views, editors, perspectives, pref pages, composites, etc. that comprise Eclipse SWT & RCP applications and plug-ins.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

FormLayout WorkAround?

Postby asamoal » Fri Aug 15, 2003 4:54 am

Is there any known way to work around laying out labels in:

[label1][status text control/label-----------------------------][FileProp][Data]

A status bar. Of cause i can do it with the formlayout but them i cannot use swt-d gui.

In 1.0.4 there is the Absolute layout support so setBounds could be another option, i guess.

I have noticed that the layout inheritance prevents any child composities to dictate there layout (to be different from the Shell layout initially selected).

:?:

This brings me to the question why can you not (or how do you) change the layout after adding it initially?
:roll:
Last edited by asamoal on Fri Aug 15, 2003 5:01 am, edited 1 time in total.
//Leslie
asamoal
 
Posts: 24
Joined: Wed Aug 13, 2003 2:56 am
Location: Finland

Re: FormLayout WorkAround?

Postby admin » Fri Aug 15, 2003 5:01 am

asamoal wrote:Is there any known way to work around laying out labels in:

[label1][status text control/label-----------------------------][FileProp][Data]

A status bar. Of cause i can do it with the formlayout but them i cannot use swt-d gui.

:?:

If I understand you right, you can use just GridLayout.
Force second control (status) grab horizontal and fill horizontal.

Why do you need FromLayout for this? I ask this to understand, how FormLayout can be used.
I just started implementation of its support in Designer. :-D
admin
Moderator
 
Posts: 166
Joined: Thu Jul 24, 2003 12:25 am

Re: FormLayout WorkAround?

Postby admin » Fri Aug 15, 2003 5:05 am

asamoal wrote:I have noticed that the layout inheritance prevents any child composities to dictate there layout (to be different from the Shell layout initially selected).

This brings me to the question why can you not (or how do you) change the layout after adding it initially?
:roll:

Select composite with layout and look in Inspector. Select layout property and press DEL. After this you can add new layout manager.
You can add any layout for Composite without limitation what layout is set in its parent.
admin
Moderator
 
Posts: 166
Joined: Thu Jul 24, 2003 12:25 am

Postby asamoal » Fri Aug 15, 2003 5:09 am

You are right that the grid layout can be used I just noticed that gui can understand numColumns!

The form layout was much easier because I could hook controls to each other say:

Code: Select all
   FormData_2.right = new FormAttachment(100, 0);
   FormData_2.left = new FormAttachment(0, 0);
   FormData_2.bottom = new FormAttachment(100, 0);
   FormData_4.right = new FormAttachment(CLabel_2, 0, 0;
   FormData_4.left = new FormAttachment(CLabel_1, 0, 0);
   FormData_5.right = new FormAttachment(100, 0);
   FormData_1.left = new FormAttachment(0, 0);


Does that make any sense or do you want the source code that I have here? :idea:
//Leslie
asamoal
 
Posts: 24
Joined: Wed Aug 13, 2003 2:56 am
Location: Finland

Postby admin » Fri Aug 15, 2003 5:15 am

asamoal wrote:You are right that the grid layout can be used I just noticed that gui can understand numColumns!

Yes, GridLayout is fully supported.

asamoal wrote:The form layout was much easier because I could hook controls to each other say:

Code: Select all
   FormData_2.right = new FormAttachment(100, 0);
   FormData_2.left = new FormAttachment(0, 0);
   FormData_2.bottom = new FormAttachment(100, 0);
   FormData_4.right = new FormAttachment(CLabel_2, 0, 0;
   FormData_4.left = new FormAttachment(CLabel_1, 0, 0);
   FormData_5.right = new FormAttachment(100, 0);
   FormData_1.left = new FormAttachment(0, 0);


Does that make any sense or do you want the source code that I have here? :idea:

I still don't think that FormLayout is good in this or other case with regular control layout. I mean that if you need to place control one after one with same gap and don't need to have spacific sizes (like first take 30%, second - 40% and third - rest), GridLayout is superb.

Yes, we will support it, but it is usefull for more complex forms. Well, I never used it before, so I can not tell more precise. :-D
admin
Moderator
 
Posts: 166
Joined: Thu Jul 24, 2003 12:25 am

Postby asamoal » Fri Aug 15, 2003 5:53 am

The horizontal fill is not getting this there and the ColumnWidthEqual is false, see code snip:


Code: Select all
{
         final Composite composite = new Composite(shell, SWT.NONE);
         composite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
         final GridLayout gridLayout = new GridLayout();
         gridLayout.numColumns = 3;
         composite.setLayout(gridLayout);
         {
            final CLabel cLabel = new CLabel(composite, SWT.NONE);
            cLabel.setText("label");
         }
         {
            final CLabel cLabel = new CLabel(composite, SWT.NONE);
            cLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            cLabel.setText("label");
         }
         {
            final CLabel cLabel = new CLabel(composite, SWT.SHADOW_OUT);
            cLabel.setText("label");
         }
      }


Whist trying to test the ViewForm/Layout deletes the qui crashed!

Code: Select all
!ENTRY com.swtdesigner 4 4 Aug 15, 2003 13:25:42.416
!MESSAGE Designer internal error: Argument cannot be null
!STACK 0
java.lang.IllegalArgumentException: Argument cannot be null


!ENTRY com.swtdesigner 4 4 Aug 15, 2003 16:32:19.176
!MESSAGE Designer internal error: Property not found: activeTabIndex
!STACK 0
com.swtdesigner.properties.a: Property not found: activeTabIndex

!ENTRY org.eclipse.ui 4 4 Aug 15, 2003 16:37:39.287
!MESSAGE Unhandled exception caught in event loop.
!ENTRY org.eclipse.ui 4 0 Aug 15, 2003 16:37:39.317
!MESSAGE No more handles
!STACK 0

//Leslie
asamoal
 
Posts: 24
Joined: Wed Aug 13, 2003 2:56 am
Location: Finland

Postby admin » Fri Aug 15, 2003 6:00 am

asamoal wrote:The horizontal fill is not getting this there and the ColumnWidthEqual is false, see code snip:


Code: Select all
{
         final Composite composite = new Composite(shell, SWT.NONE);
         composite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
         final GridLayout gridLayout = new GridLayout();
         gridLayout.numColumns = 3;
         composite.setLayout(gridLayout);
         {
            final CLabel cLabel = new CLabel(composite, SWT.NONE);
            cLabel.setText("label");
         }
         {
            final CLabel cLabel = new CLabel(composite, SWT.NONE);
            cLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
            cLabel.setText("label");
         }
         {
            final CLabel cLabel = new CLabel(composite, SWT.SHADOW_OUT);
            cLabel.setText("label");
         }
      }


Your composite has GRAB_HORIZONTAL, but does not fill horizontal. Instead I see fill vertical...

asamoal wrote:Whist trying to test the ViewForm/Layout deletes the qui crashed!

Code: Select all
!ENTRY com.swtdesigner 4 4 Aug 15, 2003 13:25:42.416
!MESSAGE Designer internal error: Argument cannot be null
!STACK 0
java.lang.IllegalArgumentException: Argument cannot be null


!ENTRY com.swtdesigner 4 4 Aug 15, 2003 16:32:19.176
!MESSAGE Designer internal error: Property not found: activeTabIndex
!STACK 0
com.swtdesigner.properties.a: Property not found: activeTabIndex

!ENTRY org.eclipse.ui 4 4 Aug 15, 2003 16:37:39.287
!MESSAGE Unhandled exception caught in event loop.
!ENTRY org.eclipse.ui 4 0 Aug 15, 2003 16:37:39.317
!MESSAGE No more handles
!STACK 0


Can you please provide scenario?

PS. I will back monday morning.
admin
Moderator
 
Posts: 166
Joined: Thu Jul 24, 2003 12:25 am

Postby asamoal » Fri Aug 15, 2003 6:30 am

OK worked out nicely.

The code will follow shortly.

Have a good weekend.
//Leslie
asamoal
 
Posts: 24
Joined: Wed Aug 13, 2003 2:56 am
Location: Finland


Return to SWT Designer

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 1 guest