NSTableView display selected row into NSTextField - objective-c

I'm a still newbie in cocoa and I've already created NSTableView with buttons to add and remove selected rows. I added NSTextField label to display the values from selected row of the two columns.
Can anyone point me into right direction how to achieve this? I guess that it should work like this:
get selected row index number
get string value of both identifiers in selected row
set string value
also there should be if nothing is selected the string is empty I guess.

Found what I was looking for about the NSTableView bindings.
https://developer.apple.com/library/mac/#samplecode/NSTableViewBinding/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010522-Intro-DontLinkElementID_2

Related

VB Getting the selected item from a List View

I have a list view with two columns and I'd like to be able to save the value of the leftmost column for the selected row, or even better make it so that once the user clicks on either the right or left column of any given row, the entire row selects and not only the field that was clicked.
However I'm struggling to get the field saved which is more crucial than the row highlighting.
In a list box it would be
string = listbox1.selecteditem.tostring
However this doesn't seem to work for the list view. It won't even let me put "Selecteditem" and instead requires I put selecteditems, however this doesn't seem to do what I want either.
When I use the code:
string = ListView1.SelectedItems.ToString
I get the result of
string = "System.Windows.Forms.ListView+SelectedListViewItemCollection"
Despite the selected field actually being "EGG".
I need to have two columns so can't switch to using a listbox, although that seems like it would be the easier solution.
When I tried googling this question I could only find things for C#
Set FullRowSelect on to get the entire row to select.
SelectedItems.ToString refers to the collection of selected items.
SelectedItems(0).Text refers to the first selected item's text property.

How to display the datagridview rowheaders on the right?

I have a datagridview which displays row numbers in the rowheaders on the left. One of the users has asked for them to be on the right instead. The display of row numbers is fine, it's the location of the rowheaders that's the issue here.
I have looked through various properties and can't find anything that switches the row header over to the other side.
I realise I could add another column to the right and format it to look like the rowheaders, but that seems like a clumsy workaround.
How about setting the RightToLeft property of the datagridview?
Me.DataGridView1.RightToLeft = Windows.Forms.RightToLeft.Yes
Bear in mind that this reverses the display order of the columns, which you would have to manage as well, if you want to give the appearance that the only thing to change is the position of the rowheader.

strike through a selected row in NSTableView

I am new to mac app.In my application i have booked history tableview.when the user click on "withdraw" button,I want to strike through the selected row of the tableview.And I am getting tableview content from NSArraycontroller.I don't know how to do it.If any one knows,guide me to do.
This is in mac osx,not in ios.
One way to obtain this would be to use a NSTextView inside your table cell and then bind the attribute string to you array controller. Now in the array controller you can change the relative value by adding an attribute of the type NSStrikethroughStyleAttributeName.

NSTableView selected row highlight

I have a NSTableView with two columns, one is NSButtonCell and the other is a NSTextFieldCell. The text in NSTextFieldCell cannot be edited but the user can select a part of the text and make it bold. The current implementation is to allow them to do a double click and select a part of the text. The problem is, once the user is done bolding, the highlight color at selected row still persists.
The NSTableView usually has variable number of rows each time. I cannot do SelectRow as false as I need to be able to select the row. I also need to support 10.5.8 so I cannot set - NSTableViewSelectionHighlightStyle as None.
My application is a Cocoa application, which needs to run on 10.5.8, 10.6 and 10.7.
You can try setting the selected row as false. NSTableView has a method deselectRow. After bolding is done, you can deselect the row.

Can I programmatically modify which UITableViewCell is selected?

Is there a way to move the highlighted tableviewcell programatically. If I wanted to highlight cell number 3 and then highlight cell number 4 instead, based on something the user did in the detail view of my split view controller, can I do this?
Is there a way I can get the indexpath for the row two below one that I have?
Thanks!
You can do this via the UITableView selectRowAtIndexPath:animated:scrollPosition: method.
In terms of getting the "next" row from the indexPath, you can simply use the indexPath.row property (as supplied from your UITableViewDelegate's tableView:didDeselectRowAtIndexPath: method) as the basis for the selected row.