[CLOSED] Button's Click DirectEvent Single property needs to be reset

  1. #1

    [CLOSED] Button's Click DirectEvent Single property needs to be reset

    I have a user that is double-clicking a button on a window. To stop the Click DirectEvent from firing multiple times, I put a Single="true" property on the Click event. This works great. Later, I show the window again with new information, and the user needs to click the button. But, since it has been clicked once already, it does not fire the DirectEvent. How can I programmatically reset the button so that it will allow the click once again?

    Thanks.

    -Steve
    Last edited by Daniil; Oct 25, 2010 at 7:45 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please use Buffer property instead Single
    Buffer: Number
    Causes the handler to be scheduled to run in an Ext.util.DelayedTask delayed by the specified number of milliseconds. If the event fires again within that time, the original handler is not invoked, but the new handler is scheduled in its place.
  3. #3
    Vlad,

    Thank you for the quick response. I have been trying to work with the Buffer setting, and if the user does a typical double-click, a setting of Buffer="500" works great. However, for the slower clickers among us, 500 is not enough, and we can still cause a double firing of the event. I set it up to 1000. Then there are users who think with such a long wait for feedback, that maybe their first click did not take, so they click again, and, under the right conditions, the event will still fire twice. Nothing seems to work as well as the 'Single="true"' if only there is a way to reset the counter.

    Any other ideas?

    Thanks again.
    -Steve
  4. #4
    Another option would be to use the .Before handler to check a boolean value. When the Button is clicked, set the boolean to 'false', then after whatever time/event you feel is relevant, reset to 'true'.

    Hope this helps.
    Geoffrey McGill
    Founder
  5. #5
    Geoffrey,

    That seem to work the best. In the Before, I test a variable that was initialized as "true". If it is true, I set it to false and go on. If it is already false, I "return false;" in the Before which stops the event from firing. Then, in the codebehind, I do an AddScript on the resource manager to set that variable back to true.

    Works great.

    Thank you kindly.

    -Steve
  6. #6
    Hi,

    May be it is better to disable button after click (in the Before handler or Click listener), it will indicate to user that at this moment the button cannot be clicked

Similar Threads

  1. Replies: 5
    Last Post: Mar 19, 2014, 3:35 AM
  2. Replies: 4
    Last Post: Jan 04, 2012, 4:38 AM
  3. Replies: 2
    Last Post: Dec 20, 2011, 8:18 AM
  4. [CLOSED] Button CLICK directevent & listener timeout
    By webclouder in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 05, 2011, 10:10 PM
  5. Replies: 2
    Last Post: Oct 22, 2010, 11:04 AM

Posting Permissions