FLTK logo

Re: [fltk/fltk] Setting width of display area of slider value (Issue #285)

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.issues  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: [fltk/fltk] Setting width of display area of slider value (Issue #285) Albrecht Schlosser Oct 21, 2021  
 

Some parts of the given answer with code suggestions:

The problem is that the size is hardcoded to 35 for horizontal or 25 for vertical. You need to modify Fl_Value_Slider.cxx. In the routine draw, it has

if (horizontal()) {
  bww = 35; sxx += 35; sww -= 35;
} else {
  syy += 25; bhh = 25; shh -= 25;
}

This is based on a textsize of 10. If you change the text size, then it needs to go up based on the text size. Something like

if (horizontal()) {
   int width = textsize() * 3 + 5;
   bww = width; sxx += width; sww -= width;
} else {
   int height = textsize() * 2 + 5;
   syy += height; bhh = height; shh -= height;
}

Then rebuild the fltk library. Either keep this patch or send it to FLTK ...

Thanks to cup for this answer and patch suggestion. I can't tell if this is the correct or best patch but it's something that should be considered.

In the final version this should likely get a new method to set the different drawing sizes. This is not only true for Fl_Hor_Value_Slider but also for several other slider types and even some more widgets.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

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'.