I have a perspective display where I want to display a series of batch parameters on a single line. For example, I want a single line of text that looks something like:
Batch ID: 00001----Recipe: Class 3 Widget----Length: 50mm----Weight: 25g
Some values are of relatively fixed format, others (like the recipe) might be 5 characters long or 50 characters long.
- I want the dashes replaced with blank space.
- I want the same amount of blank space between each parameter:value pair
- I want each text label to expand and contract as necessary to fit the required text, maintaining the same amount of blank space on each side
- If the view runs out of width, I want certain values to be clipped (and ideally, have something like “…” to show that it’s been clipped to ensure the remaining values have enough space to display. For example, I might clip a long recipe name but leave the date field at the same width
- I want the whole resulting string of text centered in the view
I’ve tried using a single text object with a lengthy expression. The problem is that I can’t insert additional spaces in the string to create my “blank space” - it converts any number of spaces into a single space (so did the code formatting above, which is why I had to use dashes to make my point). It also doesn’t offer any easy way to clip text if I need to.
I’ve tried using a flex container in row mode, and setting up individual text labels that have left and right margins to create the blank space between them. This works, but the blank space is inconsistent because I have to give the labels a fixed basis.
What else could I try?