How to programatically collapse the WDateEdit calendar?
Added by Anon Anon over 11 years ago
I'm using a WDateEdit with a popup calendar. However, when I select a date, the popup stays visible until I either click the "open calendar button" or elsewhere on the screen. I would like the calendar to disappear when I make a selection.
I have tried calling various methods such as "hide", "setHidden", "animateHide", but all of these seem to do something different than the normal close operation as they all break the calendar (and I then can't open it again until I refresh the page). Is it even possible to programatically call the normal close operation?
I'm using the BoostrapTheme if that's of any significance.
dateEdit = new Wt::WDateEdit();
setFormWidget(SearchFormModel::DateField, dateEdit,
[=]() { // updateViewValue()
Wt::WDate date = boost::any_cast<Wt::WDate>(model->value(SearchFormModel::DateField));
dateEdit->setDate(date);
},
[=]() { // updateModelValue()
Wt::WDate date = dateEdit->date();
model->setValue(SearchFormModel::DateField, date);
}
);
dateEdit->changed().connect(std::bind([&](){
dateEdit->calendar()->animateHide(Wt::WAnimation(Wt::WAnimation::Fade)); //This just breaks the calendar
process();
}));
Thanks for your help.
Replies (3)
RE: How to programatically collapse the WDateEdit calendar? - Added by Anon Anon over 11 years ago
I think this is related to this issue: http://redmine.webtoolkit.eu/boards/2/topics/8047. I can figure out what is going wrong here, although I can't work out how to associate all the relevant sources in MSVS Express 2013 so that I can debug within the WT code itself. Whenever a WT function is called I can't step into it. It just steps over.
Will I need to compile WT myself? I only have it installed by following the Easy Method from http://redmine.webtoolkit.eu/projects/wt/wiki/Installing_Wt_on_MS_Windows. Alternatively, is there anywhere I can get my hands on the .pdb files
(I did spend several days trying to get it working in Code::Blocks beforehand, so I'd quite like to avoid going through another arduous compile/setup process if possible!).
Thanks again.
RE: How to programatically collapse the WDateEdit calendar? - Added by Koen Deforche over 11 years ago
Hey,
W.r.t. installing on Windows, there are two possibilities that aren't very well documented yet as they are new developments:
- Use 'winst-ng' (https://elpauer.assembla.com/code/winstng/git/nodes) which provides a cmake-based tool that will do a complete and automated download and build of Wt including all of its dependencies
- Use a pre-built package (http://sourceforge.net/projects/witty/files/wt/3.3.1/)
Regards,
koen
RE: How to programatically collapse the WDateEdit calendar? - Added by Koen Deforche over 11 years ago
Hey,
As to the calendar/popup behaviour, what you want is now default in 3.3.2 (RC1) just released.
Regards,
koen