event-handling

Best practices for passing data between processes in Cocoa

泪湿孤枕 提交于 2019-12-03 16:26:43
I am in the middle of solving a problem which requires me to do the following in my 64-bit Cocoa application: Spawn a 32-bit Cocoa helper tool (command line tool) from within my application. This helper will open a file (a quicktime movie to be precise) and access information about that file using 32-bit only APIs (Quicktime-C APIs) The data gathered from the 32-bit process needs to be passed back to the 64-bit application. The 64-bit app should wait until the 32-bit process completes before continuing There are many ways to accomplish this in Cocoa, but from what I gather these are two

jQuery Stop .blur() event when clicking “submit” button

喜夏-厌秋 提交于 2019-12-03 16:23:21
问题 I am building a small landing page with a simple demo e-mail signup form. I want to have the form field open up when focused, and then shrink back down on blur. However the problem I'm facing is when you click the submit button this instigates the blur function, hiding the button and shrinking the form. I need to find a way to stop the .blur() method only when the user is clicking to focus on the submit button. Is there any good workaround for this? Would appreciate any help I can get! 回答1:

Emulate W3C event capturing model in IE

佐手、 提交于 2019-12-03 16:00:54
问题 Is it possible to emulate event capturing in Internet Explorer? An example: <a>one</a> <a>two</a> <a>three3</a> <script> var links = document.getElementsByTagName("A"); for (var i=0; i < links.length; i++) { links[i].onclick = function(){ alert("clicked"); }; } </script> I want to prevent all these click events from firing. I can do that with a single event observer: document.addEventListener("click", function(e) { e.stopPropagation(); e.preventDefault(); }, true ); How can I do the same in

QKeyPress event in PyQt

谁说胖子不能爱 提交于 2019-12-03 15:52:27
I am having issues with my software. In my piano software if I keep pressing a key on the keyboard then it is making multiple repeated same tones of that particular key. But actually I need a single tone until the release of that particular key. I'm providing a part of my code that detects the keyPress event and calls the corresponding method. So what should be the changes that I've to do with my code?? def keyPressEvent(self, event): if type(event) == QtGui.QKeyEvent and event.key() == QtCore.Qt.Key_A : self.Playnote('/home/hemanth/hemanth/Piano/C.mp3') self.ui.pushButton.animateClick(100) if

SWT: Getting notified of a system device change (USB device connection / disconnection)

泄露秘密 提交于 2019-12-03 15:23:29
I'm writing an SWT application which needs to sit in the system tray and pop up automatically whenever the user connects some USB device (the application serves as its control panel). The way to do this in the native environment (win32 in this case, but I should be platform-independent ultimately) is to listen to the WM_DEVICECHANGE event, then checking if my device has been disconnected. Googling the subject, it seems like SWT does not in fact handle this type of event. Does anyone have any idea as to how to achieve this? My fallback solution would be sampling the USB port every n seconds,

How can I correctly capture and re-fire the form submit event, guaranteed?

坚强是说给别人听的谎言 提交于 2019-12-03 15:08:13
问题 This is probably not your usual "How do I capture form submit events?" question. I'm trying to understand precisely how form submit events are handled by jQuery, vanilla Javascript, and the browser (IE/FF/Chrome/Safari/Opera) -- and the relationships between them. (See my other question.) After hours of Googling and experimenting, I still cannot come to a conclusion, either because of discord or vagueness. I'm finishing up a script which integrates with website forms so that the forms can't

Simulate Long press by Touch events

本秂侑毒 提交于 2019-12-03 15:06:09
问题 How can we simulate long press by touch event? or how can we calculate the time that screen is touched, all in ACTION_DOWN state? 回答1: I have implemented a Touch screen long click finally , thx all: textView.setOnTouchListener(new View.OnTouchListener() { private static final int MIN_CLICK_DURATION = 1000; private long startClickTime; @Override public boolean onTouch(View v, MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_UP: longClickActive = false; break; case

How do I add and remove an event listener using a function with parameters?

一曲冷凌霜 提交于 2019-12-03 14:38:43
问题 Sorry if this is a common question, but I couldn't find any answers that seemed pertinent through searching. If I attach an event listener like this: window.addEventListener('scroll', function() { check_pos(box); }, false); it doesn't seem to work to try to remove it later, like this: window.removeEventListener('scroll', function() { check_pos(box); }, false); I assume this is because the addEventListener and removeEventListener methods want a reference to the same function, while I've

What to do with IObservers being disposed?

穿精又带淫゛_ 提交于 2019-12-03 14:33:44
I'm using Reactive Extensions for easy event handling in my ViewModels (Silverlight and/or Wp7 apps). For sake of simplicity let's say I have a line like this in the ctor of my VM: Observable.FromEvent<PropertyChangedEventArgs>( h => MyObject.PropertyChanged += h, h => MyObject.PropertyChanged -= h) .Where(e=>e.PropertyName == "Title") .Throttle(TimeSpan.FromSeconds(0.5)) .Subscribe(e=>{/*do something*/}); this returns an IDisposable object, which if disposed will unsubscribe. (Am I right in this assumption?) If I hold no reference to it, sooner or later it will be collected, and my handler

Use the value of continuous slider in MATLAB

冷暖自知 提交于 2019-12-03 13:46:17
I am kinda stuck here. I have tried to read and implement some simple continuous slider scripts, ( like this one ), but I am not getting anywhere. What I simply want to go, is use the continuous slider value in my plot, as I slide the slider. However, I cannot figure out how to extract the value of the slider to do so. So for example, make a continuous slider, and then use it to change the amplitude of a vector lets say, as you continuously slide it. How can that be done? Thanks. Something like this? function sliderDemo f = figure(1); %// Some simple to plot function (with tuneable parameter)