Bug #3882
closedWSpinBox onChange is not working right
0%
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.
Updated by Koen Deforche almost 10 years ago
- Status changed from New to InProgress
- Assignee set to Benoit Daccache
- Target version set to 3.3.4
Updated by Benoit Daccache almost 10 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
Updated by Torsten Schulz almost 10 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
Updated by Benoit Daccache almost 10 years ago
Hey,
Could you try to listen to the Wt::WLineEdit::textInput() signal ? ( which is part of the latest git version )
Benoit
Updated by Torsten Schulz almost 10 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
Updated by Benoit Daccache almost 10 years ago
- Status changed from InProgress to Resolved
Indeed it was not mentioned.
Thank you!
Benoit
Updated by Koen Deforche over 9 years ago
- Status changed from Resolved to Closed