Recent

Author Topic: 2.0.12, trouble with CustomTreeView (OnExpand?)  (Read 9217 times)

jamie

  • Hero Member
  • *****
  • Posts: 7516
Re: 2.0.12, trouble with CustomTreeView (OnExpand?)
« Reply #15 on: March 21, 2021, 02:19:01 pm »
I didn't look at the posters code but all I can think is if the BeginUpdate is active and a timer or thread is running to populate the list then the onexpanding won't reach the event.

 I think this is more of a user app design flaw myself because if you don't use the BeginUpdate/EndUpdate then that flag should never be set and it should work.

 The beginUdpate only aids in speed for populating the list...

 I just tested a little bit with the Trunk with a simple test and I really don't see an issue at this time..
The only true wisdom is knowing you know nothing

d7_2_laz

  • Hero Member
  • *****
  • Posts: 650
Re: 2.0.12, trouble with CustomTreeView (OnExpand?)
« Reply #16 on: March 21, 2021, 04:33:17 pm »
That's exactly what i just found out, jamie,  when searching where the tvsUpdating flag exactly had been set. It was indeed an outer leftover having been set conditionally (for a multi-used routine) ... and so it did prevent the OnExpanding   _now_  (with 2.0.12).
I wouldn't it call  it a flaw however. No problem with the old Delphi program code over a couple of years (regarding the tree population routine and it's anti-flicker measures).

At the end - if one once only got aware about such a dependcy (the new impacts of the tvsUpdating flag), one might see it easy.  At the beginning you grope in the dark when encountering the effects. But such is normal ...
Without the forum i would have gone lost!
Lazarus 4.4  FPC 3.2.2 Win10 64bit

wp

  • Hero Member
  • *****
  • Posts: 13350
Re: 2.0.12, trouble with CustomTreeView (OnExpand?)
« Reply #17 on: March 21, 2021, 05:09:32 pm »
I understand all these arguments. But without a correct project demonstrating that the tvsUpdating flag causes an issue I will not change the current code. Chances are high that the new code can will be wrong, too, because without your demo I will test it with my program which currently is working correctly.

d7_2_laz

  • Hero Member
  • *****
  • Posts: 650
Re: 2.0.12, trouble with CustomTreeView (OnExpand?)
« Reply #18 on: March 21, 2021, 06:19:52 pm »
Hello wp, thanks!
With the findings as of now i would not vote for a code change. Probably it's more a things of information and awareness, but of course it is up to you to decide.

However i attached a mini project that (at least i think so) does show up the dependency in it's roughest (most simplified) form.
You need to run it twice.  The second time after commenting out the BeginUpdate/EndUpdate within FormActivate (it's described in the momo field).
Lazarus 4.4  FPC 3.2.2 Win10 64bit

wp

  • Hero Member
  • *****
  • Posts: 13350
Re: 2.0.12, trouble with CustomTreeView (OnExpand?)
« Reply #19 on: March 21, 2021, 07:00:55 pm »
OK thank you, that's something to work with...

d7_2_laz

  • Hero Member
  • *****
  • Posts: 650
Re: 2.0.12, trouble with CustomTreeView (OnExpand?)
« Reply #20 on: March 23, 2021, 04:50:52 pm »
wp, i'm quite sure you already interpreted it in that way: that this single poor one child node of course represents a whole subtree, ie. achieved by recursion via further node.Expand directives within the OnExpanding event callback.
To make this more clear and better testable i adapted the test case a little bit (attached).
You'd need to activate the BeginUpdate/EndUpdates within the code for to see the effect.
Lazarus 4.4  FPC 3.2.2 Win10 64bit

wp

  • Hero Member
  • *****
  • Posts: 13350
Re: 2.0.12, trouble with CustomTreeView (OnExpand?)
« Reply #21 on: March 23, 2021, 05:08:38 pm »
Ah sorry, I forgot to update this thread: I fixed the behaviour in trunk (see https://bugs.freepascal.org/view.php?id=38084).

d7_2_laz

  • Hero Member
  • *****
  • Posts: 650
Re: 2.0.12, trouble with CustomTreeView (OnExpand?)
« Reply #22 on: March 23, 2021, 05:36:08 pm »
Thanky you! I'll check next Release Notes; meanwhile i'll omit the embracing BeginUpdate/EndUpdates when relevant in this respect.
Lazarus 4.4  FPC 3.2.2 Win10 64bit

jamie

  • Hero Member
  • *****
  • Posts: 7516
Re: 2.0.12, trouble with CustomTreeView (OnExpand?)
« Reply #23 on: March 24, 2021, 12:01:15 am »
Apparently it wasn't a good idea to remove that "tvsupdating" flag in the States

https://forum.lazarus.freepascal.org/index.php/topic,53844.0.html

Maybe it should be put back in at least for when the BeginUpdate is running, it does not have to actually be used like it was before which apparently caused some issues.

The only true wisdom is knowing you know nothing

 

TinyPortal © 2005-2018