Jump to content
uniGUI Discussion Forums
Mauri

How To Capture Clear Button event

Recommended Posts

I am using the version of 0.99.96.1328 UniGUI / Delphi XE6 and created a new inherited component TUniDBLookupComboBox. I'm using the property clearbutton true and would like to execute a statement when the user clicks the X button (ClearButton). Is there any event that triggers the component when it is clicked the X (ClearButton)? How can I handle this event?

 

Best Regards,

 

Mauri

 

Share this post


Link to post
Share on other sites

This event is handled and used internally on client side. It is not sent to the server, so it can not be handled without additional implementations on client side.

Share this post


Link to post
Share on other sites

Hi,

 

Can you try this approach?!:

 

For example:

 

UniDBLookupComboBox1 -> ClientEvents -> ExtEvents -> afterrender fn:

function afterrender(sender, eOpts)
{
    sender.plugins.forEach(function(p) {
        if (p.alias[0] == "plugin.clearbutton") {

            // default click handler:
            // handleMouseClickOnClearButton: function(event, htmlElement, object) {
            //     if (!this.isLeftButton(event)) {
            //         return;
            //     }
            //     this.textField.setValue('');
            //     this.textField.focus();
            // }

            // remove default click handler if is needed
            p.clearButtonEl.un('click', p.handleMouseClickOnClearButton, p);

            // add your click handler
            p.clearButtonEl.on('click', function(event, htmlElement, object) {
                // your logic
            })
        }
    })
}

Best regards.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×