nspopupbutton

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];

Separator item in NSPopupButton with bindings

天大地大妈咪最大 提交于 2020-01-03 07:21:28
问题 The contents of a NSPopupButton are bound to an NSArray of strings. How can we insert a separator item via bindings? The " - " strings (like in the olden/Classic days) doesn't work, i.e. shows up literally as a " - " menu item. Is there any out-of-the-box solution with standard Cocoa classes and bindings? This should be a trivial problem but I can't find any solution to the problem that doesn't involve silly hacks like subclassing NSMenu , NSPopupButton or other non-intuitive work arounds.

Using full width of NSPopupButton for text, no arrows

青春壹個敷衍的年華 提交于 2019-12-25 11:25:24
问题 I like to display an NSPopupButton that has no arrows. I like to use that space where the arrows would be for the label text. That doesn't seem to work by default. Here's the text (which is "01234567890") with the arrows enabled: And here with no arrows: As you can see, the space the arrows would occupy is not used by the text. How can I use the full content width for the text? I've inspected the control with F-Script but found that the control's subviews array appears to be empty - I had

A popup button with a static image (Cocoa OSX)

天涯浪子 提交于 2019-12-12 16:30:07
问题 I am trying to make a popup button that always displays a + as its image and when you click on it, a context menu pops up that will allow you to decide what type of object you want to add. Is there anyway to do this using an NSPopupButton? I saw in the specs for NSPopupButotn that the method SetImage has no effect so it seems that this is likely not going to work using this class. Is this correct? 回答1: Yes, the visible appearance of NSPopUpButton is wrong for what you want. What you want is a

Xcode_OSX/Swift_NSPopUpButton.

白昼怎懂夜的黑 提交于 2019-12-12 12:22:38
问题 I am incredibly new to this, so please keep that in mind! I've been at this all night, watched countless videos/haunted countless forums... I can't find one single answer! I am trying to make a basic popup menu in Swift/OSX What I need to figure out is: How can I add more than the 'three items' to this menu Whatever is selected in the popup, for that info to send an integer value to another number. I very much would appreciate your help, Thanks. 回答1: A NSPopupButton is a container for a bunch

NSPopUpButton + Bindings + Show All Option

天涯浪子 提交于 2019-12-09 01:05:29
问题 I'm trying to develop a NSPopUpButton that will serve as a filter to some datasource, let's say a NSArrayController that fills a table. I can bind the NSArrayController from the menu to the selection keypath so the data is properly filtered, no problem with that. Tricky part is, I want the content of this NSPopUpButton to rely on an NSArrayController using bindings, but I'd like to add a "Show All" menu item, or at least some item that doesn't come from the Core Data and performs some special

How to populate NSPopupButton from CoreData in View Based NSTableView

家住魔仙堡 提交于 2019-12-06 06:04:56
问题 I am using view based NSTableViews that is populated using bindings and array controllers with core data. Everything works great--cells with text and buttons and cells with image and text--I can edit the text as well, etc. What I can't figure out and have searched everywhere is how to populate the popup menu. There are 2 array controllers, one for table view and one for popup buttons menu items. I have tried binding the popup menu the classic way: by binding content (arrangedObjects to entity

NSPopUpButton, NSComboBox similar menu

耗尽温柔 提交于 2019-12-04 06:26:01
问题 I'm trying to create a menu with a drop down menu with a custom background for every cell. First i tried to adapt NSPopUpButton but i couldn't find a way to change the cells background image. Using setImage: would slide the text to the right of the background. Next I stopped at NSComboBox but i couldn't find a way to change the arrow button. Can someone please help with and idea? Next thing would be to create a custom controller but i would like to use something already done. 回答1: To

NSPopUpButton of type pull Down , when i click on some menu item ,title of popup is not getting changed

自闭症网瘾萝莉.ら 提交于 2019-12-03 16:23:55
Problem: Take an instance of NSPopupButton of type Pull down. Add few menu items to the pop up. Run the code. Select any menu item in the popup Title of popup button is not getting changed. I need to show the selected item as title of Popup same as Normal behaviour of NSPopupButton but with the type pull down. Also Need to add an item as same name as title. Can anybody help me to achieve this? From the documentation , Unlike popup lists, the title of a popup button displaying a pulldown list is not based on the currently selected item and thus remains fixed unless you change using the cell’s