Dashboard Widget Question

Discussion in 'Mac Programming' started by atari1356, Nov 22, 2004.

  1. macrumors 68000

    atari1356

    #1
    A simple question for anybody who has Tiger:

    With the Calculator widget Apple currently has in Tiger, can you use the number keypad on your keyboard to enter information? Or do you have to use the mouse and click on each number? Since the widgets are built using html/css/javascript I'm not sure if that's possible.

    I'm curious because I'm trying to develop my own calculator app, and am debating on whether to make it a Widget - or full blown Cocoa app.

    Thanks :)
     
  2. Moderator

    robbieduncan

    Staff Member

    #2
    Not at home to try it out for you, but it is perfectly possible to capture keyboard events in JavaScript. Take a look at Chapter 19 of "JavaScript The Definitive Guide" if you have a copy.

    Take a look at the onkeypress (or onkeydown) handlers for the body tag.
     
  3. macrumors member

    #3
    yes it can, but first you'll have to click once on the calculator :)
     
  4. macrumors 68000

    atari1356

    #4
    Thanks, I don't have that book but I'll see if I can find out how to do that elsewhere. :)
     
  5. Moderator

    robbieduncan

    Staff Member

    #5
    Fair enough! It was sitting on my desk at work, so handy. Give this a shot...
     

Share This Page