Solving touch issue

the controlP5 library works fine on pc but on android smartphones there is touch issue the sliders conflicted with each other because using touch not mouse for instance if you drag slider bar and left it then touch else where on lcd the slider still activated and change its position

i made my first project for android but i was using pc when i transferred to android on my tablet i was shocked did not expected the slider issue
after month of searching i find how to make it done

i have found other forked library i use it at first its was same as the original controlP5 library but i run example by chance on my tablet i have noticed that there is no issue with sliders or buttons while activated the slider if you touch any where of lcd slider still stable and not conflicted it was just one example behave so and all others examples just like the controlP5 library the sliders and buttons suffering same issue

i study the example and fined what prevent the slider from moving while you touch any part of tablet lcd

here is the library

github.com

Rea-lity-Tech/Skatolo

Skatolo a ControlP5 for for MultiTouch, Augmented Reality and JRubyArt

its controlP5 library cloned

and here is the example

import tech.lity.rea.skatolo.*;
import tech.lity.rea.skatolo.gui.controllers.*;


Skatolo skatolo;
int myColor = color(0,0,0);

int sliderValue = 100;
int sliderTicks1 = 100;
int sliderTicks2 = 30;
Slider abc;

void setup() {
  size(700,400);
  noStroke();
  skatolo = new Skatolo(this);
  
  // add a horizontal sliders, the value of this slider will be linked
  // to variable 'sliderValue' 
  skatolo.addSlider("sliderValue")
     .setPosition(100,50)
     .setRange(0,255)
     ;
  
  // create another slider with tick marks, now without
  // default value, the initial value will be set according to
  // the value of variable sliderTicks2 then.
  skatolo.addSlider("sliderTicks1")
     .setPosition(100,140)
     .setSize(20,100)
     .setRange(0,255)
     .setNumberOfTickMarks(5)
     ;
     
     
  // add a vertical slider
  skatolo.addSlider("slider")
     .setPosition(100,305)
     .setSize(200,20)
     .setRange(0,200)
     .setValue(128)
     ;
  
  // reposition the Label for controller 'slider'
  skatolo.getController("slider").getValueLabel().align(skatolo.LEFT, skatolo.BOTTOM_OUTSIDE).setPaddingX(0);
  skatolo.getController("slider").getCaptionLabel().align(skatolo.RIGHT, skatolo.BOTTOM_OUTSIDE).setPaddingX(0);
  

  skatolo.addSlider("sliderTicks2")
     .setPosition(100,370)
     .setWidth(400)
     .setRange(255,0) // values can range from big to small as well
     .setValue(128)
     .setNumberOfTickMarks(7)
     .setSliderMode(Slider.FLEXIBLE)
     ;
  // use Slider.FIX or Slider.FLEXIBLE to change the slider handle
  // by default it is Slider.FIX
  

}

void draw() {
  background(sliderTicks1);

  fill(sliderValue);
  rect(0,0,width,100);
  
  fill(myColor);
  rect(0,280,width,70);
  
  fill(sliderTicks2);
  rect(0,350,width,50);

  println("Mouse : "+   skatolo.getMouseX() + " " + skatolo.getMouseY() );
  println("Mouse2 : "+   mouseX + " " + mouseY );
}

void slider(float theColor) {
  myColor = color(theColor);
  println("a slider event. setting background to "+theColor);
}

if you add this line from the code to any other example or other code of you own the touch issue will gone from tablet or phone or any lcd touch device this line in the example

println("Mouse : "+   skatolo.getMouseX() + " " + skatolo.getMouseY() );
  println("Mouse2 : "+   mouseX + " " + mouseY );

adding this to any sketch using this library solves touch issue

for any question just ask

have fun

Thanks for your help but, I have downloaded the lib from Github en extracted the zip file to the Libraries folder in my Sketch folder where my other libs are located. in order to get the lib recognized by processing the extracted files should have the following structure: ```

your sketch folders
                 libraries
                       theNewLibrary
                             examples
                             library
                                   theNewLibrary.jar
                             reference
                             src

which is not the case with the Skatolo lib there even is no .jar file. Am I doing something wrong? ```

Try just dragging the jar file onto your sketch.

Great but there is no .jar file
Clip001

Try this instead

http://www.sojamo.de/libraries/controlP5/

Paul that is where the trouble started.

Uhm… not sure what thats supposed to mean? Have yoilu already tried the link?

@mmuylle

just unzipp it in your processing libraries folder and call it inside you sketch

use it as any ordinary library

@mmuylle try this link

Thanks a lot. This was a great help. Apparently the skatolo lib does not have Label controller but I could use Textarea instead. There is an LabelExtended example but that use deprecated settings.

Thanks for your help. The button problem is solved now. Regards

1 Like

@mmuylle is it work for you ?

@mmuylle for slider or button only you can use something like this

forum button class question

http://kll.engineering-news.org/kllfusion01/print.php?type=A&item_id=154#here1

I unziped this file into the Documents/Processing/libraries folder, but processing 4 does not recognize it… Any ideas? Thanks

Hi

I am sorry I tested it with processing 3 at that time and works fine with slider and button and didn’t test other options

I am using processing 3 until now

I am on processing 4. Let me see if I have processing 3 installed.

Also, reading the forums I found out that if we drag the .jar file into the IDE, it at least finds the library.

Hi

Once I installed the library direct on my Android tablet using APDE 5.1 working same as processing android mode