nstableview

How to bind a NSTextField to a raw string while displaying another attributed string?

怎甘沉沦 提交于 2020-01-24 20:14:29
问题 I'm using view-based NSTableView and would like to allow users to edit text in place. Cocoa typically has superb support for this, but I am not sure how to bind the value of NSTextField to one string while displaying a slightly different string to the user, as shown below. For example, when user clicks on a text field or presses enter key to edit, the field editor should only be filled with exportTest.zip and not exportTest.zip Shared , and whatever edit user makes should only affect the

How to bind a NSTextField to a raw string while displaying another attributed string?

拈花ヽ惹草 提交于 2020-01-24 20:13:22
问题 I'm using view-based NSTableView and would like to allow users to edit text in place. Cocoa typically has superb support for this, but I am not sure how to bind the value of NSTextField to one string while displaying a slightly different string to the user, as shown below. For example, when user clicks on a text field or presses enter key to edit, the field editor should only be filled with exportTest.zip and not exportTest.zip Shared , and whatever edit user makes should only affect the

InterfaceBuilder NSButton connect to NSViewController Cause “Could not connect action, target class NSObject does not respond to”

依然范特西╮ 提交于 2020-01-24 19:35:16
问题 I have a view-based NSTableView whose "file's owner" is the ViewController . I dragged a button(for deletion) on the custom NSTableCellView , so I want to click the button and delete the current row from tableView, but when add a row the debug console tells me " Could not connect action, target class NSObject does not respond to deleteAction: " I m using the NSArrayController binding the NSTableView(add action is triggered successfully). I also got another weird problem, I try to subclass

Why does an NSTextField leave artifacts over an NSTableView when the table scrolls?

自作多情 提交于 2020-01-24 16:08:29
问题 I want to put a text label over a scroll table but the label conflicts with the drawing of the scrolling. Here you can see a test where I've intentionally put the label half out of the table and scroll up in the table, which results in the part of the label overlay being dragged below until it exits the window. Also, when I go to the other end of the table and scroll down, sometimes the label seems to be redrawn and chunks of it go up along with the scroll: It seems that the table is

Displaying row index in an NSTableView bound to NSArrayController

穿精又带淫゛_ 提交于 2020-01-22 12:29:19
问题 I have an NSTableView which is bound to an NSArrayController. I would like to have one of the table columns showing the index of the table row. This is easy enough to do when you implement NSTableDataSource yourself but I can't figure it out with a bound table view. I guess I'm looking here for something like the @count key path which gives me the count of arrangedObjects (that is @index) but this is obviously missing. Two clarifications: The index that is shown in each row is the index of

Window is not releasing when switching to another window

二次信任 提交于 2020-01-17 04:45:13
问题 I am creating a Mac application in which I have mainwindow with some buttons. When I click button it will open a DetailWindow with NSTableview. Every buttonclickevent change the data in NSTableView. Here is my code: In my mainWindow.m FIle - (IBAction)btn1Event:(id)sender { if (!detailwindow) { detailwindow = [[DetailWindow alloc] initWithWindowNibName:@"DetailWindow"]; detailwindow.mainwindow = self; } detailwindow.title = @"First"; [detailwindow showWindow:self]; } - (IBAction)btn2Event:(id

How to always visible horizontal scrollbar of NSTableview in objective c programmatically?

喜夏-厌秋 提交于 2020-01-16 07:29:23
问题 I have added NSTableview with multiple columns, I want its horizontal scrollbar should always visible, How to achieve this? 回答1: I create NSScrollview outlet & set in .xib file to superview of NSTableview & used two methods. - setAutohidesScrollers set NO, - setScrollerStyle: set NSScrollerStyleLegacy Set style NSScrollerStyleLegacy meaning is NSSCrollbars background is not transparent. This solved my problem, Hope it will help others. 来源: https://stackoverflow.com/questions/48543845/how-to

How to make round cornered NSTableView rows?

China☆狼群 提交于 2020-01-16 00:59:29
问题 I'd like to make something like this (on the new iTunes): As you can see when the row is selected it's "highlight" state is a round cornered row. How can I achieve something like this? 回答1: You need to subclass NSTableview and override -highlightSelectionInClipRect: method. It can be done like this: Change your tableView's highlighting mode from regular to Source list in Attributes Inspector : And now subclass NSTableView like this: -(void)highlightSelectionInClipRect:(NSRect)theClipRect {

Automatic table column Indentifier in NSTableView

故事扮演 提交于 2020-01-13 06:01:04
问题 After bit of research, I was able to populate the NSTableView with some date via the "identifier way" like you assign unique identifier to each column. However, I would like to now if there is a way to populate NSTableView without providing the identifier to the columns and how? To be more clear - the use of automatic table column identifier, which is slightly described here: About the automatic table column identifier and and I find a way how to enumerate or get the index of the column by

NSTableView not updating like I think it should

被刻印的时光 ゝ 提交于 2020-01-07 07:42:49
问题 I have the following code: - (void)updateServerList { [crazyStuff reloadData]; NSLog(@"Hi"); } - (int)numberOfRowsInTableView:(NSTableView *)tableView { NSLog(@"Numbers have Changed"); return [serverBrowser.servers count]; } - (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(int)row { NSLog(@"Starting updates for table"); NSNetService* server = [serverBrowser.servers objectAtIndex:row]; return [server name]; } - (IBAction)tableViewSelected:(id