javascript - Awesomium C no response from awe_webview_set_callback_js_callback -
i've asked question on awesomium forms haven't received response yet , figured speed things asking here too.
i unable reach break point within callback_ui() when push corresponding html button. links work fine travel between pages callback not triggered.
here simple c side code:
#define buffer_len_callbacks 100 #define name_uiobj_index "object_index" #define name_uicall_index "callback_index" void callback_ui(awe_webview* view, awe_string const* object_name, awe_string const* callback_name, awe_jsarray const* args){ char buff_object_name[buffer_len_callbacks] = {0}; char buff_callback_name[buffer_len_callbacks] = {0}; //char buff_args[buffer_len_callbacks] = {0}; // strings. awe_string_to_utf8(object_name, buff_object_name, buffer_len_callbacks); awe_string_to_utf8(callback_name, buff_callback_name, buffer_len_callbacks); string s_obj_name(buff_object_name); string s_call_name(buff_callback_name); handlecallback( s_obj_name, s_obj_name ); } void create_uiobject(awe_webview* view, char* name){ awe_string* awes_name = awe_string_create_from_ascii(name, sizeof(name)); awe_webview_create_object(view, awes_name); awe_string_destroy(awes_name); } void create_uicallback(awe_webview* view, char* name, char* callback){ awe_string* awes_name = awe_string_create_from_ascii(name, sizeof(name)); awe_string* awes_callback = awe_string_create_from_ascii( callback,sizeof(callback)); awe_webview_set_object_callback(view, awes_name, awes_callback); awe_string_destroy(awes_name); awe_string_destroy(awes_callback); // set our ui callback let javascript talk our program. awe_webview_set_callback_js_callback(view, callback_ui); } void setup_javascript_objects(awe_webview* view){ // create our object names. create_uiobject(view,name_uiobj_index); // create our object callbacks. create_uicallback(view, name_uiobj_index, name_uicall_index); }
and here html side javascript code:
<input type="button" value="click me!"onclick="object_index.callback_index('hello!')" />
everything else works fine. awe_webview_set_callback_js_console_message() telling me "object_index" not defined. i'm using awe_webview_create_object() so, maybe i'm using wrong. idk.
does have ideas?
the problem calls:
awe_string_create_from_ascii(name, sizeof(name));
needed be:
awe_string_create_from_ascii(name, strlen(name));
this subtle crushing error. hope post able others find in similar situation.
Comments
Post a Comment