comparison dwtest.c @ 2010:617a78dc70aa

Added a number of possible javascript snippets to test. Pass NULL in the result field of the html result callback in the case of a non-string javascript result, instead of a generic error message.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 07 Nov 2019 02:07:49 +0000
parents 8577d533b371
children 211330337f2d
comparison
equal deleted inserted replaced
2009:8577d533b371 2010:617a78dc70aa
1736 } 1736 }
1737 1737
1738 /* Handle web javascript result */ 1738 /* Handle web javascript result */
1739 int DWSIGNAL web_html_result(HWND html, int status, char *result, void *user_data, void *script_data) 1739 int DWSIGNAL web_html_result(HWND html, int status, char *result, void *user_data, void *script_data)
1740 { 1740 {
1741 dw_messagebox("Javascript Result", DW_MB_OK | (status ? DW_MB_ERROR : DW_MB_INFORMATION), result); 1741 dw_messagebox("Javascript Result", DW_MB_OK | (status ? DW_MB_ERROR : DW_MB_INFORMATION),
1742 result ? result : "Javascript result is not a string value");
1742 return TRUE; 1743 return TRUE;
1743 } 1744 }
1744 1745
1745 /* Handle web html changed */ 1746 /* Handle web html changed */
1746 int DWSIGNAL web_html_changed(HWND html, int status, char *url, void *data) 1747 int DWSIGNAL web_html_changed(HWND html, int status, char *url, void *data)
1843 if(rawhtml) 1844 if(rawhtml)
1844 { 1845 {
1845 HWND htmlstatus; 1846 HWND htmlstatus;
1846 HWND hbox = dw_box_new(DW_HORZ, 0); 1847 HWND hbox = dw_box_new(DW_HORZ, 0);
1847 HWND item; 1848 HWND item;
1848 HWND javascript = dw_entryfield_new("window.scrollTo(0,500);", 0); 1849 HWND javascript = dw_combobox_new("", 0);
1850
1851 dw_listbox_append(javascript, "window.scrollTo(0,500);");
1852 dw_listbox_append(javascript, "window.document.title;");
1849 1853
1850 dw_box_pack_start( notebookbox7, rawhtml, 0, 100, TRUE, FALSE, 0); 1854 dw_box_pack_start( notebookbox7, rawhtml, 0, 100, TRUE, FALSE, 0);
1851 dw_html_raw(rawhtml, "<html><body><center><h1>dwtest</h1></center></body></html>"); 1855 dw_html_raw(rawhtml, "<html><body><center><h1>dwtest</h1></center></body></html>");
1852 html = dw_html_new(1002); 1856 html = dw_html_new(1002);
1853 1857