Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Question about tweaking G4P 3.5

$
0
0

I wrote a program I use a lot it Processing 2.2.1 and use G4P as part of the GUI. The problem is, I use a pen monitor and the GUI doesn't allow my pen touches ( MouseEvent.PRESSED) to trigger an event. It requires a click (MouseEvent.CLICKED). A few cut and pastes in different java files and I pretty much fixed that:

        case MouseEvent.PRESS:
        if(focusIsWith != this && currSpot >= 0  && z > focusObjectZ()){
                dragging = false;
                status = PRESS_CONTROL;
                takeFocus();
                if(reportAllButtonEvents)
                    fireEvent(this, GEvent.PRESSED);
                bufferInvalid = true;

                if(focusIsWith == this){   //cut and pasted from below
                    status = OFF_CONTROL;
                    bufferInvalid = true;
                    loseFocus(null);
                    dragging = false;
                    fireEvent(this, GEvent.CLICKED);
                }
            }
            break;
        case MouseEvent.CLICK:
            // No need to test for isOver() since if the component has focus
            // and the mouse has not moved since MOUSE_PRESSED otherwise we
            // would not get the Java MouseEvent.MOUSE_CLICKED event
            if(focusIsWith == this){
                status = OFF_CONTROL;
                bufferInvalid = true;
                loseFocus(null);
                dragging = false;
                fireEvent(this, GEvent.CLICKED);
            }
            break;

This broke some scroll bars ( can't differentiate between clicks and drags), but my GUI doesn't use scroll bars except in droplists, and I just lengthened them so they didn't need scroll bars. This has much improved my workflow so I don't have to put down the stylus to click a button or a Checkbox in the gui. I would like to make one final tweak. I'd like to make the area to gain focus around the slider control a little larger. It work now, but you have to be right on top of the dot to get focus and slide it. I want to make it so you just have to be reasonably close. Where would I look for that in the source?


Viewing all articles
Browse latest Browse all 2896

Trending Articles