Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Radio button labels in controlP5

$
0
0

Hi everyone!

I have been using Processing for a couple of weeks now and am trying to develop a GUI where I can get user input via checkboxes, radiobuttons, dropdowns, etc.

But I'm running into trouble with the radio buttons. Specifically, I'm using loadImages() in order to replace the simple box that is the default (replacing it with an image of a circle with or without a fill- see screen shot). This part works! But then the labels are not visible. I've tried showLabels(), but it doesn't do anything if I'm using it with loadImages(); works fine if I comment out the loadImages() part of it. Here is my code snippet:

//Note, drawInputsP1() gets called when a button is pressed on the previous page, it's not called in draw().

void drawInputsP1() { cp5_1 = new ControlP5(this); PImage rb[] = {loadImageIO("rb_default.tif"),loadImageIO("rb_over.tif"), loadImageIO("rb_active.tif")}; radio_button1 = cp5_1.addRadioButton("experience");
rb[0].resize(20,20); rb[1].resize(20,20); rb[2].resize(20,20); radio_button1.setPosition(width/2,height/2) .setSize(rb[0]) .setImages(rb[0],rb[1],rb[2]) .addItem("A",1) .addItem("B",2) .addItem("C",3) ; }

radio_buttons

Is there a way to make the labels of each option visible while still using my own images? If not, does anyone have other suggestions on how to implement a radio button that looks more like the screenshot above?

Thank you in advance!


Viewing all articles
Browse latest Browse all 2896

Trending Articles