0

I built a custom calendar control with many navegability features, the only issue im facing now is the month jump on shift+scrollwheel.

mainb.setOnScroll(e->{
            mainb.requestFocus();
            System.out.println(e.getDeltaY());
            if(e.isShiftDown()){
                if(e.getDeltaY()>0)
                    prev.fire();
                else
                    next.fire();
            }else if(e.isControlDown()){
                System.out.println(e.getDeltaY());
                if(e.getDeltaY()>0)
                    prevDay();
                else
                    nextDay();
            }else{
                if(e.getDeltaY()>0)
                    prevWeek();
                else
                    nextWeek();
            }
        });

code + component + console results

            if(e.isShiftDown()){
                if(e.getDeltaY()>0)//always 0.0
                    prev.fire();//never fired
                else
                    next.fire();//always fired
            }
  • have you tried to test to see if its an issue with shift and scroll wheel? try disabling its automatic function by adding `e.consume()` before `System.out.println`, alternatively for a test try using another key (not Shift and see if you get the same results) – TravisF Feb 24 '17 at 03:19
  • I had the same problem some time ago and was not sure whether this is a bug in JavaFX or whether this is so by design. I finally switched to use the alt-key instead and it worked. – mipa Feb 24 '17 at 08:49

1 Answers1

1

It seems as if the shift key is used to switch from vertical to horizontal scrolling (see: bugs). Therefore, e.getDeltaY() will return 0 when the shift key is pressed. Use e.getDeltaX() in this case.