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

NodeHeight does not scale in high-dpi mode, if RootNodeCount is set before scaling happens #633

Closed
ottigeda opened this issue Jul 18, 2016 · 5 comments
Assignees
Labels
Milestone

Comments

@ottigeda
Copy link

ottigeda commented Jul 18, 2016

See attached example project
If pressing Button1

  • on a screen with font size = 100% the VirtualStringTree can show approx 9 nodes at once (correct)
  • on a screen with font size = 125% the VirtualStringTree can show approx 11 nodes at once (too many)
  • on a screen with font size = 200% the Node Text does start to overlap
    If pressing Button2 however it works as expected: regardless whats the font size the VirtualStringTree can show about 9 nodes at once

The difference between Button1 and Button2 is the position where the RootNodeCount is set.

Projects.zip

Tested on Windows 10 (version1511), using Delphi 10.1 Berlin + Version 6.3.0 of VirtualStringTree.

@joachimmarder joachimmarder self-assigned this Jul 19, 2016
@joachimmarder joachimmarder added this to the Version 6.4 milestone Jul 19, 2016
joachimmarder pushed a commit that referenced this issue Jul 19, 2016
* TBaseVirtualTree.CMFontChanged() calls ChangeScale() only if the handle was already created, as ChangeScale() would create the handle
* A call to ChangeScale() was moved from TBaseVirtualTree.CreateWnd() to overriden TBaseVirtualTree.ChangeScale()
@joachimmarder
Copy link
Contributor

The problem behind "Button2" was that scaling was performed twice: First within CreateWnd() and CMFontChaged(), which call AutoScale() that detected that the current DefaultNodeHeight is too small for the current font. Then setting the parent control triggered a call to ChangeScale() which scaled the DefaultNodeHeight (again). This has now been fixed.

@joachimmarder
Copy link
Contributor

joachimmarder commented Jul 19, 2016

The problem behind "Button1" is that SetDefaultNodeHeight() does not change the node height of existing nodes. This behavior is currently by design. The issue seen here can be circumvented easily by not creating nodes that early, but when the control is part of a form.

For changing the behavior of SetDefaultNodeHeight() a separate issue should be created, if truly a need for change is seen here.

@ottigeda
Copy link
Author

I tried to do an component which derives from VirtualStringTree, which shows some static text, which the user can configure at design time. Due to nodes already get set while loading the component, I have a problem on how to circumvent this. It is because I cannot see a point where I could create the nodes later. If you have some hint for me on what I am doing wrong or how this could be circumvented, it would be very much appreciated. Anyway thanks a lot for your input! See attached component:
VirtualTextTree.zip

@joachimmarder
Copy link
Contributor

It is because I cannot see a point where I could create the nodes later. If you have some hint for me on what I am doing wrong or how this could be circumvented

You should add nodes by overriding CreateWnd() (after calling inherited) and not do that earlier. This applies more or less to all VCL controls.
Please note that this is not a support forum, Asking such questions e.g. at stackoverflow.com is more suitable and might generate quicker responses.

@ottigeda
Copy link
Author

I understand, will do. Thanks a lot for your help again!

ValtsS pushed a commit to ValtsS/Virtual-TreeView that referenced this issue Jan 25, 2019
* TBaseVirtualTree.CMFontChanged() calls ChangeScale() only if the handle was already created, as ChangeScale() would create the handle
* A call to ChangeScale() was moved from TBaseVirtualTree.CreateWnd() to overriden TBaseVirtualTree.ChangeScale()
# Conflicts:
#	Source/VirtualTrees.pas
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants