Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Aligning Fields in a Scout Form(Question about how to left align fields on a form)
Aligning Fields in a Scout Form [message #1235342] Fri, 24 January 2014 05:16 Go to next message
Matt Collins is currently offline Matt CollinsFriend
Messages: 7
Registered: January 2014
Junior Member
I'm in the process of a religious conversion... from Microsoft Visual Studio to Eclipse, Java, and Scout. So please be kind to the newbie.

I'm having a very difficult time understanding how to build GUI forms in Eclipse and Scout. Specifically, how to position elements on the form. I don't understand the whole grid layout thing.

For example, I created a simple form and added one field, a checkbox. It shows up horizontally centered on the form, and I would like it to be close to the left edge of the form. I've tried all the advanced properties such as making the value of Horizontal Alignment equal to LEFT. But nothing has any effect.

What am I missing?

Thanks,
Matt
Re: Aligning Fields in a Scout Form [message #1235618 is a reply to message #1235342] Fri, 24 January 2014 20:24 Go to previous messageGo to next message
Bertin Kiekebosch is currently offline Bertin KiekeboschFriend
Messages: 309
Registered: August 2011
Senior Member
Hi,

I suggest first try a string field. Be sure is has a label. (It normally has if you use the wizard).

The thing is that the string field has the label at the left side so you will see where the left side starts. The checkbox has the checkbox aligned with the left side of the string edit box and the text at the right side of it.

In the attached file you can see the effect.

Regards Bertin

  • Attachment: Knipsel.PNG
    (Size: 2.90KB, Downloaded 77 times)
Re: Aligning Fields in a Scout Form [message #1235641 is a reply to message #1235618] Fri, 24 January 2014 21:45 Go to previous messageGo to next message
Matt Collins is currently offline Matt CollinsFriend
Messages: 7
Registered: January 2014
Junior Member
Ah... Now I see what's going on. That's a huge help! Thanks. I should have known that a checkbox was a poor choice to start with. I think I can figure it out from here through trial and error, but I may be back.
Re: Aligning Fields in a Scout Form [message #1235645 is a reply to message #1235618] Fri, 24 January 2014 22:02 Go to previous messageGo to next message
Matt Collins is currently offline Matt CollinsFriend
Messages: 7
Registered: January 2014
Junior Member
I just figured something else, too that moves it all the way to the left... Kind of peculiar to the checkbox, I think. If you set the checkbox's Label Visible property to false, the entire checkbox moves all the way to the left, and the checkbox's label is visible on the right. See the screenshot I attached.

Newbie stuff, I know, but that's what I am.
  • Attachment: testform.png
    (Size: 6.47KB, Downloaded 77 times)
Re: Aligning Fields in a Scout Form [message #1235816 is a reply to message #1235645] Sat, 25 January 2014 11:00 Go to previous messageGo to next message
Claudio Guglielmo is currently offline Claudio GuglielmoFriend
Messages: 128
Registered: March 2010
Senior Member
Hi Matt

LabelVisible = false will move the field to the left as you noticed correctly. In case of the checkbox it seems a little confusing because the label is on the right side. But it's actually intended because there is no other way (at least at the moment) to move the checkbox to the left. If you don't want to see the actual label of the checkbox you can set it to null.

In order to get familiar with the logical grid layout it's a good idea to play around with the layouting properties. Here some hints:
GridColumnCount: How many columns should the group box have? Default is 2 which means you can put two fields incl. theirs labels on the same grid row.
GridW: How many columns should the field span? When set to 2 the field takes the space of two cells, so when having a groupbox with gridColumnCount=2 the second field would be put on the second row.
GridH, GridWeightY, GridUseUiHeight, ... -> See javadoc resp. hover over the properties at the scout sdk properties view to get an explanation.

Also have a look at the tutorials/HowTos at the Scout Wiki in order to get started with scout.

Cheers
Claudio
Re: Aligning Fields in a Scout Form [message #1236289 is a reply to message #1235816] Sun, 26 January 2014 21:13 Go to previous messageGo to next message
Matt Collins is currently offline Matt CollinsFriend
Messages: 7
Registered: January 2014
Junior Member
Thank you, Claudio. I'm starting to get the hang of it. One thing that confused me is that each field has its own label. In Visual Studio, labels were treated separately. It never occurred to me that the checkbox had a label on the left. Now I understand, though.

Regarding the grid layout model. It seems like it's similar to HTML tables. So I think I'll be able to figure it out.

I've done two of the tutorials... Hello World! and Contacts (from the Scout Book). They were very helpful.

Thanks for the link to the Scout Wiki. Looks like there's a lot of good info there. I had only seen part of the wiki before.

Thanks,
Matt
Re: Aligning Fields in a Scout Form [message #1236396 is a reply to message #1235816] Mon, 27 January 2014 05:12 Go to previous messageGo to next message
Matt Collins is currently offline Matt CollinsFriend
Messages: 7
Registered: January 2014
Junior Member
Claudio,

I thought I had it figured out, but I don't. I understand what you're saying about gridColumnCount, and Grid W. However, it seems to have no effect on buttons.

I would like Button 2 to be below Button 1 on the attached screenshot.

I've tried every combination of GridColumnCount and Grid W that I can think of. There is absolutely no effect. These are the current values. I don't understand why it won't work.

MainBox.getGridColumnCount() = 1
GroupBox.getGridColumnCount() = 1
Button1.getConfiguredGridW() = 1
Button2.getConfiguredGridW() = 1

I've also tried specifying values for Grid X and Grid Y. No effect at all.

Are buttons different from other fields, kind of like checkboxes?

How would you do this?

I know it may seem trivial, but I want to do this for many buttons and linkbuttons, so I really want them to stack vertically. The sample I've provided is just the stripped down version of what I'm trying to do so I can figure out how to do it.

Any help you can offer would be very much appreciated.
  • Attachment: scout2.png
    (Size: 11.43KB, Downloaded 48 times)
Re: Aligning Fields in a Scout Form [message #1236429 is a reply to message #1236396] Mon, 27 January 2014 07:30 Go to previous messageGo to next message
Matthias Nick is currently offline Matthias NickFriend
Messages: 188
Registered: August 2013
Senior Member
Hi Matt,
I think the property you are looking for is ProcessButton: This property influences where the button will be located. If true (default) the button will ignore the other Layout properties (because process buttons are often placed on the bottom of a form or of a group box). If set to false, the button will behave as any other form-field. I think you just need to set this property to false to take control of the button position.

A Button in Eclipse Scout is by default configured as process button. You can control this by:

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


After you have done this, the buttons should listen to your layout Smile

A very good post about this topic can be found here: http://www.eclipse.org/forums/index.php/t/487362/

Hope this helps,
Matthias

[Updated on: Mon, 27 January 2014 07:31]

Report message to a moderator

Re: Aligning Fields in a Scout Form [message #1236541 is a reply to message #1236429] Mon, 27 January 2014 13:13 Go to previous message
Matt Collins is currently offline Matt CollinsFriend
Messages: 7
Registered: January 2014
Junior Member
Thank you, Matthias! It's exactly what I needed. I'll going to read through that whole thread now.

You know, I've been a programmer for 30 years. It's not the big conceptual things that trip me up when I'm learning something new. It's these little things.

Thanks again.

Matt
Previous Topic:Problems layouting buttons on form
Next Topic:Multiple databases
Goto Forum:
  


Current Time: Thu Nov 27 17:44:24 GMT 2014

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

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