gordy43 / controlp5

Automatically exported from code.google.com/p/controlp5
0 stars 0 forks source link

loadProperties doesn't work if Slider trigger event is set to RELEASE #83

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Change ControlP5Properties sets example to have this:
cp5.addSlider("slider2", 0, 255, 20, 100, 128, 
20).setId(1).setTriggerEvent(Slider.RELEASE);
2. Add these prints:
void b4(float v) {
  println("(1) slider2: " + slider2);
  cp5.loadProperties(("default.ser"));
  println("(2) slider2: " + slider2);
}

3. Change slider2 value to something, hit save default.
4. Change slider2 value to something else, hit load default.

What is the expected output? What do you see instead?
slider2 variable should have the saved value.

Original issue reported on code.google.com by jar...@coloursandnumbers.net on 29 Aug 2013 at 6:48

GoogleCodeExporter commented 8 years ago
Workaround, set all sliders to trigger mode PRESSED before calling 
loadProperies():

      for(ControllerInterface c : cp5.getAll())
      {
        if(c instanceof Slider)
        {
          Slider s = (Slider)c;
          s.setTriggerEvent(Slider.PRESSED);
        }
      }
      cp5.loadProperties(presetPath);
      // Now set them back...

Original comment by jar...@coloursandnumbers.net on 30 Aug 2013 at 4:53