[GH-ISSUE #165] Display::GetStdSize(const Value& q) const doesn't return size of image #71

Open
opened 2026-05-05 03:37:48 -06:00 by gitea-mirror · 4 comments
Owner

Originally created by @schutm on GitHub (Oct 17, 2023).
Original GitHub issue: https://github.com/ultimatepp/ultimatepp/issues/165

According to the documentation of Display::GetStdSize(const Value& q) const should return:

Should return standard size for given value and Display. E.g. if Display is rendering Images,
it should return the Size of the Image in pixels. Base Display returns the size of textual
representation of the Value.

However it returns the size of the ToString-text of the Image as returned by String Image::ToString() const.

Originally created by @schutm on GitHub (Oct 17, 2023). Original GitHub issue: https://github.com/ultimatepp/ultimatepp/issues/165 According to the documentation of `Display::GetStdSize(const Value& q) const` should return: > Should return standard size for given value and Display. E.g. if Display is rendering Images, > it should return the Size of the Image in pixels. Base Display returns the size of textual > representation of the Value. However it returns the size of the ToString-text of the Image as returned by ```String Image::ToString() const```.
Author
Owner

@mirek-fidler commented on GitHub (Oct 17, 2023):

I guess that is a bit of misunderstanding here.. Documentation describes interface. You are checking StdDisplay, which is not really designed to render Images. If you use Paint, it will paint text as well.

Example of Display that renders Image is CenteredImageDisplay.

That said there is probably no reason for StdDisplay not to display Images, so I will probably add that feature anyway.

<!-- gh-comment-id:1766495114 --> @mirek-fidler commented on GitHub (Oct 17, 2023): I guess that is a bit of misunderstanding here.. Documentation describes **interface**. You are checking StdDisplay, which is not really designed to render Images. If you use Paint, it will paint text as well. Example of Display that renders Image is CenteredImageDisplay. **That said** there is probably no reason for StdDisplay not to display Images, so I will probably add that feature anyway.
Author
Owner

@schutm commented on GitHub (Oct 17, 2023):

Problem was I couldn't change the usage of StdDisplay as it was being used (indirectly) by SyncInfo of MultiButton. And I used the SetDisplay of the MultiButton with a display to show images. However hovering over the image triggered the display of a SyncInfo, because the text ('image 32x32') was larger than the MultiButton control itself. I got around it by using AttrText and Convert, but that seemed a bit contrived.

Thanks for the fix. I'll test it in following few days.

<!-- gh-comment-id:1767109363 --> @schutm commented on GitHub (Oct 17, 2023): Problem was I couldn't change the usage of StdDisplay as it was being used (indirectly) by SyncInfo of MultiButton. And I used the SetDisplay of the MultiButton with a display to show images. However hovering over the image triggered the display of a SyncInfo, because the text ('image 32x32') was larger than the MultiButton control itself. I got around it by using AttrText and Convert, but that seemed a bit contrived. Thanks for the fix. I'll test it in following few days.
Author
Owner

@mirek-fidler commented on GitHub (Oct 17, 2023):

Thats sort of weird, what display have you used with SetDisplay?

On Tue, Oct 17, 2023 at 10:20 PM Martin Schut @.***>
wrote:

Problem was I couldn't change the usage of StdDisplay as it was being used
(indirectly) by SyncInfo of MultiButton. And I used the SetDisplay of the
MultiButton with a display to show images. However hovering over the image
triggered the display of a SyncInfo, because the text ('image 32x32') was
larger than the MultiButton control itself. I got around it by using
AttrText and Convert, but that seemed a bit contrived.

Thanks for the fix.


Reply to this email directly, view it on GitHub
https://github.com/ultimatepp/ultimatepp/issues/165#issuecomment-1767109363,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AARH234KIAPPLWCT3KJQDMTX73SBDAVCNFSM6AAAAAA6DVDW6WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRXGEYDSMZWGM
.
You are receiving this because you commented.Message ID:
@.***>

<!-- gh-comment-id:1767227163 --> @mirek-fidler commented on GitHub (Oct 17, 2023): Thats sort of weird, what display have you used with SetDisplay? On Tue, Oct 17, 2023 at 10:20 PM Martin Schut ***@***.***> wrote: > Problem was I couldn't change the usage of StdDisplay as it was being used > (indirectly) by SyncInfo of MultiButton. And I used the SetDisplay of the > MultiButton with a display to show images. However hovering over the image > triggered the display of a SyncInfo, because the text ('image 32x32') was > larger than the MultiButton control itself. I got around it by using > AttrText and Convert, but that seemed a bit contrived. > > Thanks for the fix. > > — > Reply to this email directly, view it on GitHub > <https://github.com/ultimatepp/ultimatepp/issues/165#issuecomment-1767109363>, > or unsubscribe > <https://github.com/notifications/unsubscribe-auth/AARH234KIAPPLWCT3KJQDMTX73SBDAVCNFSM6AAAAAA6DVDW6WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRXGEYDSMZWGM> > . > You are receiving this because you commented.Message ID: > ***@***.***> >
Author
Owner

@schutm commented on GitHub (Oct 20, 2023):

This works now.

I used a custom Display.

Looking at line 614 in MultiButton.cpp a call is made to DisplayPopup::Set (line 137 in DisplayPopup.cpp). At line 145 a call is made to DisplayPopup::Pop::Set (line 110 in DisplayPopup.cpp) and here at line 131 a call is made to DisplayPopup::Pop::Sync. Finally in this method at line 60 a call is made to Display::GetStdSize (line 115 in Display.cpp). This last line always uses the StdDisplayClass (as the name suggests). I didn't expect this to happen when displaying a PopUp from the MultiButton.

For short, using de MultiButton with a custom Display will still use the StdDisplayClass for the popup (not a problem for me anymore, as my custom Display just shows an Image which now recognized by StdDisplayClass)

<!-- gh-comment-id:1772945232 --> @schutm commented on GitHub (Oct 20, 2023): This works now. I used a custom Display. Looking at line 614 in MultiButton.cpp a call is made to DisplayPopup::Set (line 137 in DisplayPopup.cpp). At line 145 a call is made to DisplayPopup::Pop::Set (line 110 in DisplayPopup.cpp) and here at line 131 a call is made to DisplayPopup::Pop::Sync. Finally in this method at line 60 a call is made to Display::GetStdSize (line 115 in Display.cpp). This last line always uses the StdDisplayClass (as the name suggests). I didn't expect this to happen when displaying a PopUp from the MultiButton. For short, using de MultiButton with a custom Display will still use the StdDisplayClass for the popup (not a problem for me anymore, as my custom Display just shows an Image which now recognized by StdDisplayClass)
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/ultimatepp#71
No description provided.