Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » maximize shell
maximize shell [message #731704] Sun, 02 October 2011 11:38 Go to next message
Eclipse User
Originally posted by: Prasanth Ravi

hi i want to know how to control the maximum size of a shell(the main
one in my case).

I currently use this method -->

private Shell sh;
public void controlResized(ControlEvent e) {

Rectangle rt=((Shell) e.widget).getBounds();
if(rt.height>500)
sh.setBounds(rt.x,rt.y, rt.width, 500);
}

However this results in flickering ,

the shell has the setMinimumsize() , but how do i do it to restrict a
window's height on resizing?
Re: maximize shell [message #731785 is a reply to message #731704] Mon, 03 October 2011 00:17 Go to previous messageGo to next message
Vijay Raj
Messages: 608
Registered: July 2009
Senior Member
Did u try shell.setFullScreen(true)?

---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay

[Updated on: Mon, 03 October 2011 00:24]

Report message to a moderator

Re: maximize shell [message #731807 is a reply to message #731785] Mon, 03 October 2011 02:53 Go to previous messageGo to next message
Eclipse User
Originally posted by: Prasanth Ravi

On 10/3/2011 9:47 AM, vijay wrote:
> Did u try shell.setFullScren(true)?

i want to limit the size of the shell when the user tries to resize( ie
the shell should have a maximum size).
Re: maximize shell [message #731830 is a reply to message #731807] Mon, 03 October 2011 05:02 Go to previous messageGo to next message
Vijay Raj
Messages: 608
Registered: July 2009
Senior Member
ohh sorry

there is a bug entry for this
https://bugs.eclipse.org/bugs/show_bug.cgi?id=74001

its an old one, re opened again,this seems to be a genuine request and i don't know why it took so long..the fix also seems to be simple,which can be done in

LRESULT WM_GETMINMAXINFO (int /*long*/ wParam, int /*long*/ lParam) {
    LRESULT result = super.WM_GETMINMAXINFO (wParam, lParam);
    if (result != null) return result;
    if (minWidth != SWT.DEFAULT || minHeight != SWT.DEFAULT) {
        MINMAXINFO info = new MINMAXINFO ();
        OS.MoveMemory (info, lParam, MINMAXINFO.sizeof);
        if (minWidth != SWT.DEFAULT) info.ptMinTrackSize_x = minWidth;

        //CHANGE ADD if (minWidth != SWT.DEFAULT) info.ptMaxTrackSize_x = maxWidth;

        if (minHeight != SWT.DEFAULT) info.ptMinTrackSize_y = minHeight;

        //CHANGE ADD if (minWidth != SWT.DEFAULT) info.ptMaxTrackSize_y = maxHeight;

        OS.MoveMemory (lParam, info, MINMAXINFO.sizeof);
        return LRESULT.ZERO;
    }
    return result;
}


if the fix is urgent you can download the development release of the SWT and merge the related changes to rebuild SWT(may lead to more problems)



---------------------
why, mr. Anderson, why, why do you persist?
Because I Choose To.
Regards,
Vijay

[Updated on: Mon, 03 October 2011 05:04]

Report message to a moderator

Re: maximize shell [message #731858 is a reply to message #731830] Mon, 03 October 2011 06:40 Go to previous message
Prasanth Ravi is currently offline Prasanth Ravi
Messages: 8
Registered: October 2011
Junior Member
thnx for the code Smile
merging the changes however seems like an extreme step and since im new to SWT.. i don't want to break anything i can't fix considering it's SWT internals.
Re: maximize shell [message #731861 is a reply to message #731830] Mon, 03 October 2011 06:23 Go to previous message
Prasanth Ravi is currently offline Prasanth Ravi
Messages: 8
Registered: October 2011
Junior Member
On 10/3/2011 2:32 PM, vijay wrote:
> ohh sorry
>
> there is a bug entry for this
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=74001
>
> its an old one, re opened again,this seems to be a genuine request and i
> don't know why its taking so long..the fix also seems to be simple,which
> can be done in
>
> LRESULT WM_GETMINMAXINFO (int /*long*/ wParam, int /*long*/ lParam) {
> LRESULT result = super.WM_GETMINMAXINFO (wParam, lParam);
> if (result != null) return result;
> if (minWidth != SWT.DEFAULT || minHeight != SWT.DEFAULT) {
> MINMAXINFO info = new MINMAXINFO ();
> OS.MoveMemory (info, lParam, MINMAXINFO.sizeof);
> if (minWidth != SWT.DEFAULT) info.ptMinTrackSize_x = minWidth;
>
> //CHANGE ADD if (minWidth != SWT.DEFAULT) info.ptMaxTrackSize_x = maxWidth;
>
> if (minHeight != SWT.DEFAULT) info.ptMinTrackSize_y = minHeight;
>
> //CHANGE ADD if (minWidth != SWT.DEFAULT) info.ptMaxTrackSize_y =
> maxHeight;
>
> OS.MoveMemory (lParam, info, MINMAXINFO.sizeof);
> return LRESULT.ZERO;
> }
> return result;
> }
>
> if the fix is urgent you can download the development release of the SWT
> and merge the related changes to rebuild SWT(may lead to more problems)


thnx for the code .. i'll try it though i'm new to SWT. Meanwhile i
think i'll try to change so that i don't require that functionality and
i really don't want to go into the internals of SWT yet.
Re: maximize shell [message #731862 is a reply to message #731830] Mon, 03 October 2011 06:24 Go to previous message
Prasanth Ravi is currently offline Prasanth Ravi
Messages: 8
Registered: October 2011
Junior Member
On 10/3/2011 2:32 PM, vijay wrote:
> ohh sorry
>
> there is a bug entry for this
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=74001
>
> its an old one, re opened again,this seems to be a genuine request and i
> don't know why its taking so long..the fix also seems to be simple,which
> can be done in
>
> LRESULT WM_GETMINMAXINFO (int /*long*/ wParam, int /*long*/ lParam) {
> LRESULT result = super.WM_GETMINMAXINFO (wParam, lParam);
> if (result != null) return result;
> if (minWidth != SWT.DEFAULT || minHeight != SWT.DEFAULT) {
> MINMAXINFO info = new MINMAXINFO ();
> OS.MoveMemory (info, lParam, MINMAXINFO.sizeof);
> if (minWidth != SWT.DEFAULT) info.ptMinTrackSize_x = minWidth;
>
> //CHANGE ADD if (minWidth != SWT.DEFAULT) info.ptMaxTrackSize_x = maxWidth;
>
> if (minHeight != SWT.DEFAULT) info.ptMinTrackSize_y = minHeight;
>
> //CHANGE ADD if (minWidth != SWT.DEFAULT) info.ptMaxTrackSize_y =
> maxHeight;
>
> OS.MoveMemory (lParam, info, MINMAXINFO.sizeof);
> return LRESULT.ZERO;
> }
> return result;
> }
>
> if the fix is urgent you can download the development release of the SWT
> and merge the related changes to rebuild SWT(may lead to more problems)


thnx for the code .. i'll try it though i'm new to SWT. Meanwhile i
think i'll try to change so that i don't require that functionality and
i really don't want to go into the internals of SWT yet.
Re: maximize shell [message #731863 is a reply to message #731830] Mon, 03 October 2011 06:25 Go to previous message
Prasanth Ravi is currently offline Prasanth Ravi
Messages: 8
Registered: October 2011
Junior Member
On 10/3/2011 2:32 PM, vijay wrote:
> ohh sorry
>
> there is a bug entry for this
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=74001
>
> its an old one, re opened again,this seems to be a genuine request and i
> don't know why its taking so long..the fix also seems to be simple,which
> can be done in
>
> LRESULT WM_GETMINMAXINFO (int /*long*/ wParam, int /*long*/ lParam) {
> LRESULT result = super.WM_GETMINMAXINFO (wParam, lParam);
> if (result != null) return result;
> if (minWidth != SWT.DEFAULT || minHeight != SWT.DEFAULT) {
> MINMAXINFO info = new MINMAXINFO ();
> OS.MoveMemory (info, lParam, MINMAXINFO.sizeof);
> if (minWidth != SWT.DEFAULT) info.ptMinTrackSize_x = minWidth;
>
> //CHANGE ADD if (minWidth != SWT.DEFAULT) info.ptMaxTrackSize_x = maxWidth;
>
> if (minHeight != SWT.DEFAULT) info.ptMinTrackSize_y = minHeight;
>
> //CHANGE ADD if (minWidth != SWT.DEFAULT) info.ptMaxTrackSize_y =
> maxHeight;
>
> OS.MoveMemory (lParam, info, MINMAXINFO.sizeof);
> return LRESULT.ZERO;
> }
> return result;
> }
>
> if the fix is urgent you can download the development release of the SWT
> and merge the related changes to rebuild SWT(may lead to more problems)


thnx for the code .. i'll try it though i'm new to SWT. Meanwhile i
think i'll try to change so that i don't require that functionality and
i really don't want to go into the internals of SWT yet.
Re: maximize shell [message #731864 is a reply to message #731830] Mon, 03 October 2011 06:23 Go to previous message
Prasanth Ravi is currently offline Prasanth Ravi
Messages: 8
Registered: October 2011
Junior Member
On 10/3/2011 2:32 PM, vijay wrote:
> ohh sorry
>
> there is a bug entry for this
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=74001
>
> its an old one, re opened again,this seems to be a genuine request and i
> don't know why its taking so long..the fix also seems to be simple,which
> can be done in
>
> LRESULT WM_GETMINMAXINFO (int /*long*/ wParam, int /*long*/ lParam) {
> LRESULT result = super.WM_GETMINMAXINFO (wParam, lParam);
> if (result != null) return result;
> if (minWidth != SWT.DEFAULT || minHeight != SWT.DEFAULT) {
> MINMAXINFO info = new MINMAXINFO ();
> OS.MoveMemory (info, lParam, MINMAXINFO.sizeof);
> if (minWidth != SWT.DEFAULT) info.ptMinTrackSize_x = minWidth;
>
> //CHANGE ADD if (minWidth != SWT.DEFAULT) info.ptMaxTrackSize_x = maxWidth;
>
> if (minHeight != SWT.DEFAULT) info.ptMinTrackSize_y = minHeight;
>
> //CHANGE ADD if (minWidth != SWT.DEFAULT) info.ptMaxTrackSize_y =
> maxHeight;
>
> OS.MoveMemory (lParam, info, MINMAXINFO.sizeof);
> return LRESULT.ZERO;
> }
> return result;
> }
>
> if the fix is urgent you can download the development release of the SWT
> and merge the related changes to rebuild SWT(may lead to more problems)


thnx for the code .. i'll try it though i'm new to SWT. Meanwhile i
think i'll try to change so that i don't require that functionality and
i really don't want to go into the internals of SWT yet.
Re: maximize shell [message #731865 is a reply to message #731830] Mon, 03 October 2011 06:24 Go to previous message
Prasanth Ravi is currently offline Prasanth Ravi
Messages: 8
Registered: October 2011
Junior Member
On 10/3/2011 2:32 PM, vijay wrote:
> ohh sorry
>
> there is a bug entry for this
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=74001
>
> its an old one, re opened again,this seems to be a genuine request and i
> don't know why its taking so long..the fix also seems to be simple,which
> can be done in
>
> LRESULT WM_GETMINMAXINFO (int /*long*/ wParam, int /*long*/ lParam) {
> LRESULT result = super.WM_GETMINMAXINFO (wParam, lParam);
> if (result != null) return result;
> if (minWidth != SWT.DEFAULT || minHeight != SWT.DEFAULT) {
> MINMAXINFO info = new MINMAXINFO ();
> OS.MoveMemory (info, lParam, MINMAXINFO.sizeof);
> if (minWidth != SWT.DEFAULT) info.ptMinTrackSize_x = minWidth;
>
> //CHANGE ADD if (minWidth != SWT.DEFAULT) info.ptMaxTrackSize_x = maxWidth;
>
> if (minHeight != SWT.DEFAULT) info.ptMinTrackSize_y = minHeight;
>
> //CHANGE ADD if (minWidth != SWT.DEFAULT) info.ptMaxTrackSize_y =
> maxHeight;
>
> OS.MoveMemory (lParam, info, MINMAXINFO.sizeof);
> return LRESULT.ZERO;
> }
> return result;
> }
>
> if the fix is urgent you can download the development release of the SWT
> and merge the related changes to rebuild SWT(may lead to more problems)


thnx for the code .. i'll try it though i'm new to SWT. Meanwhile i
think i'll try to change so that i don't require that functionality and
i really don't want to go into the internals of SWT yet.
Re: maximize shell [message #731866 is a reply to message #731830] Mon, 03 October 2011 06:25 Go to previous message
Prasanth Ravi is currently offline Prasanth Ravi
Messages: 8
Registered: October 2011
Junior Member
On 10/3/2011 2:32 PM, vijay wrote:
> ohh sorry
>
> there is a bug entry for this
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=74001
>
> its an old one, re opened again,this seems to be a genuine request and i
> don't know why its taking so long..the fix also seems to be simple,which
> can be done in
>
> LRESULT WM_GETMINMAXINFO (int /*long*/ wParam, int /*long*/ lParam) {
> LRESULT result = super.WM_GETMINMAXINFO (wParam, lParam);
> if (result != null) return result;
> if (minWidth != SWT.DEFAULT || minHeight != SWT.DEFAULT) {
> MINMAXINFO info = new MINMAXINFO ();
> OS.MoveMemory (info, lParam, MINMAXINFO.sizeof);
> if (minWidth != SWT.DEFAULT) info.ptMinTrackSize_x = minWidth;
>
> //CHANGE ADD if (minWidth != SWT.DEFAULT) info.ptMaxTrackSize_x = maxWidth;
>
> if (minHeight != SWT.DEFAULT) info.ptMinTrackSize_y = minHeight;
>
> //CHANGE ADD if (minWidth != SWT.DEFAULT) info.ptMaxTrackSize_y =
> maxHeight;
>
> OS.MoveMemory (lParam, info, MINMAXINFO.sizeof);
> return LRESULT.ZERO;
> }
> return result;
> }
>
> if the fix is urgent you can download the development release of the SWT
> and merge the related changes to rebuild SWT(may lead to more problems)


thnx for the code .. i'll try it though i'm new to SWT. Meanwhile i
think i'll try to change so that i don't require that functionality and
i really don't want to go into the internals of SWT yet.
Re: maximize shell [message #731867 is a reply to message #731830] Mon, 03 October 2011 06:40 Go to previous message
Prasanth Ravi is currently offline Prasanth Ravi
Messages: 8
Registered: October 2011
Junior Member
thnx for the code :)
merging the changes however seems like an extreme step and since im new to SWT.. i don't want to break anything i can't fix considering it's SWT internals.
Previous Topic:is it possible to calculate a list index from a mouse point
Next Topic:Change SWT List selection color
Goto Forum:
  


Current Time: Fri Aug 29 16:30:47 EDT 2014

Powered by FUDForum. Page generated in 0.02397 seconds