I have 2 custom cell in a grouped style table. The one loaded form xib positions accessory view correctly the one created with storyboard does not, although I think it has more to do with dimensions of the cell. See picture:
EDIT: it is irrelevant if accessory is set in the code or if standard accessory is specified through IB
Any ideas why this could be happening and how to fix it?
In custom cell overwriting layoutSubviews and doing something like this seems to be fixing the issue.
However I am still not clear and what the x offset is supposed to be adding 10 gets it close, but what is it actually supposed to be? How is offset is calculated based on height of the cell?
- (void)layoutSubviews {
[super layoutSubviews];
self.accessoryView.frame = CGRectMake(self.accessoryView.frame.origin.x **+10**,self.accessoryView.frame.origin.y, self.accessoryView.frame.size.width,self.accessoryView.frame.size.height);
}
Related
I have several custom screens which have grids. On all but one of them I can resize the columns. In the one where I can't resize, I'm using BLC code to determine when to hide the column and what to display as the name of the column. I do this as follows:
PXUIFieldAttribute.SetVisible<xTACOpenSourceDetail.string03>(OpenSourceDataDetail.Cache, null, true);
PXUIFieldAttribute.SetDisplayName<xTACOpenSourceDetail.string03>(this.OpenSourceDataDetail.Cache, ossd.String03);
All my grids are set up the same way, except for this one difference. Is there an attribute or property I can set to make sure these columns are sizable as well?
After dissecting this for a while, The solution I've come up with was to re-create the entire screen from scratch. This corrected the issue, and I can only conclude that something became corrupted within the original screen and could not be refreshed or recompiled. It is still unknown what caused the issue to begin with.
My program uses TableWrapLayout with numColumns set to 2. I then have the following code: (background colors are set to show you that the widgets aren't using the blank space).
Label label = toolkit.createLabel(container, "Resource Type":);
label.setLayoutData(new TableWrapData(TableWrapData.LEFT,TableWrapData.MIDDLE));
label.setBackground(DiagramSettings.NODE_BACKGROUND_COLOR);
resourceComboMenu = new Combo(container, SWT.READ_ONLY);
resourceComboMenu.setBackground(DiagramSettings.NODE_BACKGROUND_COLOR);
resourceComboMenu.setLayoutData(new TableWrapData(TableWrapData.LEFT,TableWrapData.MIDDLE));
However as you can see in the picture the combo box refuses to left align properly. But that I mean I want it to start right after the label, not have a bunch of blank space.
One workaround would be to put the row inside it's own Composite just like I do Resource Icon and Geolocation. But I feel like I shouldn't need to since the widgets on this row equals the number of columns set by the layout. I've created this workaround for now but would like to understand this TableWrapData behavior for the future.
Any insight would be helpful, thanks.
I pretty much answered my question in the question. The composite that contains everything in the picture had TableWrapData with columns set to 2. TableWrapData essentially draws a straight, vertical line between each column then makes sure widgets from one column don't cross it.
So to fix this (like I mentioned in my question) you simply make another composite with nested widgets (which in the case would be the resource type label and resourceComboMenu). I just didn't realize that is what you're supposed to do.
I have a custom cell layout, inheriting from MvxTableViewCell. One of the cell's contained views is a UILabel that supports text wrapping. The wrapping will mean the cells can be of different heights as that is driven by how much text is in each data item. The custom table cell is defined without any Storyboard or NIB. It is laid out in code and uses AutoLayout.
I am finding that the cells are being reused and the heights are staying the same as they were when they were previously used.
When the data source is updated and new items are in the table the previously taller cells are reused for cells that don't need that extra height. Do I need to create a custom MvxTableViewSource that has specific reuse logic? How would I even ensure that extra height rows were not reused?
I am hoping this is not a Monotouch and MVVMCross specific issue but just in case, this is how I am using the UITableView
this.searchResultsTable = new UITableView();
this.searchResultsTable.AccessibilityIdentifier = "SearchView_SearchResultsTable";
this.searchResultsTable.TranslatesAutoresizingMaskIntoConstraints = false;
this.searchResultsTable.RowHeight = UITableView.AutomaticDimension;
this.searchResultsTable.EstimatedRowHeight = 44.0f;
this.searchResultsTable.AllowsMultipleSelectionDuringEditing = true;
this.searchResultsTable.TableFooterView = new UIView();
The Table Cells display correctly on first use of the View but subsequent uses cause issues as does scrolling.
For example here is a screen shot of mixed height working followed by the same list after the taller row has been scrolled off the screen then back on. The red boxes show how box the cell should be (FWIW this is test data not real people's data)
Another example, here the table is again displayed correctly then loaded again with the same data yet the second load has the cell height incorrect
I broke my two issues into two questions however there is a solution for both this one and the other issue with this SO answer, UILabel not wrapping in UITableView until device rotate (iOS8)
I have an ext.net page containing a table built by TableLayout. It is similar with the example shown on the official demo site. (link) The only thing different is I have combo box, textbox inside those Cells, not just a bunch of panels.
Now, there is the need to dynamically hide some textboxes based on the selection of a combobox. What I have done is to set up the combobox to AutoPostBack="true" OnValueChanged="comboboxname_OnValueChanged" .
In that code-behind method comboboxname_OnValueChanged, I check the selected value and do a textboxname.Visible="false". Then I got the unexpected: the whole Cell that contains that textbox is removed. And my whole table is messed up!
Then my guess is that the Cell must remain in place to occupy the position. My next try is:
mytablelayout.Cells[5].Clear();
mytablelayout.Cells[5].Add(emptyLabel);
here, the index 5 is the table cell with the textbox I want to hide. and emptyLabel is an ext.Label which displays nothing. Unfortunately it does not work.
My third try is to build an empty cell first. then,
mytablelayout.Cells.RemoveAt(5);
mytablelayout.Cells.Insert(5, emptyCell);
I found RemoveAt(5) can be successfully executed, which again messed up my table because the next cell just moves from its supposed place. But the Insert(5, emptyCell) just never did what I want.
Now I am really at my wit's end. Can any ext.net expert give some advice? How did you manipulate the Cells in a TableLayout?
Thank you for any helpful input.
make a CSS class with display none.
.myClass {
display: none;
}
set the textbox cls property to the CSS class made earlier
textboxname.cls = "myClass";
I asked this question on the LiveCode email list. No response, so I figure it must not be possible. I know about editing the template graphic that enables alternating row colors. That doesn't help me.
This lesson is the closest to what I have found, but it only sets the overlay color to empty cells. It also had an unwanted affect, where any data that was present in the grid no longer shows up.
http://lessons.runrev.com/s/lessons/m/datagrid/l/7327-how-do-i-override-the-default-behavior-for-rendering-data-to-a-cell
As a little experiment, since the data became invisible (note that I'm on WinXP), I tried placing an opaque graphic over the column I wish to colorize. I set the ink of the graphic to AddMax or AddOver, and it looked nice, but the text in the cells disappeared. Then I tried setting the ink to AddMin, and it still looks good, but the test shows through!!!!
So, I think this will work fine visually, but how can I pass a double-click through this graphic to the cell underneath (to allow cell editing only within this column)?
Yes, you can do this.
This suggestion comes from Trevor DeVore at http://www.bluemangolearning.com/
Create a custom column template using the property inspector. From there you can edit the behavior of the column to colorize the background color of the field for that column or just edit the field in the template group to change the color.
The background color will only show up in rows that have data, however.