Absorbing mouse events

In my application, if someone clicks on a button about 10 times before it visually updates itself, the first click, initializes a change in the GUI, and another button appears in the same place. The second click, is then processed after the first press has completed, and calls the action on the next button, and so on and so on. I want to be able to stop it from doing this. Since it is all on the same thread, I can't say, absorb all button clicks until this event is complete, because they are all still sitting in the event queue. I don't exactly have a whole lot of useful methods to use in the EventQueue class to just say, hey remove all mouse events at this point. Any Ideas?
Maybe this will describe the situation better.
Mouse Click #1 added to queue
Mouse Click #1 removed from queue, processing event.
Mouse Click #2 added to Queue
Mouse Click #3 added to Queue
Mouse Click #4 added to Queue
Mouse Click #5 added to Queue
Mouse Click #1 completed event, new screen is visible.
Mouse Click #2 removed from queue, processing event on button on new screen.
...and so on
I want to be able to ignore all mouse events prior to Mouse Click #1's completion.

Suppose that when you start processing a mouse event
you set a busy flag somewhere, and when you finish
processing it you reset the flag. Your mouse listener
checks the busy flag and drops the click event if it's
set.Problem with this is when I'm at the end of the process, then I enabled the flag, THEN the next event gets processed, and the flag is enabled.
As far as disabling and enabling the buttons, I can try it, but I'm betting it is falling into the same scenario as the flag. My big issue is people double clicking, and the clicks are all registering as 1 click, so 2 seperate events get fired, first one changes the screen, second one clicks on the button on the next screen.
I may have some across a solution that I will test later. It involves storing the completion time of the operation, then when starting the next event, check the event time and see if it is after the completion time, otherwise return.

Similar Messages

  • Mouse events don't work on a button from a panel ran in a DLL

    Hi.
    I have a DLL that loads a panel.
    Since it's a DLL I can't do the RunUserInterface() function, because the DLL would be stuck waiting for the panel events.
    I only do the LoadPanel().
    When I click with the mouse on one of the buttons, the pushing down event (simulating the button being pressed) doesn't happen and the callback doesn't run.
    But if I press the tab button until the focus reaches the button and press Enter, the callback of the button is executed.
    An even more interesting aspect is that this happens when I call the DLL on TestStand, but on an application of mine that calls the DLL just for debug everything works fine.
    How can I enable the mouse events?
    Thanks for your help.
    Daniel Coelho
    VISToolkit - http://www.vistoolkit.com - Your Real Virtual Instrument Solution
    Controlar - Electronica Industrial e Sistemas, Lda
    Solved!
    Go to Solution.

    Hello Daniel,
    I got surprised when I read your post, because I am experiencing something almost the same as you do.
    I have a DLL (generated by an .fp instrument driver I wrote) which performs continious TCP communication with the UUT.
    It starts 2 threads, each for reading from one of the 2 different IPs the UUT has.
    Another DLL tests this UUT (with the help of the communication DLL above) by exporting functions to be called by TestStand steps.
    If the second DLL wants to display a CVI panel in order to wait for the user response or displays a popup (MessagePopup, ConfirmPopup, etc), user cannot press the buttons.
    Actually, there is a point your program and mine differ. I call RunUserInterface and the button's callbacks call QuitUserInterface, so the execution continues after a button is pressed. The problem is buttons cannot be pressed. I also tried looping on GetUserEvent  but it did not solve the problem.
    There are 2 findings:
    1. I had a small exe to test my instrument driver DLL and the popups in it worked pretty well (this coincides with Daniel's findings).
    2. We workedaround the problem by shutting down the communication threads in the instrument driver DLL before the popup appears and restrating them afterwards. Although they are separate threads in another DLL, they were somehow blocking user events on another DLL running.
    S. Eren BALCI
    www.aselsan.com.tr

  • Mouse Events are slow

    Hello everyone,
    I'm currently working on an standard as3 (1024x768) app that
    is running inside a chromeless Air window to take advantage of the
    transparency.
    All my tests where done using windows XP professional and AIR
    1.0 (the same problem existed in beta3).
    The issue I'm having is related with Mouse Events. Somehow
    the events take a lot of time to reach the swf file when the user
    clicks inside the transparent window.
    It's natural that the app runs slower inside a transparent
    window (the framerate drops) but I wasn't expecting the clicks to
    suffer from such delay (it takes sometimes 2-5sec).
    The app is very CPU intensive and the transparencies make it
    worse. Something inside the AIR framework is not dispatching the
    events properly.
    I say this because I tried using the virtualMouse class from
    senocular together with a socket to simulate the mouse clicks and
    that did the trick.
    In conclusion:
    Something in the AIR framework for windows XP is messing up
    the dispatch of the Mouse events when the app is under heavy cpu
    usage inside a chromeless window. I click on the window and it
    takes 1-2sec to receive the click event.
    However when I dispatch the MouseEvent.CLICK myself using
    the virtual mouse class the application immediately receives the
    event.
    I know this is a strange bug and not many people will have
    this problem, but I would like to know from someone with knowledge
    of the runtime why this could be happening.
    Thank you
    Tiago Bilou

    Hello everyone,
    I'm currently working on an standard as3 (1024x768) app that
    is running inside a chromeless Air window to take advantage of the
    transparency.
    All my tests where done using windows XP professional and AIR
    1.0 (the same problem existed in beta3).
    The issue I'm having is related with Mouse Events. Somehow
    the events take a lot of time to reach the swf file when the user
    clicks inside the transparent window.
    It's natural that the app runs slower inside a transparent
    window (the framerate drops) but I wasn't expecting the clicks to
    suffer from such delay (it takes sometimes 2-5sec).
    The app is very CPU intensive and the transparencies make it
    worse. Something inside the AIR framework is not dispatching the
    events properly.
    I say this because I tried using the virtualMouse class from
    senocular together with a socket to simulate the mouse clicks and
    that did the trick.
    In conclusion:
    Something in the AIR framework for windows XP is messing up
    the dispatch of the Mouse events when the app is under heavy cpu
    usage inside a chromeless window. I click on the window and it
    takes 1-2sec to receive the click event.
    However when I dispatch the MouseEvent.CLICK myself using
    the virtual mouse class the application immediately receives the
    event.
    I know this is a strange bug and not many people will have
    this problem, but I would like to know from someone with knowledge
    of the runtime why this could be happening.
    Thank you
    Tiago Bilou

  • Firefox mouse event not behaving the same on PC and Mac computers

    I use the FCKEditor and having a very strange problem. When I click on the FCKEditor's editing area, the keyboard gets disabled untill I click the mouse somewhere outside of the editing window. The problem only happen on Firefox (3.6.10) on Mac computer (Snowleopard 10.6.4). Doing exactly the same steps on PC works without any problem.
    What I want to know:
    - Is it possible that the Firefox on Mac is different than the PC in handling mouse events? Or some other areas?

    Sounds more that Firefox is treating that editor area as read-only.
    Start Firefox in [[Safe Mode]] to check if one of your add-ons is causing your problem (switch to the DEFAULT theme: Tools > Add-ons > Themes).
    See [[Troubleshooting extensions and themes]] and [[Troubleshooting plugins]]

  • Non modal PopUpManager blocking mouse events

    In our application we have a header, footer and center area.  We have a situation where we want to block the header and center area with a popup, but leave the footer area so it can be clicked on.  The code works fine and it all looks good, except the mouse events are blocked to the footer.  If we slightly resize the window (either with the mouse or programatically) it all "wakes up" and starts working.  I have tried all sorts of invalidateDisplayList, validateDisplayList, validateNow, etc.  I am throwing this out there to see if anyone else has had this problem and if there is something I am missing.  I can't easily share my code, but if I don't get a reply I'll put together a code example to see if I can recreate it.  Any ideas are very welcome.  Been scratching my head at this one for 3 days now. 

    I should point out that we are using "false" for the modal flag, just in case anyone was thinking that.  It all works fine once it "wakes up" through resizing, but I need to make that happen without the resizing.
    And we have tried all sorts of "callLater" behavior in conjuction with the invalidate/validate calls. 

  • Mouse events during Thread.sleep

    hi.
    I have an applet .
    I have a alghoritm simulator.
    Everytime I find a solution I call the method Thread.sleep .
    I want to pause the application and I create a JToggleButton Pause .
    When I press the Pause during sleep mouse event are managed at the end of alghoritm.
    How can I manage mouse events during sleep?

    All UI events (such as mouse events) occur on the event dispatch thread (EDT).
    That means if you sleep on the EDT, you lock up the UI. For this reason, you shouldn't be sleeping on the EDT.
    I'm not sure what your sleep is trying to do but you need to manage your threads a little more carefully. For instance, any time consuming process which is invoked as a result of a UI event needs to be fired on a new thread to prevent the UI freezing. The fun starts when you have to update the UI as a result of that process, because you should then hook back onto the EDT to avoid the risk of deadlock.
    Some utility classes are provided, such as SwingUtilities, and other example code is provided on Sun's site, such as SwingWorker - but if you do much UI work you'll probably end up with your own core set of threading tools and so on to make life easier.

  • HTML/JS: Capturing mouse events while Air is out of focus

    Hi,
    I've been trying to determine if it is possible to receive mouse events (like MOUSE_WHEEL) if the Air window does not currently have focus. I'd like my application to support the mouse wheel for scrolling while the cursor is over the application, without requiring the user to click the application and gain focus. My application uses JavaScript to scroll an unordered list within a DIV set to overflow:hidden (to prevent the native scrollbar from appearing).
    Thanks for your help!
    Andrew

    I doubt that AIR would pick up events fired while not having focus. Perhaps you could fake it by creating an AIR project that runs "fullscreen", but has a smaller active window. Anywhere your mouse went it would still capture the scrolling event, but you could conditionalize it so that it only worked in certain areas.

  • Mouse Events at the icon in systray.

    My program call library function to add, modify or delete icon into systray.
    Additionaly I'd like to get back information when any mouse event had happen under icon in systray like move mouse, right/left button click etc. to display popup menu (as an standart behaviour).
    I've tried Windows Message Queue, but it only works inside application window area.
    How could I do it ?
    Any suggestions, examples or advises ?
    Rumcajs.

    Requirements    Price: $29.95
     Application Software:
    LabVIEW 7.0+
     Toolkits Software:
     Additional Software:
     Language's:
    LabVIEW
    INVtray LabVIEW Toolkit allows the programmer to create a LabVIEW program that can be hidden from the task bar and accessed through the System Tray.  Comes with a sample VI that demonstrates all the features of the toolkit.

  • Disabling mouse events

    hi,
    I am having objects on a JFrame that respond to mouse events. I would like to know how I can disable these events. I use the addMouseListener to register a mouse event on something. Is there a way to remove or to deregister mouse events.
    I basically have a game of tiles on a JFrame and I am going to have the human player play against the computer. I want to be able to have turns; computer and human player turn.

    removeMouseListener()

  • Touch to Mouse events conversion

    Hi Everybody!
    Does anybody know how correctly fire mouse events to Oracle Maps in javascript?
    Default translation touch events in iPad Safari does not quite fit. It try zoom or pan browser window, not map. :(
    If catch touch events and disable default translation I can zoom and pan MVMapView object.
    But how fire "click","mousemove","mouseover" events on Map? I need dispatch event to ThemeBasedFOIs (InfoWindow Popup and other listeners)?

    Yes. The Oracle Maps tutorial contains examples (the tutorial can be found in your mapviewer deployment
    e.g. http://localhost:7001/mapviewer/fsmc/tutorial/index.html) and documentation in the API reference
    (e.g. http://localhost:7001/mapviewer/fsmc/apidoc/index.html). Look at MVEvent and the attachEventListener function of MVMapView, MVThemeBasedFOI, and MVFOI classes for example.

  • How to catch the mouse event from the JTable cell of  the DefaultCellEditor

    Hi, my problem is:
    I have a JTable with the cells of DefaultCellEditor(JComboBox) and added the mouse listener to JTable. I can catch the mouse event from any editor cell when this cell didn't be focused. However, when I click the editor to select one JComboBox element, all the mouse events were intercepted by the editor.
    So, how can I catch the mouse event in this case? In other word, even if I do the operation over the editor, I also need to catch the cursor position.
    Any idea will be highly appreciated!
    Thanks in advance!

    Hi, bbritta,
    Thanks very much for your help. Really, your code could run well, but my case is to catch the JComboBox event. So, when I change the JTextField as JComboBox, it still fail to catch the event. The following is my code. Could you give me any other suggestion?
    Also, any one has a good idea for my problem? I look forward to the right solution to this problem.
    Thanks.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class Test3
    extends JFrame {
    // JTextField jtf = new JTextField();
    Object[] as = {"aa","bb","cc","dd"};
    JComboBox box = new JComboBox(as);
    public Test3() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container content = getContentPane();
    String[] head = {
    "One", "Two", "Three"};
    String[][] data = {
    "R1-C1", "R1-C2", "R1-C3"}
    "R2-C1", "R2-C2", "R2-C3"}
    JTable jt = new JTable(data, head);
    box.addMouseListener(new MouseAdapter() {
    // jtf.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e)
    System.out.println("-------------------JComboBox mouseclick....");
    jt.addMouseListener(new MouseAdapter() {
    public void mouseClicked(MouseEvent e)
    System.out.println("-------------------JTable mouseclick....");
    // jt.setDefaultEditor(Object.class, new DefaultCellEditor(jtf));
    jt.setDefaultEditor(Object.class, new DefaultCellEditor(box));
    content.add(new JScrollPane(jt), BorderLayout.CENTER);
    setSize(300, 300);
    public static void main(String[] args) {
    new Test3().setVisible(true);
    }

  • Mouse event not fires on drag and drop

    Please
    Can any one help and give any idea during draging(drag drop) mouse over of a button does not fires. I have a list of thumb in which I want to drag and drop the thumb at any location for reordering the thumb but due to  lot of item in list need to sscroll list.  I have my own custom scroll on button mouse over but when Item is dragging  mouse event does not fires.
    Thanks in advance,
    Premkant

    Hi there,
    Reject caption shows up when an unacceptable source is dropped on a Target. To configure the 'Accept criteria', select a drop target, Click on the 'Accept' button, Deselect the checkbox corresponding to the unacceptable source. (As shown below)
    Now whenever the user drops 'Unaccept' source on top of the target, the 'Reject' caption shows up.
    Thanks,
    Nimmy Sukumaran.

  • Missing Mouse Events

    I’ve noticed that it is possible to miss mouse events
    if you move the mouse very quickly. For example, if you quickly
    move the mouse off a control, you can fairly easily miss the
    MouseOut event. Is there a Best Practice way to get around this?
    Thanks!!

    If you move your mouse quickly over an object, you can fairly
    easily miss the mouseout event. This is especially true if the
    object you are moving the mouse over is fairly small.

  • Event case missing mouse events on active-x component

    I am using a Treeview and capturing selections in the tree using mouse events (event structure). I have a problem where approx 3 out of 15 mouse events are not actioned by the event structure - has anyone else had this problem or is there any suggestions?
    Thanks.

    Could you post a copy of your code that demonstates this?
    I have experimented with this control and its events.
    We may be able to help if we have soething to look at.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Finding Screen Location of the Cursor without a Mouse Event

    How can I find the absolute screen location of the mouse cursor if I do not have a mouse event? I have an application where I need to warp the location of the mouse cursor using the robot class and would like to return the mouse cursor to its original location once I'm done.

    I had similar problem and asked in the forums a while back, basically what I did was to set the mouse to a "Start" position and go from there.
    I know this will not get it back to your current location.

Maybe you are looking for

  • FCP will not open

    I attempted to open my project and I get a message saying, " The application Final Cut Pro quit unexpectedly. The problem may have been caused by the Text Scrambler plug-in". It was working perfectly last week.

  • I cant open my id iTunes

    How to open my itnunes id

  • Fluid layout question.

    I am working on a flash site with many scenes with movie clips, different clips but same size and same position. I just set up the layout using fluid with this function sizeListener.onResize = function() { centered._x = Stage.width/2 centered._y = St

  • Problem solving pivot or not to pivot

    Problem: my current code is not viewing data as expected will come back re-write the question

  • Missing tags on DVD back up PSE 5

    Hi I have built a new PC and I'm moving all my pics from the old PC to the new PC using backup DVD's which I created in PSE 5. When I load the photo's only about 10% of the pictures have their tags attached. With 5000 photos per DVD (5 in all) I don'