FLTK logo

STR #2035

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 
 Home  |  Articles & FAQs  |  Bugs & Features  |  Documentation  |  Download  |  Screenshots  ]
 

Return to Bugs & Features | Roadmap 2.0 | Post Text | Post File | SVN ⇄ GIT ]

STR #2035

Application:FLTK Library
Status:5 - New
Priority:1 - Request for Enhancement, e.g. asking for a feature
Scope:3 - Applies to all machines and operating systems
Subsystem:Unassigned
Summary:Getting odd slider values
Version:2.0-feature
Created By:bhb2048
Assigned To:Unassigned
Fix Version:Unassigned
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

Post File ]

No files


Trouble Report Comments:

Post Text ]
Name/Time/Date Text  
 
#1 bhb2048
13:03 Sep 05, 2008
I wanted a slider that would only have odd integer values (for setting a gaussian kernel size).  I set minimum=3 and maximum=11, step=2, linesize=2.  But when using it, the values were even (multiples of step).

This can be changed by modifying handle_drag() in Valuator.cxx as follows:

Current:
void Valuator::handle_drag(double v) {
  // round to nearest multiple of step:
  if (step_ >= 1) {
    v = rint(v/step_)*step_;

Modified:
void Valuator::handle_drag(double v) {
  // round to nearest multiple of step:
  if (step_ >= 1) {
    v = rint((v-minimum_)/step_)*step_ + minimum_;

This way both even & odd work.

Cheers,
Barry
 
     

Return to Bugs & Features | Post Text | Post File ]

 
 

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