Jump to content

How To Capture Clear Button event


Mauri

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

 

Link to comment
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.

Link to comment
Share on other sites

  • 3 years later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...