Recent

Author Topic: [SOLVED] VST DefaultNodeHeight  (Read 694 times)

Pe3s

  • Full Member
  • ***
  • Posts: 248
[SOLVED] VST DefaultNodeHeight
« on: August 03, 2022, 08:04:55 pm »
Hello, I have a question, what could be the reason for DefaultNodeHeight not working?

« Last Edit: August 04, 2022, 09:07:09 am by Pe3s »

GetMem

  • Hero Member
  • *****
  • Posts: 3782
Re: VST DefaultNodeHeight
« Reply #1 on: August 03, 2022, 08:23:57 pm »
Please always attach a demo application, otherwise it's really hard to guess. Most likely cause: you changed VST->TreeOptions->MiscOptions->toVariableNodeHeight to True, and did not assign anything to OnMesureItem event.


Pe3s

  • Full Member
  • ***
  • Posts: 248
Re: VST DefaultNodeHeight
« Reply #2 on: August 03, 2022, 09:03:40 pm »
VST-> TreeOptions-> MiscOptions-> toVariableNodeHeight to True. OnMeasureItem is empty. VST v5


jamie

  • Hero Member
  • *****
  • Posts: 4763
Re: VST DefaultNodeHeight
« Reply #3 on: August 03, 2022, 11:41:14 pm »
 So you think because you enabled variable height but didn't supply a OnMessure Event it should take the DefaultHeight?
The only true wisdom is knowing you know nothing

Pe3s

  • Full Member
  • ***
  • Posts: 248
Re: VST DefaultNodeHeight
« Reply #4 on: August 04, 2022, 07:05:04 am »
What steps do I need to follow to increase the height of the rows in the VirtualStringTree component, entering values in the
DefaultNodeHeight does not give anything ????

El Salvador

  • Jr. Member
  • **
  • Posts: 76
Re: VST DefaultNodeHeight
« Reply #5 on: August 04, 2022, 07:56:14 am »
In event vst's OnMeasureItem you must change var NodeHeight:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.DoMeasureItem(Sender: TBaseVirtualTree;
  2.   TargetCanvas: TCanvas; Node: PVirtualNode; var NodeHeight: Integer);
  3. begin
  4.   //Node height based of DPI
  5.   NodeHeight := Round((Screen.PixelsPerInch / 96.0) * 36);  
  6. end;  
  7.  

Pe3s

  • Full Member
  • ***
  • Posts: 248
Re: VST DefaultNodeHeight
« Reply #6 on: August 04, 2022, 09:06:39 am »
Thank you  :)

wp

  • Hero Member
  • *****
  • Posts: 10059
Re: [SOLVED] VST DefaultNodeHeight
« Reply #7 on: August 04, 2022, 12:54:21 pm »
In the attachment there is a demo in which a handler for the OnMeasureItem event is not needed. Just set the value of DefaultNodeHeight in the Object Inspector or at runtime before the nodes are initialized (populated) because they get the NodeHeight and TotalNodeHeight stored in the TVirtualNode record here from DefaultNodeHeight (TBaseVirtualTree.MakeNewNode).

Note that the attached demo is written with the VTV version which comes with Lazarus. If the demo does not compile because you use the OPM or some other version remove the laz.virtualtreeview_package from the project depencies and add virtualtreeview_package instead. And in unit1's uses clause replace "Laz.VirtualTrees" by "VirtualTrees".

« Last Edit: August 04, 2022, 01:47:54 pm by wp »

Pe3s

  • Full Member
  • ***
  • Posts: 248
Re: [SOLVED] VST DefaultNodeHeight
« Reply #8 on: August 04, 2022, 04:28:21 pm »
A big thank you to everyone :)

 

TinyPortal © 2005-2018