Recent

Author Topic: VST node height wrong on 4K display.  (Read 5118 times)

NightSky

  • New Member
  • *
  • Posts: 20
VST node height wrong on 4K display.
« on: September 01, 2021, 08:19:40 pm »
New laptop with a 4K display.  Latest version of Lazarus, Windows 10.
VST used for looking at a data array.
Header font size and header size needed to be adjusted, were, and the header is fine.
Nodes do not display properly.
Lines are very thin and almost invisible.
Node spacing seems to be fixed.  Setting default node size does not change anything.
Font size can be changed, but spacing between lines of characters remains constant.  Characters are trimmed to fit available space.
Rest of display, images, fonts, buttons, string grids, etc., display properly.

Where is the spacing parameter set and by what? 

Setting DPI on the form doesn't help (or change anything) either.  A second, non-4K display has the same problem .

help....

AlexTP

  • Hero Member
  • *****
  • Posts: 2402
    • UVviewsoft
Re: VST node height wrong on 4K display.
« Reply #1 on: September 01, 2021, 10:42:48 pm »
Pls, attach some screenshot of the problem, and zip with compilable project.

NightSky

  • New Member
  • *
  • Posts: 20
Re: VST node height wrong on 4K display.
« Reply #2 on: September 02, 2021, 12:09:48 am »
Here is the screen shot. with the code.

I likely hardcoded the path to the data, which of course, is a problem

The code is complete, though. 

I'm having another problem with keeping the IDE from crashing when trying to load the program, so it's not easy to give you a working version.

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: VST node height wrong on 4K display.
« Reply #3 on: September 02, 2021, 12:45:39 am »
Sorry, this project is of no use. It contains a third-party package (dw_Controls) which is not readily available; I removed the TDWChipList and the TColorPalette from the code and the lfm file, and still the project does not compile because of some TTextStream which is not found. Then I gave up.

Please remove everything unneeded from this project so that it compiles with a standard installation of Lazarus. Otherwise nobody can help you.

And BTW: what is the "latest" version of Lazarus? 2.0.12? 2.2RC1? Trunk? And where do you have the VTV from? Which version? No all VTV versions out there are compatible with LCL scaling.
« Last Edit: September 02, 2021, 12:49:35 am by wp »

NightSky

  • New Member
  • *
  • Posts: 20
Re: VST node height wrong on 4K display.
« Reply #4 on: September 02, 2021, 01:23:26 am »
Firstly, *I* am the third party packages. 
The problem is not with them.
Secondly, it would be easier for me to just have a dummy project for this than anything else.  I'll do that.
Hang on a bit, and thanks for trying.

NightSky

  • New Member
  • *
  • Posts: 20
Re: VST node height wrong on 4K display.
« Reply #5 on: September 02, 2021, 02:19:30 am »
Life gets interesting.  In the original project, you get the screen shot you see. 

Create another project with a VST, you get normal spacing. 

The only object in the project is the VST on a form.  It works perfectly, even if the problem were changing font color (which is done and works).

That means that I need to try to figure out why the project itself is crashing (separate thread), which suggests that the two problems (bad font and crashing) are somehow related.

I can, if you desire, include the "third party" plugins.

Possibly I can strip other things out and work down.  That might work.

I'll get back to you.  Thanks for the effort.

PS:  It seems I don't find simple problems.



wp

  • Hero Member
  • *****
  • Posts: 11916
Re: VST node height wrong on 4K display.
« Reply #6 on: September 02, 2021, 10:55:43 am »
In the OnCreate handler of the main form of your project I see the line
Code: Pascal  [Select][+][-]
  1.    screen_hierarchy_tree.DefaultNodeHeight:= 50;
On my system at 96ppi, the DefaultNodeHeight is 18 - you are at 216ppi, so the value seems to be correct basically. But I don't know whether VTV does not do some internal rescaling here. Therefore, I'd ask you to check what happens when you remove this line.


NightSky

  • New Member
  • *
  • Posts: 20
Re: VST node height wrong on 4K display.
« Reply #7 on: September 02, 2021, 07:30:18 pm »
That line has no effect, nor does changing the 50 to 500 change anything. 
however, I did strip down the project significantly, removing all the third party components.
Attached find zip of that project.  it does the same thing. Click on "open project" and then select the hierarchy tab, please.

Thanks

wp

  • Hero Member
  • *****
  • Posts: 11916
Re: VST node height wrong on 4K display.
« Reply #8 on: September 02, 2021, 07:53:31 pm »
Thanks, that's helpful.

After installing TColorPalette and removing the package dw_controls from the projet requirements, I can load the project, but see the first issue immediately. I am at 96 ppi, but the form does not scale at all and is as wide as my screen with huge panels at the top. Is this intended?

I noticed that the form's Scaled is false. Why? This stops LCLScaling to work.

Since I do not want to change your project for the first tests, could you please set Scaled to true and upload the project again. Then my IDE will hopefully rescale the form to my current resolution, and I can further investigate.

I also noticed that there are variables "display_scale". Does this mean that you want to scale the application yourself? And my impression is that they are not initialized.
« Last Edit: September 02, 2021, 07:59:33 pm by wp »

NightSky

  • New Member
  • *
  • Posts: 20
Re: VST node height wrong on 4K display.
« Reply #9 on: September 02, 2021, 08:41:27 pm »
No problem. 
Set scaled on, then also removed the dependency for colorpalette (wasn't needed here)
I get the same behavior.

In the VST paint text routine, I can get the nodes spaced out if I set the height for each node (works because this is the repaint for each node).  However, it still doesn't handle the fonts gracefully.

Don't worry too much about changing the project, this is a trimmed down version.  If you find something and fix it, just do a // NOTE: and I should be able to find it.

This is a screen designer for a tricorder (LCARS) style interface that generates C++ formatting code for an ARM project.  The removed sections have to do with defining a screen, adjusting the screen size for the hardware display, and enabling/disabling sensors and project options.  You can also get a row of buttons down the left side.  Buttons can be assigned execution actions and/or chain to another screen.

The display_scale variable is one way that I may want to change how the target hardware displays the screen.  It's designed to handle (however gracefully) any screen resolution from 128 * 32 up to XVGA (1024 * 768), with frequent targets of QVGA, VGA, and WVGA. 

If you see "magnification" in there, it accomplishes much the same, but in this case, is being used.




Thanks


wp

  • Hero Member
  • *****
  • Posts: 11916
Re: VST node height wrong on 4K display.
« Reply #10 on: September 02, 2021, 11:09:25 pm »
Again it took me some time to get it running. It contains hard card-coded paths for the ShellTreeView.Root which, of course, do not exist on my system. Only after removing this property from the lfm file I was able to run the project in both the 96ppi and 144ppi machines (in which the project was in different paths).

Besides the unusually large font size, I noticed the huge line height of the tree nodes. I reset the DefaultNodeHeight to 18, the startup value on a 96ppi system. Since, however, the VTV.Font.Size is at its default 0, the node text turns out to be too small in comparison with the other texts of this application. I increased it to 16, and the DefaultNodeHeight automatically adjusted to the value 30. Now it looks nicer - this is the state of the project that I am attaching.

Then I copied the project to a VM running at 144 ppi (150%). Loaded it into Lazarus, compiled it without any changes and ran it - no problem, the overall application seems to scale correctly, however, the VTV row height appears to be too large; the DefaultNodeHeight has been scaled up on the 144ppi system to 68. This looks as if it has been scaled twice: from 30 to 45 (150%) and then from 45 to 68 (151%). Therefore, I guess that the scaling of this property in VTV is not correct. Probably the DefaultNodeHeight is automatically scaled with the font height, and therefore no additional scaling must be applied to DefaultNodeHeight itself. I'll have a look...

You still did not tell me your Lazarus version, and which VTV you are using. LCLscaling of VTV has been added to the version in the Lazarus distribution about a year ago and thus should not be available in the Laz v2.0.x series, but in v2.2RC1 and trunk. It also has been ported to v5 in blikblum's GitHub repository (which is in OPM). All other versions of VTV do not support LCL scaling.

NightSky

  • New Member
  • *
  • Posts: 20
Re: VST node height wrong on 4K display.
« Reply #11 on: September 03, 2021, 12:32:11 am »
Sorry for the hard coded paths.  I have yet to find the "take file path and go up one level" in Lazarus, and haven't written one yet.  Things crashed before I got to that.

The node heights were changed in an effort to space the nodes well enough to avoid the problem in the initial screen shot.  It's apparently working differently on my system.  I'll also note that a separate project with the default VST tree settings and adding nodes works properly.  So here, I'm puzzled.

The scaling may be exactly the way you think it is.  I'm still working on why the font size can be changed and the node spacing stays constant.  For all I know, it's particular to that one project on my system.  Now I wonder why that would be.

Thought I[d mentioned the versions:  Lazarus version is 2.0.12.  The version of VST is the one in the lazarus version,  which is 5.5.3.1.  I didn't try to load VST from the virtual treeview site, since I couldn't correlate the versions, which seemed to be mostly for Delphi.

Thanks again.



 

TinyPortal © 2005-2018