# setSwitch(true) Error

**URL:** <https://discourse.processing.org/t/setswitch-true-error/19927>\
**Category:** Libraries\
**Created:** [April 19, 2020, 11:20am UTC](https://discourse.processing.org/t/setswitch-true-error/19927 "2020-04-19T11:20:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![shoaibmirza](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/shoaibmirza/32/923_2.png) [@shoaibmirza](https://discourse.processing.org/u/shoaibmirza)\
**Post date:** [April 19, 2020, 11:20am UTC](https://discourse.processing.org/t/setswitch-true-error/19927/1 "2020-04-19T11:20:06Z")

</div>

Hi,  
I’m having an issue with the controlP5 Library in processing.

> `setSwitch(true)`

I’m using this line of code to make the button `toggle`. it works but I’m getting this error message.

```auto
 controlP5.ControlBroadcaster invokeMethod
 WARNING: java.lang.IllegalArgumentException: wrong number of arguments

```

the program doesn’t crash but it’s slowing down.

and this is my code…

```auto
button_settngs.addButton("settings")
    .setPosition(50, 50)
    .setValue(0)
    .setImages(settings_button_img)
    .updateSize()
    .setSwitch(true)
    ;

```

If i make setswitch(false) everythis works fine. imean no error message.

thanks in advance.
