Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Posted in: Widget Development

Resizing does not work

Author Message
jumpingfish



Joined: 02 Feb 2006
Posts: 2
Location: Hannover/Germany

Posted: Mon Sep 18, 2006 - 3:17 am    Post subject: Resizing does not work Reply with quote

Hello,

I'm currently developing a new version of my widget (mensaH).
I've implemented resizing with drag & drop.
I then save the new widget size in my preferences.

Now I flip to the back of the widget and resize my widget to a standard size (to show the prefs).
Of course I don't save that new size.

When I now hit the Done-button and flip back to the front, my widget should resize to the saved size.

But that does not work.
It stays the same size.
Only when I reload the widget (command-r) it has the saved size.

Here is my code:

Code:
function hidePrefs()
{
    var front = document.getElementById("front");
    var back = document.getElementById("back");

    if (window.widget)
        widget.prepareForTransition("ToFront");

    back.style.display="none";
    front.style.display="block";

    if (window.widget)
        setTimeout ('widget.performTransition();', 0);
       
    loadPage(); // lädt die Speiskarten aus dem Web und zeigt die an
   
    if(windows.widget)
    {
        var windowWidth =
widget.preferenceForKey(makeKey("windowWidth"));
        var windowHeight =
widget.preferenceForKey(makeKey("windowHeight"));
               
        window.resizeTo(parseInt(windowWidth), parseInt(windowHeight));
    }
}


The last paragraph does not work like excepted.

What am I doing wrong?

It seems, I need a refresh-command, but I think, that's the wrong way, cause Apple isn't using one either.


TIA


Greetings,
sebid
View user's profile Send private message Send e-mail Visit poster's website Widgets
galendw



Joined: 30 May 2005
Posts: 71
Location: Here.

Posted: Mon Sep 18, 2006 - 8:11 am    Post subject: Reply with quote

As far as I can tell, the only thing that looks wrong in the code is this:

Code:
if(windows.widget)


Instead, this should be:

Code:
if(window.widget)

_________________
View user's profile Send private message Send e-mail Visit poster's website Widgets
jumpingfish



Joined: 02 Feb 2006
Posts: 2
Location: Hannover/Germany

Posted: Tue Sep 19, 2006 - 4:10 am    Post subject: Reply with quote

Thank you so much.

That typo was the only mistake. Sometimes I am so blind.


But there's now a new problem. My widget gets cut, when I switch back.
Only when you click in it, it has it's full size.

Here is the full widget for download, so you can see for yourself:
http://jf.hagga.net/download/mensaH.wdgt.zip

I absolutely did not know, why it is so.

When you look in the source code don't get shocked. It's terrible coding style, I know. Wink

Greetings,
sebid
View user's profile Send private message Send e-mail Visit poster's website Widgets
mapled



Joined: 10 Jul 2007
Posts: 2
Location: Germany

Posted: Tue Jul 10, 2007 - 3:29 pm    Post subject: smooth resize Reply with quote

The topic is quite old , but I was looking so long for a solution and finally found one.
On the one hand it works, on the other hand it looks pretty cool Cool .

So have a look here: http://developer.apple.com/samplecode/Resizer/listing3.html

This code resizes the widget smoothly to its preference size, performs the flip and vice versa.

Maybe everybody know this solution, but for me it was hard to find. So hopefully it will help other people with the same problem.

Take care,
Philipp
View user's profile Send private message Send e-mail Visit poster's website Widgets
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

 
Powered by phpBB © 2001, 2002 phpBB Group