mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 06:05:58 -06:00
[GH-ISSUE #165] Display::GetStdSize(const Value& q) const doesn't return size of image #71
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/ultimatepp#71
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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) constshould return:However it returns the size of the ToString-text of the Image as returned by
String Image::ToString() const.@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.
@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.
@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:
@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)