Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » How To Set Size For InputDialog Properly
How To Set Size For InputDialog Properly [message #482909] Fri, 28 August 2009 14:04 Go to next message
Eclipse UserFriend
Originally posted by: runzhou.li.gmail.com

Hi,

I don't really want to rewrite a dialog that does the same thing as
InputDialog, but the size of InputDialog is not desired.

How should I set a size for InputDialog properly?

Thanks in advance!

--
Runzhou Li
Re: How To Set Size For InputDialog Properly [message #483769 is a reply to message #482909] Wed, 02 September 2009 21:19 Go to previous messageGo to next message
Will Horn is currently offline Will HornFriend
Messages: 265
Registered: July 2009
Senior Member
How about writing a subclass and overridding configureShell? For example,

protected void configureShell(Shell shell) {
super.configureShell(shell);
shell.setBounds(100, 100, 100, 100); // or whatever you want
}

"Runzhou Li" <runzhou.li@gmail.com> wrote in message
news:h78o4h$c3l$1@build.eclipse.org...
> Hi,
>
> I don't really want to rewrite a dialog that does the same thing as
> InputDialog, but the size of InputDialog is not desired.
>
> How should I set a size for InputDialog properly?
>
> Thanks in advance!
>
> --
> Runzhou Li
Re: How To Set Size For InputDialog Properly [message #484254 is a reply to message #483769] Fri, 04 September 2009 19:49 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: runzhou.li.gmail.com

Thank you Will.

I also have a minor question, what's the best way to center this dialog?
Currently I'm doing something like this:

protected void configureShell( Shell shell ) {
Point centerPoint = Geometry.centerPoint(
shell.getParent().getBounds() );

super.configureShell( shell );
shell.setBounds( centerPoint.x, centerPoint.y, 800, 400 );
}

Apparently it's not the perfect way, it somewhat places the dialog near
middle, but not as perfect as the original InputDialog.

"Will Horn" <will.horn@gmail.com> 写入消息
news:h7mngu$br0$1@build.eclipse.org...
> How about writing a subclass and overridding configureShell? For example,
>
> protected void configureShell(Shell shell) {
> super.configureShell(shell);
> shell.setBounds(100, 100, 100, 100); // or whatever you want
> }
>
> "Runzhou Li" <runzhou.li@gmail.com> wrote in message
> news:h78o4h$c3l$1@build.eclipse.org...
>> Hi,
>>
>> I don't really want to rewrite a dialog that does the same thing as
>> InputDialog, but the size of InputDialog is not desired.
>>
>> How should I set a size for InputDialog properly?
>>
>> Thanks in advance!
>>
>> --
>> Runzhou Li
>
Re: How To Set Size For InputDialog Properly [message #486752 is a reply to message #484254] Fri, 18 September 2009 22:42 Go to previous messageGo to next message
Will Horn is currently offline Will HornFriend
Messages: 265
Registered: July 2009
Senior Member
Maybe:

protected void configureShell( Shell shell ) {
super.configureShell( shell );
shell.setBounds(shell.getBounds().x, shell.getBounds().y, 800, 400);
}

"Runzhou Li" <runzhou.li@gmail.com> wrote in message
news:h7rr08$5uk$1@build.eclipse.org...
> Thank you Will.
>
> I also have a minor question, what's the best way to center this dialog?
> Currently I'm doing something like this:
>
> protected void configureShell( Shell shell ) {
> Point centerPoint = Geometry.centerPoint(
> shell.getParent().getBounds() );
>
> super.configureShell( shell );
> shell.setBounds( centerPoint.x, centerPoint.y, 800, 400 );
> }
>
> Apparently it's not the perfect way, it somewhat places the dialog near
> middle, but not as perfect as the original InputDialog.
>
> "Will Horn" <will.horn@gmail.com> 写入消息
> news:h7mngu$br0$1@build.eclipse.org...
>> How about writing a subclass and overridding configureShell? For
>> example,
>>
>> protected void configureShell(Shell shell) {
>> super.configureShell(shell);
>> shell.setBounds(100, 100, 100, 100); // or whatever you want
>> }
>>
>> "Runzhou Li" <runzhou.li@gmail.com> wrote in message
>> news:h78o4h$c3l$1@build.eclipse.org...
>>> Hi,
>>>
>>> I don't really want to rewrite a dialog that does the same thing as
>>> InputDialog, but the size of InputDialog is not desired.
>>>
>>> How should I set a size for InputDialog properly?
>>>
>>> Thanks in advance!
>>>
>>> --
>>> Runzhou Li
>>
Re: How To Set Size For InputDialog Properly [message #487309 is a reply to message #486752] Tue, 22 September 2009 17:56 Go to previous message
Eclipse UserFriend
Originally posted by: runzhou.li.gmail.com

I guess not. The way I was doing is acceptable, but not precise.

"Will Horn" <will.horn@gmail.com> 写入消息
news:h912di$1v7$1@build.eclipse.org...
> Maybe:
>
> protected void configureShell( Shell shell ) {
> super.configureShell( shell );
> shell.setBounds(shell.getBounds().x, shell.getBounds().y, 800, 400);
> }
>
> "Runzhou Li" <runzhou.li@gmail.com> wrote in message
> news:h7rr08$5uk$1@build.eclipse.org...
>> Thank you Will.
>>
>> I also have a minor question, what's the best way to center this dialog?
>> Currently I'm doing something like this:
>>
>> protected void configureShell( Shell shell ) {
>> Point centerPoint = Geometry.centerPoint(
>> shell.getParent().getBounds() );
>>
>> super.configureShell( shell );
>> shell.setBounds( centerPoint.x, centerPoint.y, 800, 400 );
>> }
>>
>> Apparently it's not the perfect way, it somewhat places the dialog near
>> middle, but not as perfect as the original InputDialog.
>>
>> "Will Horn" <will.horn@gmail.com> 写入消息
>> news:h7mngu$br0$1@build.eclipse.org...
>>> How about writing a subclass and overridding configureShell? For
>>> example,
>>>
>>> protected void configureShell(Shell shell) {
>>> super.configureShell(shell);
>>> shell.setBounds(100, 100, 100, 100); // or whatever you want
>>> }
>>>
>>> "Runzhou Li" <runzhou.li@gmail.com> wrote in message
>>> news:h78o4h$c3l$1@build.eclipse.org...
>>>> Hi,
>>>>
>>>> I don't really want to rewrite a dialog that does the same thing as
>>>> InputDialog, but the size of InputDialog is not desired.
>>>>
>>>> How should I set a size for InputDialog properly?
>>>>
>>>> Thanks in advance!
>>>>
>>>> --
>>>> Runzhou Li
>>>
>
Previous Topic:How to use ComputedValue for content assistance?
Next Topic:auto-sizing column width?
Goto Forum:
  


Current Time: Sun Dec 21 01:15:15 GMT 2014

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

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