Project

General

Profile

Bug #3882

WSpinBox onChange is not working right

Added by Torsten Schulz over 7 years ago. Updated over 7 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.

#1

Updated by Koen Deforche over 7 years ago

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

Updated by Benoit Daccache over 7 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

#3

Updated by Torsten Schulz over 7 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

#4

Updated by Benoit Daccache over 7 years ago

Hey,

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

Benoit

#5

Updated by Torsten Schulz over 7 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

#6

Updated by Benoit Daccache over 7 years ago

  • Status changed from InProgress to Resolved

Indeed it was not mentioned.

Thank you!

Benoit

#7

Updated by Koen Deforche over 7 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF