Dashboard Widget Question

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

  1. macrumors 68000

    atari1356

    Joined:
    Feb 27, 2004
    #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 emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #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

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

    atari1356

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

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #5
    Fair enough! It was sitting on my desk at work, so handy. Give this a shot...
     

Share This Page