Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » About GridLayout Source
About GridLayout Source [message #447946] Wed, 22 December 2004 03:23 Go to next message
cloudor Mising name is currently offline cloudor Mising nameFriend
Messages: 34
Registered: July 2009
Member
Hi,

I have a question about GridLayout source code whether the following two
loops are dupplicated?

In class GridLayout, line 452-469, ver 3.0.1:

// Put spacers in the grid to account for the item's vertical
// and horizontal span.
rowFill = spec.verticalSpan - 1;
columnFill = spec.hSpan - 1;
for (int r = 1; r <= rowFill; r++) {
for (int c = 0; c < spec.hSpan; c++) {
spacerSpec = new GridData();
spacerSpec.isItemData = false;
((GridData[]) grid.elementAt(row + r))[column + c] =
spacerSpec;
}
}
for (int c = 1; c <= columnFill; c++) {
for (int r = 0; r < spec.verticalSpan; r++) {
spacerSpec = new GridData();
spacerSpec.isItemData = false;
((GridData[]) grid.elementAt(row + r))[column + c] =
spacerSpec;
}
}
Re: About GridLayout Source [message #447947 is a reply to message #447946] Wed, 22 December 2004 03:30 Go to previous messageGo to next message
cloudor Mising name is currently offline cloudor Mising nameFriend
Messages: 34
Registered: July 2009
Member
It might be good to replace the second loop with:


for (int c = 1; c <= columnFill; c++) {
spacerSpec = new GridData();
spacerSpec.isItemData = false;
((GridData[]) grid.elementAt(row))[column + c] =
spacerSpec;

}


Cloudor Pu wrote:
> Hi,
>
> I have a question about GridLayout source code whether the following two
> loops are dupplicated?
>
> In class GridLayout, line 452-469, ver 3.0.1:
>
> // Put spacers in the grid to account for the item's vertical
> // and horizontal span.
> rowFill = spec.verticalSpan - 1;
> columnFill = spec.hSpan - 1;
> for (int r = 1; r <= rowFill; r++) {
> for (int c = 0; c < spec.hSpan; c++) {
> spacerSpec = new GridData();
> spacerSpec.isItemData = false;
> ((GridData[]) grid.elementAt(row + r))[column + c] =
> spacerSpec;
> }
> }
> for (int c = 1; c <= columnFill; c++) {
> for (int r = 0; r < spec.verticalSpan; r++) {
> spacerSpec = new GridData();
> spacerSpec.isItemData = false;
> ((GridData[]) grid.elementAt(row + r))[column + c] =
> spacerSpec;
> }
> }
Re: About GridLayout Source [message #447958 is a reply to message #447947] Wed, 22 December 2004 13:08 Go to previous message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
Please look at the source for GridLayout in 3.1. This class has been
rewritten.


"Cloudor Pu" <cloudor@126.com> wrote in message
news:cqapp8$5vb$1@www.eclipse.org...
> It might be good to replace the second loop with:
>
>
> for (int c = 1; c <= columnFill; c++) {
> spacerSpec = new GridData();
> spacerSpec.isItemData = false;
> ((GridData[]) grid.elementAt(row))[column + c] =
> spacerSpec;
>
> }
>
>
> Cloudor Pu wrote:
>> Hi,
>>
>> I have a question about GridLayout source code whether the following two
>> loops are dupplicated?
>>
>> In class GridLayout, line 452-469, ver 3.0.1:
>>
>> // Put spacers in the grid to account for the item's vertical
>> // and horizontal span.
>> rowFill = spec.verticalSpan - 1;
>> columnFill = spec.hSpan - 1;
>> for (int r = 1; r <= rowFill; r++) {
>> for (int c = 0; c < spec.hSpan; c++) {
>> spacerSpec = new GridData();
>> spacerSpec.isItemData = false;
>> ((GridData[]) grid.elementAt(row + r))[column + c] =
>> spacerSpec;
>> }
>> }
>> for (int c = 1; c <= columnFill; c++) {
>> for (int r = 0; r < spec.verticalSpan; r++) {
>> spacerSpec = new GridData();
>> spacerSpec.isItemData = false;
>> ((GridData[]) grid.elementAt(row + r))[column + c] =
>> spacerSpec;
>> }
>> }
Previous Topic:GridLayout: bug in method calculateGridDimensions?
Next Topic:Too long text on a Label
Goto Forum:
  


Current Time: Mon Nov 30 08:57:10 GMT 2020

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

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

Back to the top