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

Keyboard focus

Author Message
smarl



Joined: 17 Jan 2006
Posts: 2

Posted: Tue Jan 17, 2006 - 9:21 am    Post subject: Keyboard focus Reply with quote

I am building a widget that accepts keyboard input, and more to the point, remote control input. The only problem I'm having is that if the widget loses focus, I can't figure out a way to automatically gain keyboard focus back.

I have assigned a function to widget.onshow that brings the widget to the foreground using window.focus(). I have tried focus() on body and other elements in the "page", but they silently fail, leaving the widget in a braindead state.

So, to sum up my goal... I want my widget, every time dashboard is invoked, to come to the foregound and gain keyboard focus, so that the widget receives keyboard events, without having to touch the mouse.

Any thoughts?
View user's profile Send private message Send e-mail Widgets
SpiralOcean



Joined: 16 Jul 2006
Posts: 5

Posted: Mon Feb 05, 2007 - 11:53 pm    Post subject: Reply with quote

Did you figure this out? I'm looking for the same thing.

I guess one of the issues with this is what if there are two widgets that are requesting focus. But that can be solved another time... Smile
View user's profile Send private message Send e-mail Widgets
smarl



Joined: 17 Jan 2006
Posts: 2

Posted: Tue Feb 06, 2007 - 11:37 am    Post subject: Reply with quote

No. I've had no luck. The machine is essentially headless except for the remote control, but if that widget loses focus, I have to VNC in to the machine to click it before I can use it with the remote.

Here's what I'm working on, in case you're interested:
http://gumundertheseat.sourceforge.net/
View user's profile Send private message Send e-mail Widgets
SpiralOcean



Joined: 16 Jul 2006
Posts: 5

Posted: Tue Feb 06, 2007 - 9:28 pm    Post subject: Reply with quote

Here's an idea.. work with the window.widget object. Add this code to javascript

if (window.widget)
{
widget.onhide = onhide;
widget.onshow = onshow;
}

The onshow is a function:

onshow(){
//some javascript to add focus to the widget
}

When the dashboard is made visible, the onshow function will run inside your widget.

All you have to do is make one of the javascript activate the widget... Maybe an object or a control or even clicking a fake button would probably do it.

Let me know if this helps.
View user's profile Send private message Send e-mail Widgets
islayermarc



Joined: 07 Dec 2005
Posts: 57
Location: Melbourne

Posted: Mon Feb 26, 2007 - 9:29 am    Post subject: Reply with quote

Brilliant idea for a widget.

Let me know if you need a hand with some graphics.
_________________
Over 5.5 million widget and application downloads... and counting.
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