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

How to set a gadgets default location on the scree

Author Message
Solsonic



Joined: 27 Mar 2005
Posts: 19
Location: California

Posted: Mon Jul 12, 2004 - 4:58 am    Post subject: Imported from The Dashboader Reply with quote

I was wondering if anyone knew how I can set a default screen position for a gadget. Can I use the same JS used to resize windows when creating popups and what not, and use a onload function? Or can I set it in the Info.plist. Thanks....Solsonic
View user's profile Send private message Send e-mail Visit poster's website Widgets
joephish



Joined: 27 Mar 2005
Posts: 17
Location: Scotland

Posted: Mon Jul 12, 2004 - 4:58 am    Post subject: Imported from The Dashboader Reply with quote

Yeah but maybe's it's unsupported for a reason - apple don't want people messing with the position... they want the gadget to be fixed.

It's a shame, becauseI thought it would be cool to have a dice rolling gadget - you pick up a die and throw it over the dashboard and it rolls and lands You could have all sorts of different dice, with different numbers and messages on the sides...
View user's profile Send private message Visit poster's website Widgets
Chris



Joined: 27 Jan 2005
Posts: 344
Location: Durham, UK

Posted: Mon Jul 12, 2004 - 4:58 am    Post subject: Imported from The Dashboader Reply with quote

Anyways, I tried gadget.moveTo(x,y), and no dice

I decided to actually read the dashboard docs again, and the reason that didn't work is because it's not a supported method. D'Oh!

Hmm - seems a bit lacking. I wonder if there'll be support for it in future versions...
View user's profile Send private message Send e-mail Visit poster's website AIM Address Widgets
joephish



Joined: 27 Mar 2005
Posts: 17
Location: Scotland

Posted: Mon Jul 12, 2004 - 4:58 am    Post subject: Imported from The Dashboader Reply with quote

The only way I can think of is pretty complicated, but...

If you can get the gadget there at all, then you can stop the user from moving it using addControlRect(x, y, fullWidth, fullHeight) so that no point on the gadget becomes a handle with which to move it.

Now, to put the gadget in the top right of the screen in the first place, you could mess with the com.apple.dashboard.plist preferences file, which holds the user's locations for all of the gadgets, if you are totally certain you know what you are doing! (anyone know what the id tag in the XML does? Does it matter what is stored there?)

So, the short version: you could set the location of your gadget quite easily in an installer script which modified the user's dashboard preferences.
View user's profile Send private message Visit poster's website Widgets
Solsonic



Joined: 27 Mar 2005
Posts: 19
Location: California

Posted: Mon Jul 12, 2004 - 4:58 am    Post subject: Imported from The Dashboader Reply with quote

I wanted to know how to set the position on the screen because I was thinking about placing the Dictionary Search Plus where spotlight would be. But I guess its true that the user will move the gadget where he/she wants so... Anyways, I tried gadget.moveTo(x,y), and no dice, I would still like to know how to accomplish this though.
Wink
View user's profile Send private message Send e-mail Visit poster's website Widgets
Chris



Joined: 27 Jan 2005
Posts: 344
Location: Durham, UK

Posted: Mon Jul 12, 2004 - 4:58 am    Post subject: Imported from The Dashboader Reply with quote

Out of interest, why would it matter where your gadget appears on the screen? Surely it wouldn't affect the usabiliy if it appeared in the same way that all other gadgets appear?

Well, one of the things I'm working on is screen rulers, and that needs the position set. Although, I'm not convinced how well it's working as a gadget...

Edit: The rulers, I suppose, don't really need to set their own positioning really - but the resolution thing I'm working on does. (too many things at once makes my brain break...)
View user's profile Send private message Send e-mail Visit poster's website AIM Address Widgets
cripen



Joined: 27 Mar 2005
Posts: 26
Location: UK

Posted: Mon Jul 12, 2004 - 4:58 am    Post subject: Imported from The Dashboader Reply with quote

Out of interest, why would it matter where your gadget appears on the screen? Surely it wouldn't affect the usabiliy if it appeared in the same way that all other gadgets appear?
View user's profile Send private message Widgets
Solsonic



Joined: 27 Mar 2005
Posts: 19
Location: California

Posted: Mon Jul 12, 2004 - 4:58 am    Post subject: Imported from The Dashboader Reply with quote

Thanks for the advise guys. I'll try that method Chris. hopefully I can get it to work. I'll let ya know.
View user's profile Send private message Send e-mail Visit poster's website Widgets
Chris



Joined: 27 Jan 2005
Posts: 344
Location: Durham, UK

Posted: Mon Jul 12, 2004 - 4:58 am    Post subject: Imported from The Dashboader Reply with quote

I'm not able to try this at the moment because I'm at work, but I'd imagine adding gadget.moveTo(x,y); to a function attached to the onload event would work...
Saying that - I imagine it doesn't even need to be called on the onload event. Presumably you do something like if (gadget) {... stuff for controlRects etc .. }, so you could chuck it in there.

The thing is - people will move their gadgets to where they are most convenient to them (I know I do), so it could be quite annoying if a gadget kept moving itself from where you want it to be (like finder windows...)
View user's profile Send private message Send e-mail Visit poster's website AIM Address Widgets
Chris



Joined: 27 Jan 2005
Posts: 344
Location: Durham, UK

Posted: Mon Jul 12, 2004 - 4:58 am    Post subject: Imported from The Dashboader Reply with quote

You could cheat for that and just have an absolutely huge gadget which encompasses the screen but has a clear background. Not sure if it'd be an arse for selecting other gadgets though (i.e. prevented you from doing so).

I'd definitely like to see moveTo/By implemented though. If people don't like gadgets that mess around with the positioning (without good reason) they just wont use them, or they can tell the developer to stop doing it...
View user's profile Send private message Send e-mail Visit poster's website AIM Address 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