controlP5 Font Size of items in ScrollableList

edited June 2016 in Library Questions

Does anyone know if it is possible to change the size of "item" text in scrollable lists ?

I can only find examples of changing the CaptionLabel .. i.e the header/name of your scrollable list, but not the size of the text for items within the list. Hopefully i'm just missing an obvious solution to improve the legibility of these items in the list.

Cheers, mala

Answers

  • Hi

    Can you try

    Scrollable scr = new scrollable(...). Additem("money"). Additem("creditcard").;
    scr. Getitem(0).setfont(...);
    scr. Getitem(1).setfont(...);
    

    This should do the trick. I apologize for not providing some real code. Having some issues finding my previous code with those lines. Let me know if it doesn't work.

    I hope this helps,

    Kf

  • thank you for the suggestion, trying this as below in the scrollableList example, I get the error "setFont(ControlFont)" does not exist ?

    cp5.get(ScrollableList.class, "dropdown").getItem(0).setFont(font);

    mala

  • of course I figured it out straight after posting the above!

    .getValueLabel.setFont(font)

    seems to work fine

  • Answer ✓

    Here is my code. Sorry for my delay.

    cf1 = new ControlFont(createFont("Arial",28,true),28);
    String[] _timeList = {"5", "10", "12", "15", "20", "25", "30", "35", "45"};
    List timeList = Arrays.asList(_timeList);
    cp5.addScrollableList("scrollDownTList")
         .setPosition(2.0/5*width,12.25/22*height)
         .setSize((int)(2.5/5*width),(int)(6.5/22*height))
         .setBarHeight((int)(1.5/22*height))
         .setItemHeight((int)(1.5/22*height))
         .addItems(timeList)
         .setFont(cf1);
    

    Kf

Sign In or Register to comment.