FLTK logo

Re: [fltk.general] Automatically resize buttons?

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Automatically resize buttons? supsm17 Jun 21, 2021  
  Thanks. I've noticed that widget->measure_label() and fl_measure() have the same value, which isn't correct. fl_text_extents() has a different value which is closer, but still isn't the correct value. Do you know why this is?
On Monday, June 21, 2021 at 10:38:48 AM UTC-7 Albrecht Schlosser wrote:
On 6/21/21 6:44 PM supsm17 wrote:
> I have several buttons in a scroll. I want the buttons to only be the
> size of the label, instead of a fixed size which could be too short or
> too long for the label. Currently, I set a large value as the width so
> the text doesn't get cut off. However, this makes the scroll bar
> inaccurate, and there is a lot of whitespace at the end. Is there any
> way to accomplish this?

You can always measure the text (label) size with fl_measure() or
fl_text_extents(), then set the sizes accordingly.

https://www.fltk.org/doc-1.4/group__fl__drawings.html#gaccd92d0c0521b0aac30dcb856d438dcd

https://www.fltk.org/doc-1.4/group__fl__attributes.html#ga14cb75a92b6cdd576f9512b38a208f8b


If this doesn't answer your question I may have misunderstood what
you're looking for.

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/00dff953-6791-427a-ac86-f1f3ff935c8en%40googlegroups.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.