How to unplug a method attached to a controller


#1

Hi!
I’m using the Game Control Plus library to configure a game pad to control a Processing GUI. It’s working good and I’m happy with it but I’m stuck now. I would like to change the behavior of the game pad buttons pressing the Select button, one behavior to navigate into menu options and one behavior to control some stepper motors.
I want to plug the button to a method for one behavior, unplug it, and plug the button to another method for another behavior, but I don’t know how to unplug the button from the first method.
Next code works well:

import org.gamecontrolplus.;
import org.gamecontrolplus.gui.
;
import controlP5.*;
ControlP5 cp5;

ControlIO control;
ControlDevice gPad;

void setup ()
{
control = ControlIO.getInstance(this);
gPad = control.getMatchedDeviceSilent(“Dragon”);
if (gPad == null)
{
println(“Joystick not connected.”);
System.exit(-1); // End the program NOW!
}

gPad.getButton(“btnRUp”).plug(this,“getbtnRUp1”, ControlIO.ON_RELEASE);
}

But I don know how to unplug it :frowning:

Please, help me to unplug this method from my btnRUp button. Thx!!