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

Cut off strings too long to show in ugfx.List #221

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion esp32/ugfx_widgets.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,13 @@ void BWgwinListDefaultDraw(GWidgetObject* gw, void* param) {
}
}
#endif
gdispGFillStringBox(gw->g.display, gw->g.x+x+LST_HORIZ_PAD, gw->g.y+y, iwidth-LST_HORIZ_PAD, iheight, qi2li->text, gw->g.font, text, fill, justifyLeft);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not justifyLeft | justifyTop ? That seems to work.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does?!

I just read the API docs and they say that text is always vertically centered and justify only adjusts horizontal. So either you're getting unintended correctness or the docs need to be updated :-).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

justifyTop is not mentioned either.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read the header file and found this constant. Tried it and it seemed to work. Haven't done further testing. :)

#if GDISP_NEED_CLIP
gdispGSetClip(gw->g.display, gw->g.x+x+LST_HORIZ_PAD, gw->g.y+y, iwidth-LST_HORIZ_PAD, MIN(iheight, gw->g.height-y-1));
#endif
gdispGFillString(gw->g.display, gw->g.x+x+LST_HORIZ_PAD, gw->g.y+y, qi2li->text, gw->g.font, text, fill);
#if GDISP_NEED_CLIP
gdispGSetClip(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2);
#endif
}

// Fill any remaining item space
Expand Down