Newbie question about events

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Newbie question about events

Postby 4r3q » Tue Oct 28, 2014 1:35 pm

This is event handler for capi:

void initialize_client_handler(cef_client_t* client) {
//DEBUG_CALLBACK("initialize_client_handler\n");
client->base.size = sizeof(cef_client_t);
initialize_cef_base((cef_base_t*)client);
// callbacks
client->get_context_menu_handler = get_context_menu_handler;
client->get_dialog_handler = get_dialog_handler;
client->get_display_handler = get_display_handler;
client->get_download_handler = get_download_handler;
client->get_drag_handler = get_drag_handler;
client->get_focus_handler = get_focus_handler;
client->get_geolocation_handler = get_geolocation_handler;
client->get_jsdialog_handler = get_jsdialog_handler;
client->get_keyboard_handler = get_keyboard_handler;
client->get_life_span_handler = get_life_span_handler;
client->get_load_handler = get_load_handler;
client->get_render_handler = get_render_handler;
client->get_request_handler = get_request_handler;
client->on_process_message_received = on_process_message_received;
}

and this is the get_context_menu_handler:

struct _cef_context_menu_handler_t* __stdcall get_context_menu_handler(struct _cef_client_t* self) {
return NULL;
}

this get_context_menu_handler has two events:

first on_before_context_menu which looks like:

void (CEF_CALLBACK *on_before_context_menu)(
struct _cef_context_menu_handler_t* self, struct _cef_browser_t* browser,
struct _cef_frame_t* frame, struct _cef_context_menu_params_t* params,
struct _cef_menu_model_t* model);

and second:

int (CEF_CALLBACK *on_context_menu_command)(
struct _cef_context_menu_handler_t* self, struct _cef_browser_t* browser,
struct _cef_frame_t* frame, struct _cef_context_menu_params_t* params,
int command_id, cef_event_flags_t event_flags);

The question is:
How can i inject to on_before_context_menu event because i want to disable right click event

Thanks for answers
4r3q
Newbie
 
Posts: 3
Joined: Wed Oct 15, 2014 3:56 pm

Re: Newbie question about events

Postby magreenblatt » Tue Oct 28, 2014 1:43 pm

4r3q wrote:The question is:
How can i inject to on_before_context_menu event because i want to disable right click event

Do you mean how do you implement the on_before_context_menu function and clear the default right-click menu? See https://code.google.com/p/chromiumembed ... ingTheCAPI. You need to call CefMenuModel::Clear() from your implementation.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Newbie question about events

Postby 4r3q » Tue Oct 28, 2014 2:22 pm

Ohhh it is so easy... i spent of this one week! :P
Thanks a lot!
4r3q
Newbie
 
Posts: 3
Joined: Wed Oct 15, 2014 3:56 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 102 guests