Bug 144168 - Inconsistent ratio between Dialog.Model.Height and the height on the screen
Summary: Inconsistent ratio between Dialog.Model.Height and the height on the screen
Status: RESOLVED INVALID
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
6.3.5.2 release
Hardware: All Windows (All)
: medium minor
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-29 22:06 UTC by Michael
Modified: 2022-09-16 12:10 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
This spreadsheet will allow you to test the ratios of the measured and model heights of three different dialogs. (3.78 MB, application/vnd.oasis.opendocument.spreadsheet)
2021-08-29 22:06 UTC, Michael
Details
TestCellCoordinates.ods (11.99 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-05-26 17:32 UTC, Vladimir Sokolinskiy
Details
TestCellCoordinates.ods (12.01 KB, application/vnd.oasis.opendocument.spreadsheet)
2022-05-26 17:45 UTC, Vladimir Sokolinskiy
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael 2021-08-29 22:06:54 UTC
Created attachment 174619 [details]
This spreadsheet will allow you to test the ratios of the measured and model heights of three different dialogs.

I wanted to dynamically place a dialog above the active cell. This requires the position of the top left corner of the cell, and the height of the dialog. The origin for the cells is the top left corner of cell A1. The origin of the dialog is the top left corner of the Calc sheet. The units for heights for the position of the cell and dialog are different. I measure the height of the dialog by aligning the top of the dialog with the top of the active cell, and then doing the same with the bottom of the dialog with the top of the cell. I then get the ratio of this height with the dialog.model.height.

Measured	Model	Ratio
200		78	2.57
258		106	2.44
564		247	2.29

The ratios are not consistent, and vary with the height of the dialog. Also, the ratios change depending on how close, vertically, the active cell is to the Row 0. One of our users tried this one a system running Ubuntu, and he had ratios varying depending on the dialog etc. His ratios were quite different from mine (windows vs Ubuntu)

It also seems that if I dynamically place the dialog so the top of the box aligns with the top of the active cell that, if it aligns for a row near the top of the spreadsheet, it drifts off the top of the row as the active row is farther down. I suspect an error in a decimal place in the conversion com.sun.star.util.MeasureUnit.MM_100TH or in Widows. It isn't a big thing, it may be in the fourth decimal.

Finally, things don't align properly if Calc is not maximized and it moves to a different place on the screen.

I am using 
Edition	Windows 10 Home
Version	21H1
Installed on	‎2020-‎11-‎26
OS build	19043.1165
Experience	Windows Feature Experience Pack 120.2212.3530.0

I have 8 GB RAM.
Processor: Intel(R) Pentium(R) CPU 2127U @ 1.90GHz   1.90 GHz

I have attached a very stripped down version of our spreadsheet. You can run various tests with three different dialogs. To run a test, right click on a cell and choose Event Input Wizard.

It is not imperative that we place the dialog exactly, but this could be an issue for some of our users. At the moment, two of our users have requested this feature. Consequently, I have chosen "minor" for severity.
Comment 1 Mike Kaganski 2022-05-25 14:41:58 UTC
Vladimir, the test case uses your code; could you please take a look if you see what the problem is, and possibly create a simpler test case? Thank you!
Comment 2 Vladimir Sokolinskiy 2022-05-26 17:31:57 UTC
Mike, the problem was discussed in the topic "Dynamically position a dialog" ([1]).
The solution was found using the AccessibleContext interfaces.
The example in the attachment TestCellCoordinates.ods . Double-clicking a cell should position the dialog at the top left corner of the cell. The relative position must be the same for all cells shown on the screen and not change when the zoom changes.

[1] https://ask.libreoffice.org/t/dynamically-position-a-dialog/67289/32
Comment 3 Vladimir Sokolinskiy 2022-05-26 17:32:41 UTC Comment hidden (obsolete)
Comment 4 Vladimir Sokolinskiy 2022-05-26 17:45:18 UTC
Created attachment 180418 [details]
TestCellCoordinates.ods
Comment 5 Michael 2022-05-26 18:49:28 UTC
Thank you. I have tested those two spreadsheets, and they work very well! Your functions will be very useful.
Comment 6 Buovjaga 2022-09-07 10:05:45 UTC
(In reply to Vladimir Sokolinskiy from comment #2)
> Mike, the problem was discussed in the topic "Dynamically position a dialog"
> ([1]).
> The solution was found using the AccessibleContext interfaces.
> The example in the attachment TestCellCoordinates.ods . Double-clicking a
> cell should position the dialog at the top left corner of the cell. The
> relative position must be the same for all cells shown on the screen and not
> change when the zoom changes.
> 
> [1] https://ask.libreoffice.org/t/dynamically-position-a-dialog/67289/32

Vladimir: I see the reporter is happy, but do you think that something should be fixed or enhanced in LibreOffice code?
Comment 7 Buovjaga 2022-09-16 12:10:21 UTC
No reply yet, so adjusting status to something more correct.