Project

General

Profile

Actions

Bug #3882

closed

WSpinBox onChange is not working right

Added by Torsten Schulz about 9 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Benoit Daccache
Target version:
Start date:
03/07/2015
Due date:
% Done:

0%

Estimated time:

Description

When I use the onChange event, it should be fired when I click the up/down buttons or when I change the values with the keyboard.

But the change with the keyboard seems to be fired at the wrong time: Before the value is changed. I become the old value when I type in the values.

Tested with firefox and chrome on windows, mac and linux.

Actions #1

Updated by Koen Deforche about 9 years ago

  • Status changed from New to InProgress
  • Assignee set to Benoit Daccache
  • Target version set to 3.3.4
Actions #2

Updated by Benoit Daccache about 9 years ago

Hey,

The change event as well as the valueChanged event is not fired on keypress but only when the focus is changed.

These two events works well with the following code.

sb->valueChanged().connect(std::bind([=](double val) {
        std::cerr << "Value changed : " << val << std::endl;
          }, std::placeholders::_1));

sb->changed().connect(std::bind([=]() {
        std::cerr << "Value changed : " << sb->text() << std::endl;
          }));

Can you provide us an example where it fails ?

Regards,

Benoit

Actions #3

Updated by Torsten Schulz about 9 years ago

Hi,

I made it with this line:

        fBuyData.sellSizeField->changed().connect(boost::bind(&MyGameProduction::StockView::_showPrice, this, fBuyData));
...
void MyGameProduction::StockView::_showPrice(MyGameProduction::StockView::StockSellData aBuyData)
{
    aBuyData.priceField->setText("bla bla");
}

And here the setText isn't executed on changing the value by pressing keys, but when I leave the WSpinBox.

Regards

Torsten

Actions #4

Updated by Benoit Daccache about 9 years ago

Hey,

Could you try to listen to the Wt::WLineEdit::textInput() signal ? ( which is part of the latest git version )

Benoit

Actions #5

Updated by Torsten Schulz about 9 years ago

Hi Benoit,

I did try and it is working.

But only, because I didn't check it: Did you change the documentation too? Because I understand the changed() like the event is fired on text input too, not on leaving.

Greetings

Torsten

Actions #6

Updated by Benoit Daccache about 9 years ago

  • Status changed from InProgress to Resolved

Indeed it was not mentioned.

Thank you!

Benoit

Actions #7

Updated by Koen Deforche about 9 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF