How to propagate an event up to handler chain (Carbon) after it handled by my custom handler? - objective-c

I need to handle a Tab key press in my application. In some conditions I want to do some stuff in my handler and suppress further event handling and in other cases I just skip and let other standard handlers to handle this event.
Here is my very simple app where I'm trying to do it.
https://github.com/prudnikov/TestGlobalShortcut/blob/master/TestGlobalShortcut/AppDelegate.m
It catches tab press but it always suppresses further event handling. I mean when I press Tab in the text editor the tab key is not inserted.
Can you advise what should I do to propagate standard event handlers?

I don't think you can do that using RegisterEventHotKey. But unless you need to receive the tab key when your app is not frontmost, you should not be using RegisterEventHotKey. Use a regular Carbon Event handler, or use Cocoa event handling techniques.

Related

Is there any way to quickly see ALL existing SSIS package event handlers?

SSIS event handlers are very useful. Event handlers can be added at the level of the package itself, or for any executable in the package. This, along with the Propagate property, is very useful to allow certain operations to deal with errors in their own way. For example, a loop can react to an error by recording that "This row with key [whatever] had a problem", carry on with the rest of the rows, and not trigger the package's Error handler, which is saved for more fatal, general errors (e.g. a server goes down).
The number of places there can be an event handler is also a curse. In Visual Studio, the Event Handlers tab is where you can see, add or change event handlers. It's great if I want to add an event handler to task ExecuteSomeSQL, or sequence container DoSomeThings - or to find the event handlers for these executables which I already know are there.
But it's not suited to quickly finding out which executables in the package actually have any event handler. To do that, I have to click through the executables tree onto every executable, and see whether each one has anything under Event Handlers.
An alternative view would make this much easier. Either:
Show all existing event handlers in a non-tree way, just as a list. Package.OnError, Package.OnTaskFailed, (sequence)DoSomeStuff.OnPostExecute, etc...
Or, allow the tree view to be filtered to show only executables that have any event handler.
Am I missing something, is there actually already a good way to see this?
The Package Explorer is what you're looking for. It's the last tab for a non-running package.
Every level has "Executables" and an "Event Handlers" section. As you expand either one, you'll see what's listed there.
My sample is a Foreach Loop with a Data Flow Task inside it. The Data Flow has OnError event handler with a sequence container, and an OnPostExecute with an sequence container with a script task inside there. Fortunately, you can't add an event handler on an event handler (you might have been able to in earlier versions).
Otherwise, I think you're looking at writing custom code to crawl your package.

KeyDown : detect either control key alone or control key used as a modifier

The user will type in a datagridview the shortcuts he would like to assign to a couple of operations. I tried to use KeyDown event when the cell is in edit mode.
However I want my control to be able to detect in the same event handler the Control key typed alone, or the Control key used as a modifier (same with Shift and Alt).
This causes a problem since KeyDown fires up when Control is down before the other key I am combining it with is also down. Obviously the event handler doesn't know if the user intends on pressing another key after the Control key.
Right now I solved this issue by using KeyUp, but this caused other headaches when for example the user types in CTRL+P, releases P, which fires the correct event, but then the user releases Ctrl which fires a new KeyUp event which I had to find a way to ignore.
There must be a cleaner way to handle this?

How to handle intercommunication between windows

I am able to open a new window by clicking on a button in another window, but my requirement is that I should be able to listen to the events generated from the other window.
Can anybody help me? How can I register the events from one window and listen to them in the other, so that intercommunication can happen?
My answer would be that you shouldn't. Register your listeners in a common controller--that way, whatever events are fired by either window can be captured by the controller, and the controller can decide what needs to happen to what window in what circumstance.
I use TIBCO PageBus (http://developer.tibco.com/pagebus/default.jsp) for inter application events within my ExtJs applications. It is a JavaScript event bus. For instance, similar to what you describe, I have an editor window, which has a button to display a preview window. The editor window on a save, raises a update content event on the page bus, which the preview window subscribes to, upon receiving the event it refreshes the preview.
One of the advantages of this approach is that many clients can subscribe to events, if you have a complex application.

Silverlight avoid requesting an event twice

I have a Control say for ex a Submit button if user clicks the button twice or more continuously then user receiving same message / same operation taking place twice or more.
I need to avoid this situation.
thanks for your inputs.
You need to detect the button click event either in the code behind of the view (or ViewModel if using the MVVM pattern) and disable the button. Now I take it that your submit button is firing off some kind of asynchronous operation. Once the asynchronous operation has successfully completed you will probably need to enable the button so that it is available again.
Shankar, if you want to avoid clicking on button, you should disable it. If you can give more details about what exactly you are trying to do, more details can be given.

Handle key events without focus

I wonder is there a way, to handle key event if my application not in focus.
For example, I create a small app. It has a transaparent background. When I run my app via Xcode(run option), it is in focus and handle key events. But if I click anywhere, focus lost and key events doesn't handled. All I need is handle key event even if my application not in focus(with transaparent background), and if send key events to other windows(in focus), if this key events won't needed for my application. Dropl is application, that doing just what I want. But I don't have the source.
Ok, I solwed my problem using DDHotKeyExample from https://github.com/davedelong/DDHotKey