-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supports setting single one menu attributes #58
Comments
I can see that being convenient way of adjusting menu appearance on per parameter basis, but since the memory footprint is of a high concern (Example-03 barely fits on Arduino UNO in some versions of GEM) and this is generally done only once in the sketch, I figured that managing appearance simply through constructor arguments is a better way to go about it. So adding this is not of a high priority as of now, unfortunately. But at least I can run some tests to check how adding these new methods impacts compile size. |
Digging up this thread=) Recently (1.5.0), added Among other things, this makes it possible to change appearance parameters individually by editing corresponding properties of // Create menu object (its appearance settings will be populated with default values)
GEM menu(glcd);
...
void setupMenu() {
...
// Create GEMAppearance object with general values (that will be used for every menu page if not overridden)
GEMAppearance appearanceGeneral;
appearanceGeneral.menuPointerType = GEM_POINTER_DASH;
appearanceGeneral.menuItemsPerScreen = GEM_ITEMS_COUNT_AUTO;
appearanceGeneral.menuItemHeight = 10;
appearanceGeneral.menuPageScreenTopOffset = 10;
appearanceGeneral.menuValuesLeftOffset = 86;
// Set appearanceGeneral as a general appearance of the menu
menu.setAppearance(appearanceGeneral);
...
} Note though, that Also it is possible to call // Create empty GEMAppearance object (its values can be populated later in sketch).
// Note that it should be created in a global scope of the sketch (in order to be passed as a pointer to menu page)
GEMAppearance appearanceSettings;
// Create menu object (its appearance settings will be populated with default values)
GEM menu(glcd);
...
// Later in sketch, e.g. in setupMenu()
void setupMenu() {
...
// Create GEMAppearance object with general values (that will be used for every menu page if not overridden)
GEMAppearance appearanceGeneral;
appearanceGeneral.menuPointerType = GEM_POINTER_ROW;
appearanceGeneral.menuItemsPerScreen = GEM_ITEMS_COUNT_AUTO;
appearanceGeneral.menuItemHeight = 10;
appearanceGeneral.menuPageScreenTopOffset = 10;
appearanceGeneral.menuValuesLeftOffset = 86;
// Set appearanceGeneral as a general appearance of the menu
menu.setAppearance(appearanceGeneral); // Note there is no `&` operator when setting general (or global) appearance of the menu
// Copy values from appearanceGeneral object to appearanceSettings for further customization
appearanceSettings = appearanceGeneral;
appearanceSettings.menuValuesLeftOffset = 70;
menuPageSettings.setAppearance(&appearanceSettings); // Note `&` operator
...
} That's basically it. Readme and wiki may provide additional information. |
When I want to setting only one or a a little attributes, it need to fill complete instance here. Do you want to support a set function like
setMenuItemHeight
etc.?before:
after:
The text was updated successfully, but these errors were encountered: