STR #1331

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 1.1 ]

STR #1331

Application:FLTK Library
Status:1 - Closed w/Resolution
Priority:2 - Low, e.g. a documentation error or undocumented side-effect
Scope:3 - Applies to all machines and operating systems
Subsystem:Core Library
Summary:Fl_Spinner inability to accept floating point input
Created By:esok
Assigned To:matt
Fix Version:1.1-current (SVN: v5348)
Update Notification:

Receive EMails Don't Receive EMails

Trouble Report Files:

No files

Trouble Report Comments:

Name/Time/Date Text top right image
#1 esok
21:26 Jun 20, 2006
Version 1.1.7:

The Fl_Spinner by default is set to type FL_INT_INPUT. This cannot be changed without subclassing the widget. However, if a format of a floating point type is used, then the type should be changed to FL_FLOAT_INPUT. This is done with the following implementation of format() within Fl_Spinner.H:

void format(const char *f) {
  format_ = f;
  char buf[30];
  snprintf(buf, sizeof(buf), format_, 0.1);
  if (strchr(buf, '.')) input_.type(FL_FLOAT_INPUT);

This code will change the input type to floating point if the number 0.1 , when formatted by the format, contains a "." character.

Alternatively, a input_type() method can be added to Fl_Spinner to change the underlying input_.type(), but this might break binary compatibility.
#2 mike
06:53 Jun 21, 2006
Your proposed fix is not correct, and might lead to some strange results.

Better to just look for "f", "g", or "e" in the format string, and/or to do it based on changes to step() if the value is not an integer.

(FWIW, the original implementation used integers and was only extended for floating point input when I added it to FLTK...)
#3 matt
00:37 Jun 22, 2006
Fixed in Subversion repository.

Added "type()" function to Fl_Spinner (although it is unfortunatly not virtual). Added Spinner support to Fluid. Added documentation w/warnings. Added Spinner to Valuator test.
#4 mike
05:56 Jun 22, 2006
Matthias, the fix is not correct, reopening until I get the correct fix committed...  
#5 matt
07:38 Aug 23, 2006
Second attempt to fix this right. This time, I use the formatting code from Fl_Valuator in a simplified form. Comments welcome.  
bottom left image   bottom right image

Return to Bugs & Features ]


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