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

Override closeButton event handler #58

Open
Taantawan opened this issue Sep 11, 2020 · 2 comments
Open

Override closeButton event handler #58

Taantawan opened this issue Sep 11, 2020 · 2 comments

Comments

@Taantawan
Copy link

What I want to achieve is to hide window and keep the frame object when the close button is clicked, and make it possible to show the same window with frame.show().

I could not realize it with using only JSFrame interface or options and API. I tried setControl() etc, but no vail.

So I had to do workaround like below. (It uses JQuery but it is not substantial.)

Appreciate it if you show me how to do the same in a more proper manner.

let oJsFrame = new JSFrame();
oFrame = oJsFrame.create({`
        title: 'Create Account Confirmation',
	left: window.innerWidth / 2 - window.innerWidth / 4,
	top: window.innerHeight / 2 - window.innerHeight / 4,
	width: window.innerWidth / 2,
	height: window.innerHeight / 2,
	movable: true,
	resizable: true,
	html: "<div id=registration-popup>Something here</div>"
});

$("[component-id=closeButton]").unbind("click");
$("[component-id=closeButton]").attr("onclick", "");
oFrame.on("closeButton", "click", (_frame, _evt) => {
	oFrame.hide();
});
@nmatton
Copy link

nmatton commented Jan 20, 2021

+1 for the idea.

Your solution works nice, except the fact that the close animation is then hidden as well.
A desired behavior would be the possibility to click the "close" button, but with the ability to re-open it again later (e.g. with oFrame.show() ).

The following code seems to not close completely the frame, show the animation, but oFrame.show() does not work anymore

oFrame.control.on('hid', (frame, info) => {
                frame.hide();
            });

@sdbbs
Copy link

sdbbs commented Oct 26, 2023

It seems frame.control.doDehide is the trick - found in https://riversun.github.io/jsframe/examples/v150/chatbot_ui.html :

        showChatWindow() {
            const frame = this.jsFrame.getWindowByName(this.frameName);

            //Open minimized window
            frame.control.doDehide({
                callback: (frame, info) => {
                    this.setChatButtonVisible(false);
                }
            });
        }

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