Prevent click events from being executed multiple times in a short time

Source: Internet
Author: User

If there is a clickable control on the UI, and the execution logic overhead of the control is large, there must be a need to prevent the control from being clicked multiple times by the user in a short period of time. Now the common solution is organized as follows


1. Windows

Since WINODWS's click message is converted from a mouse message, all mouse messages in the thread will be peek-out at the end of the onclick process.


2.android

As below, usually manually set the time flag to complete, as shown in the link

Http://stackoverflow.com/questions/16534369/avoid-button-multiple-rapid-clicks

Another scenario where a control is disabled after a click is not available, as shown in the link

http://stackoverflow.com/questions/13912510/ How-can-avoid-firing-multiple-times-an-onclick-event-when-the-user-presses-the-b

I practice using Yes click Post a delay runaable to do, if you receive a click Remove the previous runaable, re-post a go out.

3.ios,

Online by chance to see such a sentence, not personally tested

The UIApplication class has a ' beginignoringinteractionevents ' message, which can do this globally. That can is nice at times.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.