The WKC C++ Object
In order to access the _uc_WebKitControl from C++, a string property has to be provided. The content of the string property depend on what the JavaScript code interprets as data and can range from XML nodes, over JSON objects and even binary data (that does not contain \0). The JavaScript cares about decoding the data passed properly.
In order to pass data to the _uc_WebKitControl, a control context class has to be implemented and linked with the field or field control. In the control context class a string containing required data for the _uc_WebKitControl has to be build and set in the control context's property(). In order to react on changes in the parent's data source, the parent's context should be used.
wkc.setControlData.connect(wkc,wkcj.setControlData);
// JSON
(function(){
wkcj = {setControlData: function(data){
var obj = JSON.parse(data);//'{"name":"1"}');
}
};})();
// XML
(function(){
wkcj = {setControlData: function(data){
var obj = $(data);//'{"name":"1"}');
var myattr = obj.children('mynode').attr('myattr');
}
};})();
// Binary
(function(){
wkcj = {setControlData: function(data){
for(var i = 0; i<data.length;i++)
doSomeThing(data[i]);
}
};})();
// C++
int8 cWindowContext :: doAfterFillData ( ){
odaba::String js_data;
js_data = " { '__AUTOIDENT': ";
js_data+= (int64) property().value("__AUTOIDENT").toString();
js_data+= " }";
property().value() = js_data;
}