Skip to content
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

Dialog with menu items render issues #324

Closed
vzahradnik opened this issue Mar 23, 2023 · 11 comments
Closed

Dialog with menu items render issues #324

vzahradnik opened this issue Mar 23, 2023 · 11 comments
Assignees
Labels
bug Something isn't working

Comments

@vzahradnik
Copy link
Collaborator

Describe the bug
I implemented a custom multiline dialog following this thread. I have observed two issues:

  • When I go up and back to the cancel button, next to the button is rendered part of the text from the item above it.
    https://www.youtube.com/watch?v=9fgybk6Pqb0
  • Not the whole screen is used. As it's shown on the picture, the whole dialog can fit the screen but it is shown like this only after I scroll to the top of the dialog.
    IMG20230323235050

Commerical or Personal use
Commercial use.

To Reproduce
Steps to reproduce the behavior, if a UI issue please detail all steps and include an example project if needed.
If a library issue provide whatever is needed in order for me to quickly identify the cause.

RENDERING_CALLBACK_NAME_INVOKE(fnVendorLine, textItemRenderFn, "", -1, NO_CALLBACK)
TextMenuItem vendor(fnVendorLine, nextRandomId(), 20, nullptr);
TextMenuItem website(fnVendorLine, nextRandomId(), 20, &vendor);
char aboutStr[20];
char versionStr[20];
char vendorStr[20];

void CALLBACK_FUNCTION ShowProductInfo(int id) {
    withMenuDialogIfAvailable([](MenuBasedDialog* dlg) {
        dlg->setButtons(BTNTYPE_NONE, BTNTYPE_CLOSE);

        vendor.setReadOnly(true);
        website.setReadOnly(true);

        sprintf(aboutStr, "About %s", TOSTRING(PRODUCT_NAME));
        sprintf(versionStr, "Version: %s", TOSTRING(PRODUCT_VERSION));
        sprintf(vendorStr, "Vendor: %s", TOSTRING(VENDOR));

        vendor.setTextValue(vendorStr);
        website.setTextValue(TOSTRING(VENDOR_WEBSITE));

        dlg->insertMenuItem(&vendor);
        dlg->insertMenuItem(&website);

        GridPosition vendorGridPlacement(GridPosition::DRAW_TEXTUAL_ITEM, GridPosition::JUSTIFY_LEFT_VALUE_ONLY, 2);
        renderer.getDisplayPropertiesFactory().addGridPosition(&vendor, vendorGridPlacement);

        GridPosition vendorWebsiteGridPlacement(GridPosition::DRAW_TEXTUAL_ITEM, GridPosition::JUSTIFY_LEFT_VALUE_ONLY, 3);
        renderer.getDisplayPropertiesFactory().addGridPosition(&website, vendorWebsiteGridPlacement);

        dlg->show(aboutStr, false);
        dlg->copyIntoBuffer(versionStr);
    });
}

**Embedded environment
Custom HW board with ESP32 and U8G2 monochrome display (U8G2_SSD1309_128X64_NONAME0_F_HW_I2C).

@davetcc
Copy link
Owner

davetcc commented Mar 24, 2023

Thanks for the detailed report. As soon as I get the card layout and Unicode beta sorted I’ll have a look.

I think it is because the item is maybe a pixel too big and the way rendering works is to ensure the item is not obscured from view. I’ll have to try this case myself.

@davetcc davetcc self-assigned this Mar 24, 2023
@davetcc davetcc added the bug Something isn't working label Mar 24, 2023
@vzahradnik
Copy link
Collaborator Author

I can help with getting more information if needed. Just let me know.

@davetcc
Copy link
Owner

davetcc commented Apr 16, 2023

This is possibly a little complex, I think what's happening is that the renderer is calculating the row order before the item is added somehow, or not properly taking into account the added item. I think I've seen this before but could not recreate it, this seems easier to reproduce, so I'll take a good look at this after 3.2 and debug exactly what's causing it.

@vzahradnik
Copy link
Collaborator Author

OK, if there is a way how I could help, e.g. by testing your changes, let me know.

@davetcc
Copy link
Owner

davetcc commented Jul 29, 2023

Part 1 of the detangling of the rendering layer is now completed. I've basically taken out all attempts at lazy loading of rendering order, as I'm not sure what good they actually did anyway. IE if something changed and the rendering order needed to change, it needed to change, nothing could change that, and it added a lot of complexity.

@davetcc davetcc modified the milestones: 4.1.0, 4.2 Aug 4, 2023
@davetcc
Copy link
Owner

davetcc commented Aug 10, 2023

Part 2 is now done as well, I'm going to open a discussion around this to explain the changes and rationale.

@davetcc
Copy link
Owner

davetcc commented Aug 10, 2023

#387

@davetcc
Copy link
Owner

davetcc commented Aug 17, 2023

I'm going to leave this open, but I believe that if you were to use the latest master version of the library there is a very good chance many of these rendering issues may already be fixed.

@davetcc
Copy link
Owner

davetcc commented Aug 28, 2023

@vzahradnik - can you check if all the issues are fixed in 4.1.1 library? If there's nothing outstanding please close.

@vzahradnik
Copy link
Collaborator Author

vzahradnik commented Aug 28, 2023

Hi Dave, I will. But I don't have the development board from the project where I found that issue at hand.

Let's leave it open and as soon as I will be able to test it out, I will update/close this issue.

Thanks!

@davetcc
Copy link
Owner

davetcc commented Sep 5, 2023

So in short, most rendering issues are now fixed, but the card layout issue you saw with a later item wrongly showing first is probably because you started your grid positions at row 1 instead of row 0. You should only start at row 1 when there is a title, otherwise, row 0 will be unoccupied and taken by the first item that does not have a grid row.

I'm actively updating documentation at the moment and will make that clearer.

Going to close for now, please reopen if you recreate any of the issues

@davetcc davetcc closed this as completed Sep 5, 2023
@davetcc davetcc removed this from the 4.2.0 milestone Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants