carbon

Attaching user data to AXObserver

I am using an AXObserver to monitor when a window is closed. In the callback, I am just raising an NSNotification. All working well. What is the correct syntax for attaching some user data as refcon? The working call looks like this: err6 = AXObserverAddNotification(observerTable, tableRef, kAXUIElementDestroyedNotification, nil); ...

How to force Mac window to foreground?

How can I programmatically force a mac window to be the front window? I have the window handle, and want to ensure that my window is displayed above all other windows. I can use both Carbon & Cocoa for this. ...

Retrieve HIViewRef from dialog.

Hi y'all. Is there any way to retrieve a HIViewRef reference from a Dialog (similar to HIViewGetRoot) in order to use it as a browser using WebKit API? Thank's for all. ...

Carbon C Event Handlers for movement of scroll bar of window

Hello All, I am trying to find how can we catch the events of that whenever a scroll bar is moved. Scroll bar can also be moved programmatic-ally so, mouse scroll events wont work here. I am using Carbon, Mac Thanks, Rahul ...

WebKit gets blank when clicking on the menu toolbar

Hi y'all. I've embebed a WebKit view into a modal dialog using Carbon and appereantly everything works fine. However there's a little problem. When I click on the menu toolbar the view gets completely blank getting visible only when I interact with it. Seems like the control stops reciving the 'paint window' event when I call MenuSelect...

MenuRef GetControl32BitValue always return 0

Hello i' need to use a pop-up menu, witch is created dynamically. OSErr err = GetBevelButtonMenuHandle(m_pRecallAOptionalButton, for (countitem) { String szItem (List.GetAt(i)); CFStringRef sz = ToCFStringRef(szItem); AppendMenuItemTextWithCFString(m_pRecallAMenuRef, sz, 0, 0, 0); } short sCount = CountMenuItems(m_pRecallAMenuRe...

Mac event tap just delays discarded events

I'm trying to write some code that discards all keyboard and mouse events when enabled on Mac OSX 10.6. My code runs as the root user. The approach I'm taking is to create an event tap that discards all events passed to it (while enabled). The event tap callback function looks like this: CGEventRef MyTapCallback(CGEventTapProxy proxy, ...

Strange behaviour when posting CGEvent to PSN

EDIT - not getting much input on this so here's the skinny. I'm posting keyboard events to a PSN. I then switch to another window, post some more events (this time tat session level) and switch back to the first window. When I start posting to the PSN again, nothing happens. Until I move the mouse or scroll wheel. Why would this be ...

No Carbon Human-Interface-Toolbox in OSX 64-bit binaries?

I get the impression that Carbon Human Interface Toolbox does not work in 64-bit binaries. Apple's documentation says: The Carbon Help Manager is not available to 64-bit applications. ... The Control Manager is not available to 64-bit applications. ... The Data Browser is not available to 64-bit applications. ...

How do I find a window at a certain point on the screen for screenshot/screen-recording purposes?

The title says it all. I'm looking for a way to do what the equivalent of WindowFromPoint and GetWindowRect do, in Carbon/Cocoa and X11. WindowFromPoint - http://msdn.microsoft.com/en-us/library/ms633558%28VS.85%29.aspx GetWindowRect - http://msdn.microsoft.com/en-us/library/ms633519%28VS.85%29.aspx ...

Ho to launch Choose File dialog on Mac

Hi All, I am using LSOpenItemsWithRole() to open any file from my appication. It works fine for all files which has a default application to get opened on Mac, but for the files which cannot be open with any default application this method returns an error kLSApplicationNotFoundErr and does nothing. For such cases I want my applicatio...

How to find WindowRef of Apple Help Viewer application?

Hi, In my Carbon application upon display of Preference Panes, I have a link which when clicked opens up Apple Help Viewer. The problem I am facing is the Help Viewer Window is behind my preference pane window. I would like to keep the Help Viewer window on top of the Preference Pane. Is there any way to get the WindowRef of the Hel...

RunStandardAlert never returns, buttons are non-responsive

I'm trying to create a simple dialog box from within a very simple application. It's the only UI in the application. But when I call RunStandardAlert, the buttons are non-responsive, and the function call never returns. I am not using Carbon or Cocoa anywhere else in the app. This is the code I am using, from the Carbon tutorial. I ...

Where can I get resources for developing for Mac OS Classic?

I recently got bored and fired up my old Mac OS Classic emulator, and then got nostalgic for writing old-school applications for the system. So, my question: Where can I get dev tools that can still target Classic? (Ideally free, since this is just for fun, but if grabbing a used version of CodeWarrior on eBay is the best way to go, ...

Equivalent Carbon 32-bit call for using in 64-bit application - GetApplicationEventTarget().

Hi All, I'm writing a 64-bit Cocoa application. I need to register for global key events. So I wrote this piece of code : - (void)awakeFromNib { EventHotKeyRef gMyHotKeyRef; EventHotKeyID gMyHotKeyID; EventTypeSpec eventType; eventType.eventClass=kEventClassKeyboard; eventType.eventKind=kEventHotKeyPressed; eve...

CGEventTapCreate breaks down mysteriously with "key down" events

I'm using CGEventTapCreate to "steal" media keys from iTunes when my app is running. The code inside of the callback that I pass to CGEventTapCreate examines the event, and if it finds that it's one of the media keys, posts an appropriate notification to the default notification center. Now, this works fine if I post a notification for...

Cocoa/AppleScript move file

I have a list of file paths and a destination path. I need something (AppleScript, Cocoa) that will move the files from one location to an other. I first tried using the following AppleScript, just to see what happens: set the_folder to (choose folder) tell application "Finder" move selection to the_folder end tell The problem is t...

Adding Cocoa to a Carbon app?

Hi All, So We have a really old project that is all Carbon. We need to modify the way we open and save files and the dialog code we use is to old, so I wanted to create this new in Cocoa. How does one create a Cocoa Class that can be called from Carbon? What Cocoa routines would I use to create open and save dialogs and present them t...

Code Signing Services

I'm developing a System Preference Pane that runs a background application. I'm planning on codesigning the background application and I'll be using the kill flag of codesign (http://gemma.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/codesign.1.html). From my understanding, this kill flag will not allow the backgrou...

performKeyEquivalent on active application

In carbon/cocoa, is it possible to send something like performKeyEquivalent to the current key window? I want to send a key event to whatever application the user has active. Thanks! ...