cocoa

mouseUp not firing in Cocoa?

自古美人都是妖i 提交于 2021-02-10 05:52:24
问题 I'm trying to implement drag&drop functionality in my app and I ran into a problem of my mouseUp event not firing. It fires just fine if I simply click and release on my view, but if I do drag, my mouseDragged event fires and that's it. By trying different things I figured out that the problem is in my dragImage call, but I don't know how to solve it for now. Here is my code: -(void) mouseDragged:(NSEvent *)theEvent { isDragging = YES; if ([selectedCellRowIndex longValue] >= 0) { NSImage *im

Cocoa Key Equivalent in Menu is not working

孤街浪徒 提交于 2021-02-10 05:51:53
问题 I have created a NSStatusItem and I have assigned two key equivalents within interface builder (Xcode 4.0). These are for the preference menu cmd-, and the quit option cmd-q. Both of these will work when the Menu is highlighted/open but will not work otherwise even if the application is the foremost. Any ideas on why this is happening or how I can change this? 回答1: The operating system passes key events that it doesn't handle to the front application, which compares them to any key

Cocoa Key Equivalent in Menu is not working

Deadly 提交于 2021-02-10 05:51:51
问题 I have created a NSStatusItem and I have assigned two key equivalents within interface builder (Xcode 4.0). These are for the preference menu cmd-, and the quit option cmd-q. Both of these will work when the Menu is highlighted/open but will not work otherwise even if the application is the foremost. Any ideas on why this is happening or how I can change this? 回答1: The operating system passes key events that it doesn't handle to the front application, which compares them to any key

NSOutlineView drag line stuck + blue border

早过忘川 提交于 2021-02-10 04:55:48
问题 I'd like a correct behaviour from the blue drag bar , and no blue rect when dragging. Do you know where is my mistake ? (as you can see, the blue bar is stuck in top, like in this topic : Little circle-line bar stuck at top of NSOutlineView when rearranging using drag and drop) import Cocoa class ViewController: NSViewController, NSOutlineViewDataSource, NSOutlineViewDelegate, NSPasteboardItemDataProvider { @IBOutlet weak var outlineView: NSOutlineView! let REORDER_PASTEBOARD_TYPE = "com.test

NSOutlineView drag line stuck + blue border

筅森魡賤 提交于 2021-02-10 04:54:09
问题 I'd like a correct behaviour from the blue drag bar , and no blue rect when dragging. Do you know where is my mistake ? (as you can see, the blue bar is stuck in top, like in this topic : Little circle-line bar stuck at top of NSOutlineView when rearranging using drag and drop) import Cocoa class ViewController: NSViewController, NSOutlineViewDataSource, NSOutlineViewDelegate, NSPasteboardItemDataProvider { @IBOutlet weak var outlineView: NSOutlineView! let REORDER_PASTEBOARD_TYPE = "com.test

NSImage source from byte array Cocoa app Xamarin C#

做~自己de王妃 提交于 2021-02-09 09:27:24
问题 This is my first question there. I have created WPF application, which image control source is set to bitmap array of a random image. It works perfectly. The array contains information in the R,G,B order for each pixel. Now, I have to do same thing in Cocoa app for Mac and I have a problem, because I'm doing it first time. I have created NSImageView , expose it as outlet and try to set Image as follows in ViewDidLoad() method: IMW.Image = GetImage(); public static NSImage GetImage(){ NSData

NSImage source from byte array Cocoa app Xamarin C#

送分小仙女□ 提交于 2021-02-09 09:19:08
问题 This is my first question there. I have created WPF application, which image control source is set to bitmap array of a random image. It works perfectly. The array contains information in the R,G,B order for each pixel. Now, I have to do same thing in Cocoa app for Mac and I have a problem, because I'm doing it first time. I have created NSImageView , expose it as outlet and try to set Image as follows in ViewDidLoad() method: IMW.Image = GetImage(); public static NSImage GetImage(){ NSData

Editable NSTextField in NSTableView

夙愿已清 提交于 2021-02-09 02:44:49
问题 I have a view based NSTableView with some labels in my customized and subclassed view. One of the label should be editable, so therefore I set this NSTextField to editable. But now I have two problems, I can't solve: 1) If I move the mouse over the editable NSTextField, the cursor don't change to the IBeamCursor (the edit cursor). 2) I need to double click at the label, to be able to edit. I want to have a single click. I found some solutions for this problem here at stackoverflow, the best

How to change the background color of an NSPopupButton?

十年热恋 提交于 2021-02-08 15:54:46
问题 I am trying to tackle a problem which sounds pretty simple: changing the background color of an NSPopupButton. Interface Builder only allows changing the style to a pre-defined one and doesn't allow changing the background color. Also, setting up an IBOutlet didn't help since NSPopupButton doesn't have a setBackgroundColor method. I also tried subclassing NSPopupButton to override the drawRect method. Here's what I have tried: - (void)drawRect:(NSRect)dirtyRect { [[NSColor redColor] setFill];

How to change the background color of an NSPopupButton?

天大地大妈咪最大 提交于 2021-02-08 15:54:00
问题 I am trying to tackle a problem which sounds pretty simple: changing the background color of an NSPopupButton. Interface Builder only allows changing the style to a pre-defined one and doesn't allow changing the background color. Also, setting up an IBOutlet didn't help since NSPopupButton doesn't have a setBackgroundColor method. I also tried subclassing NSPopupButton to override the drawRect method. Here's what I have tried: - (void)drawRect:(NSRect)dirtyRect { [[NSColor redColor] setFill];