Mercurial > dwindows
diff dwtestoo.cpp @ 2974:fffb4904c90b
Mac: Initial support for dw_html_javascript_add() and DW_SIGNAL_HTML_MESSAGE
for callbacks into native code. Code for iOS next...
Then GTK3/4, Windows and Android in that order.
Also implemented simple rawhtml tests in the test programs.
C++: Added HTML class support for the message callbacks.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 24 Mar 2023 11:39:24 +0000 |
parents | ac880987a2c4 |
children | ae4d6856b983 |
line wrap: on
line diff
--- a/dwtestoo.cpp Tue Mar 21 00:41:25 2023 +0000 +++ b/dwtestoo.cpp Fri Mar 24 11:39:24 2023 +0000 @@ -1616,7 +1616,14 @@ javascript->Append("window.navigator.userAgent;"); notebookbox->PackStart(rawhtml, 0, 100, TRUE, FALSE, 0); - rawhtml->Raw("<html><body><center><h1>dwtest</h1></center></body></html>"); + rawhtml->JavascriptAdd("test"); + rawhtml->ConnectMessage([this](std::string name, std::string message) -> int + { + this->app->MessageBox("Javascript Message", DW_MB_OK | DW_MB_INFORMATION, + "Name: " + name + " Message: " + message); + return TRUE; + }); + rawhtml->Raw("<html><body><center><h1><a href=\"javascript:test('This is the message');\">dwtest</a></h1></center></body></html>"); DW::HTML *html = new DW::HTML(); notebookbox->PackStart(hbox, 0, 0, TRUE, FALSE, 0); @@ -1682,7 +1689,7 @@ return FALSE; }); - html->ConnectResult([this](int status, std::string result, void *script_data) + html->ConnectResult([this](int status, std::string result, void *script_data) -> int { this->app->MessageBox("Javascript Result", DW_MB_OK | (status ? DW_MB_ERROR : DW_MB_INFORMATION), result.size() ? result : "Javascript result is not a string value");