Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Cannot use the keyboard #1

Open
rossburton opened this issue Aug 9, 2012 · 4 comments
Open

Cannot use the keyboard #1

rossburton opened this issue Aug 9, 2012 · 4 comments

Comments

@rossburton
Copy link

I can't enter numbers of operators using my keyboard.

@davidmaxwaterman
Copy link
Contributor

not sure what to do about this...

@davidmaxwaterman
Copy link
Contributor

This app is designed for use with a touch screen, eg mobile phone, tablet, and laptop (eg Lenovo X1 Carbon). However, it would be nice to be able to get it working with a h/w keyboard; but I'm not sure how to do that exactly :

  1. perhaps the lower lcd could be a text input element - would need to be styled appropriately in order to minimise visual impact
  2. perhaps keyboard input could be captured by a hidden text input element, and so there would be no visual changes at all

@asadpakistani
Copy link

I do not require the scientific options. So I will do be doing it for my use case using the mousetrap library. If you find time before me feel free to do the whole mapping.

http://craig.is/killing/mice

@asadpakistani
Copy link

My current hack after including moustrap is:

    Calculator = new function() {
        Mousetrap.bind('0', function() {
            $('#button0').trigger('mousedown');
        });

        Mousetrap.bind('1', function() {
            $('#button1').trigger('mousedown');
        });

        Mousetrap.bind('2', function() {
            $('#button2').trigger('mousedown');
        });

        Mousetrap.bind('3', function() {
            $('#button3').trigger('mousedown');
        });

        Mousetrap.bind('4', function() {
            $('#button4').trigger('mousedown');
        });

        Mousetrap.bind('5', function() {
            $('#button5').trigger('mousedown');
        });

        Mousetrap.bind('6', function() {
            $('#button6').trigger('mousedown');
        });

        Mousetrap.bind('7', function() {
            $('#button7').trigger('mousedown');
        });

        Mousetrap.bind('8', function() {
            $('#button8').trigger('mousedown');
        });

        Mousetrap.bind('9', function() {
            $('#button9').trigger('mousedown');
        });

        Mousetrap.bind('.', function() {
            $('#buttondot').trigger('mousedown');
        });

        Mousetrap.bind('+', function() {
            $('#buttonadd').trigger('mousedown');
        });

        Mousetrap.bind('-', function() {
            $('#buttonsubtract').trigger('mousedown');
        });

        Mousetrap.bind('backspace', function() {
            $('#buttondelete').trigger('mousedown');
        });

        Mousetrap.bind('enter', function() {
            $('#buttonequal').trigger('mousedown');
        });

        Mousetrap.bind('c', function() {
            $('#buttonclear').trigger('mousedown');
        });

        Mousetrap.bind('*', function() {
            $('#buttonmultiply').trigger('mousedown');
        });

        Mousetrap.bind('/', function() {
            $('#buttondivide').trigger('mousedown');
        });

        this.localizer = null;
        this.parser = "";

This needs to be refactored in to a key map and single method.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants