[controlp5] conflicts with mouse event like mouseDragged()

edited December 2014 in Library Questions

Hi!

I have both Slider objects and mouseDragged() method. When click and drag on canvas, I can't use the sliders.. What is the solution?

Thanks so much.

Answers

  • Hi, a code example highlighting the difficulties you are encountering would be helpful.

  • edited December 2014 Answer ✓

    Sorry, I can't recreate the situation. Now I wrote this:

    import controlP5.*;
    
    ControlP5 gui;
    float radius;
    
    void setup(){
      size(400,400);
      radius = 20;
      createGUI();
    }
    
    void draw(){
    }
    
    void mouseDragged() {
      ellipse(mouseX, mouseY, radius, radius);  
    }
    
    void createGUI() {
      gui = new ControlP5(this);
      gui.addSlider("mySlider", 0, 50, 20, 20, 100, 10)
        .setValue(50)
        .setLabel("radius");
    }
    
    void mySlider(float value) {
      radius = value;
    }
    

    but it works!

    In my project instead, when I clicked on slider, I lost the possibility to interact with the canvas:

    1. mouse drag on canvas: create shapes
    2. mouse drag slider
    3. mouse drag on canvas: nothing
    

    Now my project has grown and the mouseDragged feature was replaced.

    Sorry for useless post, but thanks anyway.

Sign In or Register to comment.