How in Delphi 10.4.2 show vertical separator lines in a TGridPanel that has a group of TRadioButton in its columns - radio-button

I have a TGridPanel that has 6 columns (as an example). In each column there is a TRadiobutton. All five TradioButtons from a group. In this way the five TRadioButtons work as expected, and at the same time only one of them can be checked.
To add vertical separator between columns, before adding the TRadioButtons, I have added four TPanels (in real code TStackPanel) and then I have inserted to each TPanels one TRadioButton, and then configured the panels's BevelEdges appropriately, to show the vertical lines. But now, as expected, each TRadioButton act separately, as their parents has changed from one unique TGridPanel to 5 separate TPanels.
Help me to have both vertical separators (in TGridPanel), and also make the TRadioButtons to act as a group.

You can do the following for each vertical separator:
Add a column to GridPanel.ColumnCollection
with Properties SizeStyle=ssAbsolute and Value=5
(column width in pixels).
Insert a TPanel into this new column
with Properties Align=alClient, Row=0, RowSpan=2,
Color=clBtnShadow and BevelOuter=bvNone.

Related

Need to use space separated values in AG-Grid filter to return each match

I'm tasked with moving some UI-Grids to AG-Grid.
I need to allow the user to use a space delimited string for a column filter so "1 4 23 88" would return all rows where column has 1 or 4 or 23 or 88 as a value.
AG-Grid has the drop down OR option but is added clicks and only allows two values.
With UI-Grid the filter parameter in columnDefs can have a condition:
filter:{condition: filterFunction}
FilterFunction simply has the custom logic and returned true or false.
Is there something similar with AG-Grid? Reading through the docs it seems to get overly involved to create a custom filter. The UI-Grid solution is like 6 lines of code.
CentOS 7, VueJS
I ended up using:
filter:'agTextColumnFilter', filterParams: {textCustomComparator: this.filterFunction}
With filterFunction holding the logic.
https://www.ag-grid.com/javascript-grid/filter-text/#text-custom-comparator
Though I'm using a number column there is not a comparator filterParam for numbers, only 'comparator' for dates and 'textCustomComparator' for text.
This seems to work fine for what I need.

How to assign a label to go.layout.Shape(type="line"...)?

I produce the following figure.
The figure has a number of add_trace applied to it with go.Scatter as arguments.
A list of 4 go.layout.Shape, type="line", with fixed color attributes, is created and the figure layout is updated with that list: fig.update_layout(..., shapes=...)
The traces have labels assigned to them that we can see to the extreme right.
Is there a way to add labels to assign to the lines as well?
You would like your lines to appear in the legend of the figure (https://plot.ly/python/legend/). However, only traces can appear in the legend, not shapes which are a kind of annotation. What you could do is to create the lines using go.Scatter(..., mode='lines'), and then they would appear in the legend. You just need to give the starting and end points in go.Scatter (see https://plot.ly/python/line-and-scatter/).

How to fill available tableview width with columns?

When tableview is created, the default behaviour of columns is to leave a lot of empty space. Is there a way to automatically fill the space?
One solution is described here:
JavaFX 2 Automatic Column Width
but this seems a little cumbersome.
TornadoFX comes with an advanced column resize policy called SmartResize. You assign it to a TableView like this:
columnResizePolicy = SmartResize.POLICY
By default it tries to do something useful depending on the data, and it will assign any left over width to the last column.
You can configure resizing options per column by calling the appropriate configurator function. For example, to tell the policy to give remaining width to a given column:
column("Name", Person::nameProperty).remainingWidth()
You can configure multiple columns to receive remaning width, so that they will share the remaining width between them.
contentWidth() will make sure the column width fits the content, with optional additional padding: contentWidth(padding = 50.0).
Most resize options also take an optional useAsMin parameter which will enforce the given setting as a minimum width for the column. useAsMax does the same for max width. You will get a fixed size by setting both useAsMin and useAsMax or specifying the fixedWidth(width) option.
You can distribute space using the weigthedWidth(weightNum) function, or even the pctWidth(pctNum) function. All these modes can be combined
Please see the TornadoFX Guide chapter about the resize policy for more information:

Grouped table view -- section spacing

In a grouped table view can I control the spacing between two sections?
Agree with 'viking'.. If you are still having troubles, I have noticed that if you create the table through IB it automatically creates a table header/footer section. If you go into the measurments(in IB) and decrease/increase the height of each section you will see the spacing between grouped sections change.
tableView:heightForHeaderInSection: and tableView:heightForFooterInSection:
together these control the space in between sections of a grouped UITableView. You cannot return 0, it will use the default value if you do, so use a small float (0.01) to reduce the space to almost nothing.
implement tableView:viewForHeaderInSection: or tableView:heightForHeaderInSection:

Displaying/Formatting Tabular Data (web)

In my example I have a table where each row is a user for example. Columns could include their name, address, email address, etc. I now need to add a column for (hypothetical example) their cat's names. While most people will have no cats and some people will have 1- 2 cats there will be the occasional person with 20 cats that create one very long row in the table. This is giving me an issue in presentation and for filtering/searching for cat names. Is there a good solution to displaying this type of data?
Have the first 50 (or whatever) characters of the field displayed as normal then put the rest in a block with its visibility set to hidden through CSS. Include a link / button / icon that will allow the user to toggle the visibility so they can see the entire value.
Several options:
Set a maximum width for the cell and allow the data to wrap
Place the content inside a wrapper tag (such as a div) and set the div with a fixed width/height and style of overflow:hidden to ensure that a particularly long word doesn't force out the width of the cell.
Truncate the output text on the server side
For cases #2 and #3, set the Title attribute of the TD tag to contain the full non-truncated text. This will present itself as a tooltip when hovering over the cell.
I would mention other CSS-based solutions but they're very sparsely supported right now, so not worth mentioning.
You might want to try doing something like what SO does. Namely, once someone reaches a certain point in their Rep, it suffixes the number and appromixates it. Ex. 10k instead of 10,236.
That way the numbers don't get out of hand.