Bug #721
closedno text formatting option in WSpinBox
0%
Description
Hi,
I need a way to set the text formatting option (%.2f for instance) for the float value in WSpinBox.
Currently WSpinBox::setValue uses :
setText(WT_USTRING::fromUTF8(boost::lexical_cast<std::string>(value)));
This leads to many unwanted 0s after the last significant digit and this also overwrites the arrows (see alpha value of 1.7000000 in attached snapshot)
As a work-around, i call setText again in the signal callback. However, one can see the text flickering due to 2 consecutive updates.
Regards
Christophe
Files
Updated by Koen Deforche about 13 years ago
- Status changed from New to InProgress
- Assignee set to Pieter Libin
Updated by Christophe Delépine about 13 years ago
Hi Pieter,
snprintf in formatFloat does not compile on Windows :
wt\src\web\Utils.C(519) : error C3861: 'snprintf': identifier not found
There is also a warning in the same file :
wt\src\web\Utils.C(492) : warning C4244: 'initializing' : conversion from 'std::streamoff' to 'int', possible loss of data
Updated by Christophe Delépine about 13 years ago
Hi Pieter,
After patching the code, i have done a test. It does not seem to work.
formatFloat is never called when i click on on the arrows.
I have tried on both firefox and chrome.
the only change i have done is calling setFormat("%.2f")
Regards
Christophe
Updated by Koen Deforche about 13 years ago
Christophe, you're right (for the record!). To be dealt with together with #727
Updated by Koen Deforche about 13 years ago
- Status changed from Resolved to InProgress
- Assignee changed from Pieter Libin to Koen Deforche
Updated by Koen Deforche about 13 years ago
- Status changed from InProgress to Resolved
I've split the API into WSpinBox and WDoubleSpinBox, and the formatting options have changed. There is now setDecimals(), setSuffix() and setPrefix().
Updated by Koen Deforche almost 13 years ago
- Status changed from Resolved to Closed
Available in Wt 3.1.9