Using JavaFX's GridPane container, how can I set a button (or anything else) to expand horizontally until it fills all assigned cells?
I add the button to my GridPane using this line:
grid.add(button, 3, 0, 3, 1);
But the button is only as wide as its text, which is about 2.5 cells. I want it to entirely occupy all 3 assigned cells.
You can do
// allow button to grow:
button.setMaxWidth(Double.MAX_VALUE);
// ask GridPane to make button fill it's cells:
GridPane.setFillWidth(button, true);
Related
I am using pandastable to display a pandas dataframe. I would like to set the fill color or the background color of a cell based on the value. Is there a function I can call which takes row index, column index and color? BTW, when I right click on a cell in a displayed table, it gives me a menu to select a color, but it does not set the color of the cell. How is the selected color used?
Thank you.
I want to colorize selected fields from user with a Office Script.
Is that possible?
Robert
EDIT:
Select a number of cells, depending on which the user chooses
Press a Button (Make Cell Green)
Colorize the Cells which were selected.
You can use workbook.getSelectedRange() to get the user selected range in the workbook.
function main(workbook: ExcelScript.Workbook) {
workbook.getSelectedRange().getFormat().getFill().setColor("4472C4");
}
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)
I have an excel workbook with three dynamic scroll bars in one tab of a workbook. I need to dynamically adjust the "max" value of the scroll bar based on the total lines of data in the source table. I have tried using the following code to achieve this; however this is adjusting the Max for all three scroll bars based on the value in cell S49, rather than separately adjusting Scrollbar 1, 2, and 3, based on the values in S49, S66, and S83, respectively:
Private Sub ScrollBar1_Change()
ActiveSheet.ScrollBar1.Max = Range("S49").Value
ActiveSheet.ScrollBar2.Max = Range("S66").Value
ActiveSheet.ScrollBar3.Max = Range("S83").Value
End Sub
How would I go about modifying this code in order to independently trigger the max value of each scroll bar based on a change in these cells?
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.