Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » SearchDialog overrides user set layout data
SearchDialog overrides user set layout data [message #458657] Mon, 18 July 2005 16:56 Go to next message
Bo Majewski is currently offline Bo MajewskiFriend
Messages: 17
Registered: July 2009
Junior Member
I created my own ISearchPage by extending DialogPage. In it I create a
widget that is supposed to stretch to the full page size. This is the
intended behavior. In the createControl method I set the layout data on
the widget to be new GridData(GridData.FILL_BOTH). To my surprise the
SearchDialog class overrides this by setting layout data to

new GridData(SWT.FILL, SWT.BEGINNING, true, false)

The last false undoes the effect of my settings, making the widget
scrunched against the top side of the tab. I can set the height hint, but
this is not what I wish to have. I want the user to be able to stretch the
page and see the complete widget, rather than use a scroll bar (say, using
ScrolledComposite). I feel that setting layout data without regard for
what the user set is wrong. However, before I file a bug, I would like to
see if anybody knows a standard way around this? At the moment I had to
re-implement setLayoutData in my widget to prevent it from setting new
layout data if one was already set. Is there a better, more "standard"
approach?
Re: SearchDialog overrides user set layout data [message #458664 is a reply to message #458657] Mon, 18 July 2005 18:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"Bo Majewski" <bo@n0spam.majewski.com> wrote in message
news:pan.2005.07.18.16.56.16.834299@n0spam.majewski.com...
>I created my own ISearchPage by extending DialogPage. In it I create a
> widget that is supposed to stretch to the full page size. This is the
> intended behavior. In the createControl method I set the layout data on
> the widget to be new GridData(GridData.FILL_BOTH). To my surprise the
> SearchDialog class overrides this by setting layout data to
>
> new GridData(SWT.FILL, SWT.BEGINNING, true, false)
>
> The last false undoes the effect of my settings, making the widget
> scrunched against the top side of the tab. I can set the height hint, but
> this is not what I wish to have. I want the user to be able to stretch the
> page and see the complete widget, rather than use a scroll bar (say, using
> ScrolledComposite). I feel that setting layout data without regard for
> what the user set is wrong. However, before I file a bug, I would like to
> see if anybody knows a standard way around this? At the moment I had to
> re-implement setLayoutData in my widget to prevent it from setting new
> layout data if one was already set. Is there a better, more "standard"
> approach?
I understand your frustration; however, the layout is owned by the dialog -
not your page.
You own the layout for anything your page contains.
You cannot assume that the dialog is using GridLayout. (I know it does, but
you can't assume it).
A workaround perhaps would be to see what other ISearchPages do and then
copy it.
---
Sunil
Re: SearchDialog overrides user set layout data [message #458705 is a reply to message #458664] Tue, 19 July 2005 17:27 Go to previous messageGo to next message
Bo Majewski is currently offline Bo MajewskiFriend
Messages: 17
Registered: July 2009
Junior Member
On Mon, 18 Jul 2005 14:26:43 -0400, Sunil Kamath wrote:

> I understand your frustration; however, the layout is owned by the dialog -
> not your page.
> You own the layout for anything your page contains.
> You cannot assume that the dialog is using GridLayout. (I know it does, but
> you can't assume it).

While I agree with the above, I would argue that this is a mistake for a
dialog not to stretch user component over the entire page. If it did, I
still can make a page that has everything scrunched against the top part
of the page. I simply use a Composite to fill the entire page. In it I
embed widgets that occupy only top part of it.

Thus a solution that stretches user component is less limiting than a
solution that gives the component only top part of the page, according to
the computed size. Hence it is a bug.
Re: SearchDialog overrides user set layout data [message #458707 is a reply to message #458705] Tue, 19 July 2005 18:02 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"Bo Majewski" <bo@n0spam.majewski.com> wrote in message
news:pan.2005.07.19.17.27.48.428169@n0spam.majewski.com...
> On Mon, 18 Jul 2005 14:26:43 -0400, Sunil Kamath wrote:
>
>> I understand your frustration; however, the layout is owned by the
>> dialog -
>> not your page.
>> You own the layout for anything your page contains.
>> You cannot assume that the dialog is using GridLayout. (I know it does,
>> but
>> you can't assume it).
>
> While I agree with the above, I would argue that this is a mistake for a
> dialog not to stretch user component over the entire page. If it did, I
> still can make a page that has everything scrunched against the top part
> of the page. I simply use a Composite to fill the entire page. In it I
> embed widgets that occupy only top part of it.
>
> Thus a solution that stretches user component is less limiting than a
> solution that gives the component only top part of the page, according to
> the computed size. Hence it is a bug.

How do you know what the layout of the container is? Rght now you know it is
GridLayout because you peeked.
What if the implementation changes? Will you maintain two versions of your
component?
---
Sunil
Re: SearchDialog overrides user set layout data [message #458708 is a reply to message #458707] Tue, 19 July 2005 18:47 Go to previous messageGo to next message
Bo Majewski is currently offline Bo MajewskiFriend
Messages: 17
Registered: July 2009
Junior Member
> How do you know what the layout of the container is? Rght now you know it is
> GridLayout because you peeked.
> What if the implementation changes? Will you maintain two versions of your
> component?

No, I do not maintain two implementations. I don't care what layout the
container uses. As far as I am concerned it may be FillLayout. The point
is that if I am given the entire area, I can choose to use only the top
part. If I am given the top part only, I have no choice.

My argument is no longer based on me setting any layout data. I agreed
that I should not rely on this. Instead I want to be given the entire
page, so that I have a choice of how much of it I am going to fill. How I
am given it (which layout is used by the container) is not what I am
concerned with.

In my previous post I argued that if my control is stretched, by whatever
means, to cover the entire page, I still have an option of making it
compact and aligned against the top. So this solution does not take
anything away from my choices. It gives me, however, the ability to design
a large page, more responsive to a user resizing it. I hope this is a
better explanation that conveys more accurately my arguments in favor of a
full page control.
Re: SearchDialog overrides user set layout data [message #458709 is a reply to message #458708] Tue, 19 July 2005 18:58 Go to previous message
Eclipse UserFriend
Originally posted by: sunil_kamath.nohotspammail.com

"Bo Majewski" <bo@n0spam.majewski.com> wrote in message
news:pan.2005.07.19.18.47.56.92876@n0spam.majewski.com...
>> How do you know what the layout of the container is? Rght now you know it
>> is
>> GridLayout because you peeked.
>> What if the implementation changes? Will you maintain two versions of
>> your
>> component?
>
> No, I do not maintain two implementations. I don't care what layout the
> container uses. As far as I am concerned it may be FillLayout. The point
> is that if I am given the entire area, I can choose to use only the top
> part. If I am given the top part only, I have no choice.
>
> My argument is no longer based on me setting any layout data. I agreed
> that I should not rely on this. Instead I want to be given the entire
> page, so that I have a choice of how much of it I am going to fill. How I
> am given it (which layout is used by the container) is not what I am
> concerned with.
>
> In my previous post I argued that if my control is stretched, by whatever
> means, to cover the entire page, I still have an option of making it
> compact and aligned against the top. So this solution does not take
> anything away from my choices. It gives me, however, the ability to design
> a large page, more responsive to a user resizing it. I hope this is a
> better explanation that conveys more accurately my arguments in favor of a
> full page control.

OK, fair enough. I see what you mean.
---
Sunil
Previous Topic:Event bubbling
Next Topic:Problem with SWT_AWT and JOptionPane
Goto Forum:
  


Current Time: Sat Oct 24 09:14:08 GMT 2020

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

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

Back to the top