Replies: 1 comment
-
|
To omit the colon separator you can override 32 display->draw(hasFocus ? (inEditMode ? editCursorIcon : cursorIcon) : ' ');
...
39 // Draw colon separator if value is present and within bounds
40 if (value && cursorCol < availableColumns && (!hasFocus || viewShift < strlen(text) + 1)) {
41 display->draw(':');
42 cursorCol++;
}Instead of adding another option to the constructor, you could subclass class MyCustomRenderer : public CharacterDisplayRenderer {
public:
MyCustomRenderer(CharacterDisplayInterface *display, uint8_t cols, uint8_t rows)
: CharacterDisplayRenderer(display, cols, rows) {
}
void drawItem(const char* text, const char * value) override {
// Custom rendering code here
//
// You can append a cursor character to the text if the item is selected etc.
}
};Because the colon separator is controlled in a single function, it’s straightforward to customize by extending the renderer and overriding drawItem as shown above. This keeps the core library light while still giving you full control over how items are rendered. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem?
The 16x2 Displays have quite few characters. It would be nice if there is a way to omit the colon separator (":") between the Cursor Icon and menu items. To gain more space for the content.
The colon is set up in the CharacterDisplayRenderer
Describe the solution you'd like?
Possibly add this option to the CharacterDisplayRenderer constructor.
Describe alternatives you've considered
No response
Additional context
No response
Beta Was this translation helpful? Give feedback.
All reactions