This is a migrated thread and some comments may be shown as answers.

Radwindow Maximize/Restore Issue

5 Answers 184 Views
Window
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 16 Dec 2010, 12:14 AM
Hello,

I apologize if this is a duplicate post, I did some searching and although there are some other related posts I could not find one exactly matching my issue that had a solution that worked.  I am creating RadWindows dynamically via javascript (no server code involved) and have set my radwindowmanager initializebehavior to 'maximize' so when the window opens up it is maximized.  I also allow the user to minimize and resize. When I resize the window and move the window around the screen, then minimize, then restore, the window returns to the position and size I last had it as I expected.  However, if I open the window maximized, then minimize it, then restore, the window will not restore maximized.  It comes up a smaller size and centered on the page.  It doesn't seem to remember that it was maximized.  Is there anything I can do to correct this issue?  I found I can use the onclientcommand to always maximize on restore, but I would rather the window return to the initial size and position it was before it was minimized.

Thank you!
Richard

5 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 16 Dec 2010, 05:11 PM
Hello Richard,

We are considering to change this behavior i.e. when you restore a minimized RadWindow that was maximized before, it will be restored maximized, but this would happen in a future release. For now I would suggest to use the solution that you found with OnClientCommand, but to add another step in the logic.
My idea is to raise a flag (global variable / value in a hidden field), when a RadWindow is maximized. Then when you restore the RadWindow you can check the flag and if it exists, (i.e. the window was previously maximized), to manually call maximize() again.

I hope this helps.

Greetings,
Georgi Tunev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Matt Vargos
Top achievements
Rank 1
answered on 15 Aug 2011, 09:09 PM
Hello All,

I saw this issue and it was mentioned to use OnClientCommand to automatically maximize a page each time it is restored but I could not find code to help figure this out.  After spending quite a bit of time on it myself, I finally came across a solution for those that are opening the window from the client side and then need to manipulate it to avoid the restore state and automatically go between minimized and maximized.  I've pasted code below and hope if helps others. 

function OpenWindow(URL) {
    params = ''
    var wnd = window.radopen(URL, 'RadWindow1', params);
    wnd.set_title('Test Window');
    wnd.set_behaviors(Telerik.Web.UI.WindowBehaviors.Maximize + Telerik.Web.UI.WindowBehaviors.Minimize + Telerik.Web.UI.WindowBehaviors.Close);
    wnd.set_visibleStatusbar(false);
    wnd.set_skin('Web20');
    wnd.set_keepInScreenBounds(true);
    wnd.moveTo(0, 0);
    wnd.maximize();
    wnd.add_command(OnClientCommand);
    return true;
}

function OnClientCommand(sender, eventArgs) {
    var commandName = eventArgs.get_commandName();
    if (commandName == 'Restore') {
        //Cancel the restore event and call maximize instead to always maximize the window.
        eventArgs.set_cancel(true);
        sender.Maximize();
    }
}

0
Jens Olesen
Top achievements
Rank 1
answered on 28 Aug 2012, 07:32 AM
Has this behavior been implemented in newer releases ?

"We are considering to change this behavior i.e. when you restore a minimized RadWindow that was maximized before, it will be restored maximized"

Thanks
0
Marin Bratanov
Telerik team
answered on 28 Aug 2012, 02:08 PM
Hi Jens,

This has not been requested by our clients since and thus the behavior has not been changed. You can still use a few lines of JavaScript to get it, as shown in the previous post and as suggested by my colleague Georgi - by using a certain field to hold a flag, for example:
function OnClientCommand(sender, eventArgs)
{
    var commandName = eventArgs.get_commandName();
    if (commandName == 'Minimize')
    {
        sender.wasMaximized = sender.isMaximized();
    }
    if (commandName == 'Restore')
    {
        if (sender.wasMaximized)
        {
            setTimeout(function ()
            {
                sender.maximize();
                sender.wasMaximized = false;
            }, 0);
        }
    }
}



Regards,
Marin Bratanov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Jens Olesen
Top achievements
Rank 1
answered on 29 Aug 2012, 12:06 PM
Thanks - works perfect !
Tags
Window
Asked by
Richard
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Matt Vargos
Top achievements
Rank 1
Jens Olesen
Top achievements
Rank 1
Marin Bratanov
Telerik team
Share this question
or