Grouped table with image in first row (and section), the remaining ones having text with different length - objective-c

I have a grouped table with two sections where I display text with different length and therefore cell height.
I have solved the problem with the different length/height with constrainedToSize in cellForRowAtIndexPath.
Now I want to add a section with one single row in which I want to show a picture.
How should I best implement that? (still a bit of a beginner with the Objective C)
I would guess that I would have to create an UIImageView and somehow link that to the cell, but my biggest concern is how do I do with the dequeueReusableCellWithIdentifier now that I will have two different type of cells?
Appreciate any advice that will help me save time from trial and error!

I ended up doing this:
Since my image is in my first section (and nothing else in that section) I divided my cellForRowAtIndexPath in to two parts with a simple if statement. One for the first section and one for the rest. Then I use two different dequeueReusableCellWithIdentifier and can set up two kind of cells. So far it work fine.

Related

How to make a table header fixed when scrolling in codename one

I need a scrolling table with a fixed header. I tried a borderlayout.center. and checked table scrolling methods , but failed. First row keep moving out of screen.
I really appreciate help.
Thank you
Essentially you create two tables and place one in the north and one in the center of a border layout. The north one contains only the header and the south one contains only the body.
The one important thing is to override the constraint method in the table and return identical values for cell widths. That way everything aligns.

NSTableView, [table selectedCell] suddenly gives nil value

I must have changed something to break this line of code in my project:
[table selectedCell] //it gives nil value
but the table row is selected (it's highlighted).
Table is cell based.
What could be the reason?
UPDATE: I've just seen in the documentation that this method has been deprecated in 10.10. But then what should I use to get the current selected cell?
It really depends on what you are trying to do. -selectedCell isn't specific to NSTableView; it's inherited from NSControl and isn't particularly useful to a table view. Individual cells can't be "selected", but rows or columns can.
Cells can be edited, however. Is that what you're trying to find out? Which cell is currently being edited? If so, you can use -editedRow and -editedColumn.
Otherwise, you can get either the selected row / row indexes or the selected column / column indexes, but row and column selection are mutually exclusive and either would encompass multiple cells. Since NSControl's -selectedCell can only ever give you one cell, you'll never truly be able to get an answer that makes sense using that method on a table view. But of course only one cell can be edited at a time.
So is it selection or editing you're looking for?

VBA - Excel - Display one section of sheet using different column widths

I couldn't figure out how to word the question, so please comment if you have a better wording.
I am creating a report the has multiple sections, all displayed on one sheet. One of the sections need to be displayed at equal column widths, while the rest of the report has varying column widths. What I would like to do is display this section as some sort of chart/table that will display as if it was part of a continuous report. Should I be using listboxes or is there a better option?
Thanks for any help.
I'm not sure I completely understand your question, but from what I do understand, maybe what you could do is put the part with the fixed column widths on another part of your sheet and then:
Copy it
Go to where you want it in the report and Paste Special > Linked Picture (I)
I think that would give you what you're looking to accomplish, otherwise, please clarify a bit more...

Getting the column and row of an NSCell in an NSMatrix in Cocoa

Given an NSMatrix and an NSCell is there a quick way to query the matrix to know at which row and column in the matrix the cell is placed. I would like to know this upon receiving action messages from NSActionCells.
The only way I can see of doing it is to loop through the rows and columns of the matrix and check for equality with the message sender, or give tags to the cells based on their position, which is ugly. I'm sure there's a better way of doing this, isn't there?
You can ask the matrix which row and column a cell is at.
I think you should set a -tag value on the cells in question. The canonical example of this is the cells in a matrix of digits for a calculator app. Instead of trying to figure out where they are in the matrix, you can just check their tag to see what digit they represent.

how to prevent some columns from being highlighted when selecting a row

I have a semi-dynamically created window ( and use PowerBuilder 10.5 ). Now there are a couple of columns which can have different colours and I want to see those colours when selecting a row. However I don't know how to deselect these columns and have the first couple of columns remain selected.
The highlight function in our application just does a dw.selectrow( x, true ).
Regards,
Marinus
I don't think you'll get what you want using selectrow. If you don't need multiple selections you could change the background of the current row with an expression in the datawindow. If you want some columns to stay normal you could do that with a rectangle behind the ones you want to highlight instead of changing the row color. If you need multiple rows highlighted you will have to simulate multi-select by adding a dummy column and using that to control the background, and of course you need to handle the selecting and deselecting in the clicked event. If you've got code that deals with selected rows you'll have to change them to use the new scheme, for example by checking the value in your dummy column.
If you want to use SelectRow(), maybe use of SetRowFocusIndicator() would help. IIRC (it's been pretty close to decade*s* since I've used it), it disables the row colouring in favour of the new method.
The other way that comes to mind is setting an expression for background colour that uses GetRow() and CurrentRow(). This wouldn't be my first choice, as it doesn't let users with vision impairment choose their colours through standard Windows colour selection to something they can deal with, but if you're dead set on colour indications on selective columns, this would be the way to go.
Good luck,
Terry.