Skip to content

How to be notified when webui is connected #294

Answered by AlbertShown
adauriac asked this question in Q&A
Discussion options

You must be logged in to vote

In the backend, using C/C++ for example, you can bind a blank empty ID to get all events, example:

// All events
void events(webui_event_t* e) {
	if (e->event_type == WEBUI_EVENT_CONNECTED) // <- - - - -
		printf("Connected. \n");
	else if (e->event_type == WEBUI_EVENT_DISCONNECTED)
		printf("Disconnected. \n");
	else if (e->event_type == WEBUI_EVENT_MOUSE_CLICK)
		printf("Click. \n");
	else if (e->event_type == WEBUI_EVENT_NAVIGATION) {
		const char* url = webui_get_string(e);
		printf("Starting navigation to: %s \n", url);
		webui_navigate(e->window, url);
	}
}

// Bind all events by using an empty ID
webui_bind(MyWindow, "", events);

In the frontend, I guess this option does not exist …

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
8 replies
@hassandraga
Comment options

@adauriac
Comment options

@hassandraga
Comment options

@adauriac
Comment options

@hassandraga
Comment options

Answer selected by adauriac
Comment options

You must be logged in to vote
2 replies
@hassandraga
Comment options

@adauriac
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants