Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webui_close is useless #359

Closed
xland opened this issue May 17, 2024 · 3 comments
Closed

webui_close is useless #359

xland opened this issue May 17, 2024 · 3 comments

Comments

@xland
Copy link
Contributor

xland commented May 17, 2024

webui_close is useless

OS: Windows 10
WebUi version: main branch and 2.4.2
Chrome Version:124.0.6367.202 x64
Edge Version:124.0.2478.105 x64

    auto winId = webui_new_window();
    webui_show(winId, "<html><script src=\"webui.js\"></script>Hello World</html>");
    webui_close(winId);
    //webui_destroy(winId);
    webui_set_timeout(0);
    webui_wait();
@neroist
Copy link
Member

neroist commented May 17, 2024

I would assume you'd need to call webui_wait before webui_close

@xland
Copy link
Contributor Author

xland commented May 17, 2024

void my_function(webui_event_t* e) {
    webui_close(e->window);
}
int APIENTRY wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, 
_In_ LPTSTR lpCmdLine, _In_ int nCmdShow)
{    
    auto winId = webui_new_window();
    webui_show(winId, 
"<html><script src=\"webui.js\"></script> Hello World from C++! <button id=\"MyID\">Hello</button> </html>");
    webui_bind(winId, "MyID", my_function);
    webui_wait();
    return 0;
}

In this way, the window still cannot be closed.
Chrome Version:124.0.6367.202 x64
Edge Version:124.0.2478.105 x64

@AlbertShown
Copy link
Contributor

Make sure you are not using the debug version of webui, because it does not close the window for dev-tool testing purpose. While the release version should close it.

@xland xland closed this as completed May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants