I am trying to have three labels on the screen, the center label is supposed use long mode break, the labels above and below it will use long mode crop. Here is the issue:
The labels could have variable sizes, sometimes they will need to break/crop, sometimes they may be very short. When I set long mode crop for the bottom and top label as well as center align them, the long mode crops the start of the text label, which isnt ideal. When I set the text to left align, the crop mode crops the end of the label, however when the label is short, they no longer align with the center label which is center aligned and uses long mode break.
What MCU/Processor/Board and compiler are you using?
Irrelevant for this
What LVGL version are you using?
v7
What do you want to achieve?
All three labels should be aligned to the center of the screen. When the top and bottom labels are too long, they should crop the end of the text label but leave the start intact. The center label should go into long mode break.
What have you tried so far?
I tried to left align the labels, but that results in short labels no longer being aligned to the center of the screen.
We have found an intermediate solution in which we set the label long mode to expand, set the text, get the size and if its above a specific width we use long mode crop, left align the text in the label and set the text again. It works but surely there is a simpler way of doing this?
Correct me if I am wrong, but the “correct result” would not mean that the bottom most text is cropped on both sides of it? Of your bottom label the first two letters are cropped, which makes the label hard to read/ ambiguous to understand what its supposed to say. Surely this is not intentional behavior by LVGL?
I want the text to be cropped at the end, what long mode would I set it to, if not long mode crop, in order to have it cropped? My question is in regards to cropping text and center aligning it, without cropping off both ends
Well, I want the text to be center aligned regardless of its length and crop it if its too long. But since that is currently not possible as it seems, yes I want to left align and crop the text if its too long, otherwise center align. So in theory I have a screen like