fixed events

This commit is contained in:
Peter Schojer
2008-09-18 12:19:11 +00:00
parent b1c5c8b484
commit 4d95e3bf49
7 changed files with 45 additions and 2 deletions

View File

@@ -36,6 +36,7 @@
#include "Poco/WebWidgets/TextFieldCell.h"
#include "Poco/WebWidgets/TextField.h"
#include "Poco/WebWidgets/RequestHandler.h"
namespace Poco {
@@ -86,12 +87,26 @@ void TextFieldCell::handleForm(const std::string& field, const std::string& valu
{
Poco::Any newValue = getFormatter()->parse(value);
ValueChange vc(getFormatter(), getValue(), newValue);
setValue(value);
setValue(newValue);
textChanged.notify(this, vc);
}
}
void TextFieldCell::handleAjaxRequest(const Poco::Net::NameValueCollection& args, Poco::Net::HTTPServerResponse& response)
{
const std::string& ev = args[RequestHandler::KEY_EVID];
if (ev == EV_TEXTCHANGED)
{
Formatter::Ptr pForm = getFormatter();
handleForm("", args[FIELD_NEWVAL]);
response.send();
}
else
response.send();
}
bool TextFieldCell::serializeJSON(std::ostream& out, const std::string& name)
{
out << name << ":";

View File

@@ -77,7 +77,6 @@ void TimeFieldCell::setFormat(TimeField::Format fmt)
}
bool TimeFieldCell::serializeJSON(std::ostream& out, const std::string& name)
{
out << name << ":";

View File

@@ -36,6 +36,7 @@
#include "Poco/WebWidgets/ToggleButtonCell.h"
#include "Poco/WebWidgets/BoolFormatter.h"
#include "Poco/WebWidgets/RequestHandler.h"
#include "Poco/String.h"
@@ -101,4 +102,21 @@ bool ToggleButtonCell::serializeJSON(std::ostream& out, const std::string& name)
return true;
}
void ToggleButtonCell::handleAjaxRequest(const Poco::Net::NameValueCollection& args, Poco::Net::HTTPServerResponse& response)
{
const std::string& ev = args[RequestHandler::KEY_EVID];
if (ev == EV_CHECKED)
{
bool check = false;
if (args[FIELD_VAL] == "true")
check = true;
setChecked(check);
response.send();
}
else
response.send();
}
} } // namespace Poco::WebWidgets