Menu

#24 setSystemCursorEnabled(false) problem

v.2-090226
open
7
2016-01-13
2016-01-11
No

Hi Nicolas,
thanks a lots for your job, is great job.

I use jpen-2-150301, in my application i try to set wintabProvider.setSystemCursorEnabled(false);
but in this way the pen events are captures only if the mouse is on the component.

How we can solve it ?

In attach the sample.

Thanks in advice

BR
Marco Perrrone

1 Attachments

Discussion

  • Nicolas Carranza

    hi Marco,

    If you want to fully prevent the tablet from moving the cursor while changing the focus between various applications then I guess it won't be possible using jpen/wintab. For example, changing the active window (to another application) will cause the wintab context to change and this can cause the tablet device to begin changing the cursor position.

    For the sake of testing or understanding this limitation of jpen/wintab you can try something like Test.java :

    import jpen.event.PenListener;
    import jpen.PButtonEvent;
    import jpen.PenManager;
    import jpen.PKindEvent;
    import jpen.PLevelEvent;
    import jpen.provider.wintab.WintabProvider;
    import jpen.PScrollEvent;
    
    public class Test
        implements PenListener{
    
        public static void main(String... args) throws Throwable{
            new Test();
        }
    
        Test() throws InterruptedException{
            PenManager pm=new PenManager(ActivableScreenPenOwner.getInstance());
            pm.pen.addListener(this);
    
            WintabProvider wintabProvider = pm.getProvider(WintabProvider.class);
            if(wintabProvider!=null)
                wintabProvider.setSystemCursorEnabled(false);
    
            while(true){
                System.out.println("--- reactivating...");
                ActivableScreenPenOwner.getInstance().reactivate();
                Thread.currentThread().sleep(5000);
            }
        }
    
        //@Override
        public void penButtonEvent(PButtonEvent ev) {
            System.out.println(ev);
        }
        //@Override
        public void penKindEvent(PKindEvent ev) {
            System.out.println(ev);
        }
        //@Override
        public void penLevelEvent(PLevelEvent ev) {
            System.out.println(ev);
        }
        //@Override
        public void penScrollEvent(PScrollEvent ev) {
            System.out.println(ev);
        }
        //@Override
        public void penTock(long availableMillis) {
            System.out.println("TOCK - available period fraction: "+availableMillis);
        }
    }
    

    The ActivableScreenPenOwner.java file is attached. You can run Test.main and try changing focus to other application windows while moving the mouse and the tablet device alternatively. Here is the thread where the previous code was introduced.

    Cheers,
    Nicolas

     

    Last edit: Nicolas Carranza 2016-01-12
  • Marco Perrone

    Marco Perrone - 2016-01-13

    Hi Nicolas!
    Thanks a lot for the reply.

    I try to do it and it works correctly, thank you very much for your suggestion !!

    BR
    Marco Perrone