The height of the edit file name in more than 7.56a

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

User avatar
gora
Junior Member
Junior Member
Posts: 87
Joined: 2010-12-17, 10:37 UTC
Location: Russian

Post by *gora »

This bug isn't fixed.
Sob
Power Member
Power Member
Posts: 941
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

Edit height is still wrong here too.

Maybe it's not it, but the control has exactly the same height as Lazarus TEdit has when AutoSize property is set (it ignores height requested by application).

Personally I don't care about edit height too much. But as it moves the text down a little compared to TC32 and TC32 also moves the text down compared to text in list, this makes the "jumping text" quite noticeable. Not in a good way unfortunately.

Watch the red lines:

http://web.hisoftware.cz/sob/img/tc80b4x64-in-place-rename.gif

From left to right: TC32, TC64, non-jumping (edit moved 2px up)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Here it's different by just one pixel - that's the best I could achieve, because the functions I use in Delphi don't work with Lazarus on this. I could use the Lazarus functions in Delphi too, but then it would differ from 7.56a.

Do you have a case where it's more than 1-2 pixels different? If yet, what settings do you use (Windows version, theming, main and list font)?
Author of Total Commander
https://www.ghisler.com
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

ghisler(Author) wrote:Do you have a case where it's more than 1-2 pixels different? If yet, what settings do you use (Windows version, theming, main and list font)?
Yes, here the difference is always 3 pixels. Screenshots:
WinXP x64 (Classic)
WinXP x64 (Luna)
Win7 x64 (Classic)
Win7 x64 (Basic)
Win7 x64 (Aero)

All TC settings are default (started with empty INI).
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 10.52 / Win10 x64
User avatar
Flint
Power Member
Power Member
Posts: 3487
Joined: 2003-10-27, 09:25 UTC
Location: Antalya, Turkey
Contact:

Post by *Flint »

Confirm fixed in 8.0β6.
Flint's Homepage: Full TC Russification Package, VirtualDisk, NTFS Links, NoClose Replacer, and other stuff!
 
Using TC 10.52 / Win10 x64
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Please test it with a few different fonts!
Author of Total Commander
https://www.ghisler.com
Sob
Power Member
Power Member
Posts: 941
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

Works fine with my usual settings, but not fixed completely.

The size of edit should only depend on File list font, but it is influenced by Main window font. It doesn't depend on it directly, i.e. it's not necessarily large enough to accomodate this font, but it does change.

- start TC with clean ini
- check in-place rename, edit size is correct
- set Main window font to Trebuchet MS, 8, bold (or Yu Gothic (*1), 16, bold for really large bottom padding)
- check in-place rename, edit size is wrong

(*1) - Not in Windows 7 by default, comes with some language pack, probably Japanese.
User avatar
karlchen
Power Member
Power Member
Posts: 4602
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post by *karlchen »

Hi, Sob.

Your example of making Trebuchet MS 8 bold the TC main window font has got the effect of increasing the height of the inline rename edit box and re-creating the old problem.

This is true on Total Commander 8.0ß6 64-bit.
But, this is also true on Total Commander 8.0ß6 32-bit!
This is even true on Total Commander 7.56a!

So I tend to assume that you can (re-)generate the effect of a too high inline rename edit box by selecting as the TC main window font any font which leaves a lot of free space below its characters, i.e. which requires a lot of bottom padding.

Total Commander 8.0ß6 32-bit / 64-bit, Total Commander 7.56a on
+ Server 2008 R2 64-bit, classic theme
+ Windows 2003 Std SP2 64-bit, classic theme
+ Windows 7 Enterprise SP1 32-bit, Aero theme (no TC 8.0ß6 64-bit on this one)

<Added>
Essence:

As far as I can tell by testing the inline rename edit box on
  • Server 2008 R2 (64-bit), classic theme
    T.C. fonts set #1: Tahoma 8b, Tahoma 8b, Tahoma 8 (filelist, main window, dialogues)
    T.C. fonts set #2: Segoe UI 9b, Segoe UI 8b, Tahoma 8 (filelist, main window, dialogues)
  • Windows 2003 Std SP2 (64-bit), classic theme
    T.C. fonts: Tahoma 8b, Tahoma 8b, Tahoma 8 (filelist, main window, dialogues)
  • Windows 7 Home Premium 7 SP1 (64-bit), Aero theme on, glass effect off
    T.C. fonts: Segoe UI 9b, Segoe UI 8b, Tahoma 8 (filelist, main window, dialogues)
the height of the inline rename edit box now is the same in Total Commander 8.0ß6 32-bit and 64-bit.
So, the initial problem has been solved.

The other effect which can be reproduced by setting the T.C. main window font to a font which does a lot of bottom padding thus increasing the height of the inline rename edit box has been present in previous T.C. versions like 7.56a and in all 32-bit beta versions as well.

So this must be a related, but technically speaking, different issue.
</Added>

Cheers,
Karl
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Actually that's not a bug, and it's the same in 32-bit and 64-bit:

TC has to get the correct edit box size somehow, depending on the current font. Unfortunately there is no function for that. Windows auto-sizes comboboxes with included edit box, so TC uses the height of the command line as a reference. Since the command line uses the main window font, TC subtracts the height of the main window font, and adds the height of the listbox font. Unfortunately this doesn't seem to be 100% correct with some font combinations, but it's the best I could get.
Author of Total Commander
https://www.ghisler.com
Sob
Power Member
Power Member
Posts: 941
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

Can't you simply base the height of edit on height of selected list font? I tried it with GetTextMetrics() and it seems to work fine:

http://web.hisoftware.cz/sob/img/edit-height.png

In left column are TEdits with AutoSize:=True. Number is tmHeight from GetTextMetrics(). And right column contains TEdits with AutoSize:=False and Height:=tmHeight+6. Hardcoded 6 (2 * 3 for borders and padding) might look wrong, but it is correct for all themes I tried. I don't know if it's possible that some theme would have it different.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I don't know if it's possible that some theme would have it different.
That's exactly the problem - and what about classic theme?
Author of Total Commander
https://www.ghisler.com
Sob
Power Member
Power Member
Posts: 941
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

Ok, if our problem is unknown size of borders, it's possible to modify your algorithm a little. Command line combo can still serve as reference. If you take total height of combo including borders and substract the height of included edit, then you have the size of both borders. Then take the height of list font (GetTextMetrics()), add computed size of borders and you have the height of perfect-fit edit. Height of window font is left out, it's not needed for anything.

Window font Microsoft Sans Serif 8, list font Microsoft Sans Serif 8:

Combo = 21px, Edit = 15px, List font = 13px
Borders = Combo - Edit = 6px
Rename edit height = List font + Borders = 19px (TC now uses 18px, which results in missing top padding with classic style and different padding with themes 1px top, 2px bottom; no biggie of course, just saying it's slightly better with that extra pixel)

Window font Trebuchet MS 8, list font Microsoft Sans Serif 8:

Combo = 24px, Edit = 18px, List font = 13px
Borders = Combo - Edit = 6px
Rename edit height = List font + Borders = 19px (TC now uses 21px, which creates huge bottom padding)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Combo = 21px, Edit = 15px
Sorry, I don't understand this one - what do you mean with "edit"? The edit control within the combobox? But it has a border too?
Author of Total Commander
https://www.ghisler.com
Sob
Power Member
Power Member
Posts: 941
Joined: 2005-01-19, 17:33 UTC

Post by *Sob »

The edit within combobox does not have borders. So if it has the correct size (and we trust Windows to set it), then the difference between its height and total height of the combo is height of borders.

Sample application (exe and Delphi source):

http://web.hisoftware.cz/sob/download/tc-rename-edit-size-example.7z
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48077
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I haven't had the time yet to check this before the release of beta 7, sorry. I will check it as soon as possible.
Author of Total Commander
https://www.ghisler.com
Post Reply