I understand, that setData is asynchronous, simply to say, we don't know when setData is finished. I think, the question is, how can I check when setData is finished.
When editor changes the html content itself, what gets the checkDirty back? True or false?
FYI: the SWT Browser API enables me to fire Javascript function from Java layer and from Javascript layer a Java function so I have the possibility to communicate between layers.
How should I understand the callback function in setData() method? From docs: "Function to be called after the setData is completed.". I understand that this callback function is fired when setData is finished. Is it correct? I've made a test: I've defined a callback function in Java (using BrowserFunction) and before I fire setData() I set an additionally property "completed" to false and the callback function set this property to true and I read html content with getData only if completed is true. In my test I see that callback function is fired immediately after setData and getData raises the error.
How should I understand the callback function in setData() method? From docs: "Function to be called after the setData is completed.". I understand that this callback function is fired when setData is finished. Is it correct? I've made a test: I've defined a callback function in Java (using BrowserFunction) and before I fire setData() I set an additionally property "completed" to false and the callback function set this property to true and I read html content with getData only if completed is true. In my test I see that callback function is fired immediately after setData and getData raises the error.
Regards, Jacek
Sorry for my poor English! I encountered a problem like yours. I tried to get the editor's body error immediately after setData. I don't know how you test callback function, I try in this way, and it works! editor.setData("xxxx" , callbackFunc); function callbackFunc(){ //do something after setData() complete, eg: getData() editor.getData(); } good luck!
Re: getData() problem
Re: getData() problem
I understand, that setData is asynchronous, simply to say, we don't know when setData is finished. I think, the question is, how can I check when setData is finished.
When editor changes the html content itself, what gets the checkDirty back? True or false?
FYI: the SWT Browser API enables me to fire Javascript function from Java layer and from Javascript layer a Java function so I have the possibility to communicate between layers.
Regards,
Jacek
Re: getData() problem
How should I understand the callback function in setData() method? From docs: "Function to be called after the setData is completed.". I understand that this callback function is fired when setData is finished. Is it correct? I've made a test: I've defined a callback function in Java (using BrowserFunction) and before I fire setData() I set an additionally property "completed" to false and the callback function set this property to true and I read html content with getData only if completed is true. In my test I see that callback function is fired immediately after setData and getData raises the error.
Regards,
Jacek
Re: getData() problem
Sorry for my poor English!
I encountered a problem like yours. I tried to get the editor's body error immediately after setData. I don't know how you test callback function, I try in this way, and it works!
editor.setData("xxxx" , callbackFunc);
function callbackFunc(){
//do something after setData() complete, eg: getData()
editor.getData();
}
good luck!