Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    SpinnerItem for integer. How to restrict width?

    I have a spinner that has a range of 0 - 23. So max 2 digits. Yet it's being displayed as a wide field capable of around 10 digits.

    How do I make it smaller?

    I have tried:

    setLength(2)
    setWidth(2)

    Nothing works.

    Here is my code:
    Code:
            SpinnerItem sendTimeHr = new SpinnerItem();
            sendTimeHr.setName("sendTimeHr");
            sendTimeHr.setMax(23);
            sendTimeHr.setMin(0);
            sendTimeHr.setTitle("Time:");
            sendTimeHr.setLength(2);
            sendTimeHr.setWidth(10);
            sendTimeHr.setDefaultValue(hour);

    #2
    I'm having the same problem. Did you get answers? Thanks!

    Comment


      #3
      setLength() acts as a validator, setWidth() is what you want, but it needs to take in account the icons which are 16 pixels wide. So If you wanted the textbox to be 20 pixels wide you need to setWidth to 36, otherwise it works fine.

      Comment


        #4
        Thanks for the response. It worked!

        I was using setWidth(20) before and I guess that that was too little to display the spinner buttons.

        Comment

        Working...
        X