Project

General

Profile

Actions

Bug #721

closed

no text formatting option in WSpinBox

Added by Christophe Delépine about 13 years ago. Updated almost 13 years ago.

Status:
Closed
Priority:
High
Assignee:
Target version:
-
Start date:
02/15/2011
Due date:
% Done:

0%

Estimated time:

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

gui.jpg (257 KB) gui.jpg Christophe Delépine, 02/15/2011 02:13 PM
Actions #1

Updated by Koen Deforche about 13 years ago

  • Status changed from New to InProgress
  • Assignee set to Pieter Libin
Actions #2

Updated by Pieter Libin about 13 years ago

  • Status changed from InProgress to Resolved

fixed in git

Actions #3

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
Actions #4

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

Actions #5

Updated by Koen Deforche about 13 years ago

Christophe, you're right (for the record!). To be dealt with together with #727

Actions #6

Updated by Koen Deforche about 13 years ago

  • Status changed from Resolved to InProgress
  • Assignee changed from Pieter Libin to Koen Deforche
Actions #7

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().

Actions #8

Updated by Koen Deforche almost 13 years ago

  • Status changed from Resolved to Closed

Available in Wt 3.1.9

Actions

Also available in: Atom PDF