'Locking mouse events in cappuccino web application
While developing a web-application based on the cappuccino-framework which only has to run in a Chromium browser environment (~ Chromium V.19 released spring this year) I struggle with the following problem:
We want the application to lock or delete all mouse clicks for some seconds (while the application performs some background calculations).
This apparently simple task seems to be almost impossible.
we implemented a Html-<div> layer over the whole screen and tried to manipulate its
mouseup, mousedown-handlers like:
onmouseup="return false;"
onmousedown="return false;"
but that didn't show any results.
Also iterating through all CPControl subviews of the actual Cappuccino window-view and disable them
[subview setEnabled:NO];
does not really help:
Then indeed the subviews become disabled (and can't be clicked, exactly what we want) but too LATE: although we disabled them BEFORE starting the background task, the disable-effect comes into effect AFTER the background task has finished and so does not prevent the user from making silly clicks during a sensible calculation.
I also tried to implement code like
[CPRunLoop limitDateForMode:CPDefaultRunLoopMode];
after disabling the CPControls and before starting the background task but it also does not work.
So has anyone an idea either on the Javascript-/Html or Cappuccino side?
Solution 1:[1]
CPWindow has a method: setIgnoresMouseEvents: Just call that on your window.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Me1000 |
