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

TVTHeader.AutoScale() never decreases height. #1206

Closed
pyscripter opened this issue Aug 3, 2023 · 3 comments
Closed

TVTHeader.AutoScale() never decreases height. #1206

pyscripter opened this issue Aug 3, 2023 · 3 comments
Assignees
Labels
Open for Discussion There are several possibilites to address the issue and anyone is invited for comments.
Milestone

Comments

@pyscripter
Copy link
Contributor

pyscripter commented Aug 3, 2023

Both VT and Header AutoScale may only increase height, but never decrease it.

In my application (PyScripter), I have an option to change the UI content font size. When a user increases font size both default node height and header height* are automatically adjusting (increasing), which is good, but if a user decreases font size, the node height and header height stay at their previous high values and do not look good.

Is there a reason for this behaviour? I would think that if toAutoChangeScale is set, you let VT manage the node and header heights for better or worse.

Changes needed

in TVTHeader.AutoScale remove the lines below:

    //Get the maximum of the scaled original value and the minimum needed header height.
    lMaxHeight := Max(lMaxHeight, FHeight);

In TBaseVirtualTree.AutoScale change the > to <>.

@joachimmarder
Copy link
Contributor

Is there a reason for this behaviour?

Well, I guess the original idea was to let the developer decide about the header height, but prevent cut off text which never makes sense.

Furthermore, changing the font is not the same as dpi-scaling. In dpi-scaling you have M and D and so can keep the relations between header height and other elements of the control.

How about tying the header height to DefaultNodeHieght?

@joachimmarder joachimmarder added the Open for Discussion There are several possibilites to address the issue and anyone is invited for comments. label Aug 3, 2023
@pyscripter
Copy link
Contributor Author

pyscripter commented Aug 3, 2023

I guess the original idea was to let the developer decide about the header height,

In that case the developer should not set toAutoChangeScale. Especially now that it is decoupled from DPI scaling. Setting this flag means that you allow VT to optimize node and header height, based on the font size.

How about tying the header height to DefaultNodeHieght?

This would not work when the header ParentFont is False. And in any case DefaultNodeHeight is also incorrect when you decrease the font size. The suggested changes fix both DefaultNodeHeight and header height.

Just think what needs to be done otherwise, if a user assigns a font with smaller size at run time:

  • Change DefaultNodeSize manually
  • Change the height of existing nodes.
  • Change the header height manually

@joachimmarder joachimmarder changed the title AutoScale never decreases height. TVTHeader.AutoScale() never decreases height. Aug 13, 2023
@joachimmarder joachimmarder self-assigned this Aug 13, 2023
@joachimmarder joachimmarder added this to the V8.0 milestone Aug 13, 2023
@pyscripter
Copy link
Contributor Author

Thanks!

But, shouldn't TBaseVirtualTree.AutoScale behave in a similar way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Open for Discussion There are several possibilites to address the issue and anyone is invited for comments.
Projects
None yet
Development

No branches or pull requests

2 participants