How to get values from custom cells with textfield UITableView? - ios4

I have created a UITableView which function like this section 0 2 custom cells (First name,last name with UITextFields) section 1 (tap a button on header insert a new cell with textfield + a Button to change the title) section 2 (tap a button on header insert a new cell with textfield + a Button to change the title) section 3 (tap a button on header insert a new cell with textfield + a Button to change the title ). Now suppose I create a 3-3 rows in each section except section 0. How do i dynamically get all the textfields values?

You have a datasource for your TableView.
This source should be updated automatically everytime you insert a new cell.
So if you iterate through the array containing your datasource there should also be the values of the textfield somewhere.
If this isn't the case you should think about the way you are adding the new cells.
Usually in your datasource there should be reserved some space for the data in the textfield.
If you create a new Cell now, the space reserved for the data of the textfield should be updated with the new data.
If I understand you correctly you have a cell with a lable and a textfield and a button.
you create a cell, enter some text in the textfield and then press the button.
then the content of the textfield should be displayed in the label.
If i'm wrong please shove me in the right direction. Maybe you can post some screenshots or something.
!!!!! Wrong approach !!!!!!!
Iterate through your cells you get
from the method
[tableView visibleCells];
and then get the value from the
textField contained in the cell via
NSArray *myArray = [[NSArray alloc] initWithArray: [tableView
visibleCells]];
[[(YourCellSubClass*)myArray textfield] text];
I have not tested this, but i think it
should work.
!!!!!! Wrong approach end !!!!!!

you must set delegate of UITextField the ViewController in which you have the UITableView. then override this method to get the text of focused textfield textField:DidEndEditing.
Also you can set the tags for each UITextfield to differentiate them.

Related

In Infopath 2013 how to change a value in repeating table when press a button

I'm using InfoPath 2013, where I have situation like below:
I have a repeating table, where like to change value when press a button. E.g. In above picture, I wish, if I press button [Change value], then if value in drop-down [Test1] is same as Value1 [Test1] in repeating table, then change respective ID value from '1' to '0'.
I have tried buttion's option: 'When this button is clicked', then: 'Set a Field's value', however it change all values in ID column, but it should change ID only, where Value1 is Test1, means 3rd row..
Any guide or suggestion would be very helpful. Thanks in advance.

Add a "Same" PushButton on every row in QTableWidget [duplicate]

I have a question regarding QTableWidget at PyQt4. Say I have a QTableWidget, where I want to have an event connected to a cell click using:
table.cellClicked.connect(cellClick)
then, cellClick function does its job. The thing is: some cells contain a button, like so (coordinates 0,0 as an example):
button = QtGui.QPushButton()
table.setCellWidget(0,0, button)
Now comes my problem. The presence of the button in a cell (which takes up the entire cell space) completely disables the cellClicked - the cell doesn't get clicked, the action can't be detected. But I do want my button to fill the cell.
So, in short, my question is - how can I select (click) a QTableWidget cell when there's a button inside it?
The simple answer would seem to be:
button.clicked.connect(cellClick)
But then how would you know the row/column of the cell that was clicked? So the next iteration might be:
button = QPushButton()
table.setCellWidget(row, column, button)
button.clicked.connect(
lambda *args, row=row, column=column: cellClick(row, column))
Which is okay if the table is static. But what if the rows and columns can be rearranged? The row/column cached in the button's clicked handler could be invalidated in that case. So the next iteration might be:
index = QtCore.QPersistentModelIndex(table.model().index(row, column))
button.clicked.connect(
lambda *args, index=index: cellClick(index.row(), index.column()))
(NB: you can connect other slots to the button's clicked signal, but the order they will be invoked in is undefined)

How To Change Font Bold in Crystal Report In C#

I'm facing problem a with Crystal report. I want to display location like
J1 // One by one
J3
in data table. Then I want check condition like if J3 and OT='YES' (OT column from datatbase), if true means I want show J3 as bold.
How can I achieve this?
Right click on the field that displays the J1, J3 and click on Format Object to enter the Format Editor.
In the font tab you can find the Style property as shown below:
Click on the [x+2] button which is on the right side of the style property and write the following code there
if {DataTable1.ColumnName} = "J3" and {DataTable1.OT} = "YES" then
crBold
else
crRegular
Replace the DataTable1 with the name of your data source and the ColumnName with the name of the field that holds the J1, J3.

Get selected multi value data into string

I have a field in a sharepoint list which is a look-up from another list. It is displayed on the infopath form as a multi value checkbox.
I am trying to work out a way to perhaps concat each of the selected items into one string.
For example; the Multi-Value checkbox contains
(! = checked, * = unchecked)
! Example A
* Example B
! Example C
I would like a new field called MyString to equal "Example A, Example C"
I have tried to do a rule with a button press to query the secondary datasource for the external list, and filter it on the Multi-Value checkbox value. This works brilliantly for attaining the second column (Dollar Amount) by doing a sum(secondary.amount) with the filter - however I am still unable to work out how to join the selected strings.
Any hints would be most appreciated!
You could have a rule on each of those checkboxes that runs when the checkbox is changed. Each rule would look up the other checkbox values, concatenate them how you need it, and set the value of the final MyString textbox field to that string.

Handling editing an NSTableView

I have an NSTableView backed by an NSArrayController subclass. The data displays correctly in the table when the app loads, so all is good there. I want to add a new row to the table, so I created an override for addObject to handle my custom object. When called, addObject inserts the new object into the underlying array, but the new row is the last row in the table, (makes sense, I think, as its added to the end of the underlying array), but I want the new row to be inserted as the first row. So I changed my addObject to insert the new item at index 0 (insertObject:atArrangedObjectsIndex:). Now the new row is inserted as the first row and the cell in column 0 is editable (Yeah!). BUT, when I tab to the next cell (in column 1, row 0), the selection jumps to the last row in the table and makes the cell in the second column editable. Not what I want. So how do add a new first row to my table? Make it editable without the selection switching to the last row?
I found the problem. I was programmatically sorting the table as items were added. The sort kicked in after I entered a value in the editable filed.

Resources