Recent

Author Topic: Alternative to VirtualTreeView in Cocoa which does not mess up other controls?  (Read 16069 times)

MISV

  • Hero Member
  • *****
  • Posts: 554
I submitted this bug report including a demo app that shows that an app with a virtualtreeview has the following issues:

1) toolbuttons becoming invisible until clicked (just click on the top toolbar to expose them)
2) TPageControl tabsheets misdrawn until clicked
3) TEdit looking very weird with black background until clicked
4) some captions/labels etc. are drawn upside down some places

To see all issues simply
- run project
- doubleclick window title bar (minimizes to dock)
- open from mac dock.

...

Dimitry was kind enough to write back it was a clipping problem in Cocoa implementation.

...

i understand clipping stuff is probably complicated... But my problem is I need a virtual treeview control since I may have up to a million items with 50 data columns... But still.. Is thee any LCL control I may be able to use instead of virtual treeview?
« Last Edit: August 17, 2018, 01:41:39 am by MISV »

Bart

  • Hero Member
  • *****
  • Posts: 3436
    • Bart en Mariska's Webstek
Most likely not, given that you have millions of items ....

Bart

wp

  • Hero Member
  • *****
  • Posts: 5724
But my problem is I need a virtual treeview control since I may have up to a million items with 50 data columns...
Are you sure that your users will ever look at 50 millions of pieces of data and not give up after the first ten rows? Isn't there a more clever way of showing them the data that they need?
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

MISV

  • Hero Member
  • *****
  • Posts: 554
Well, if they crawl a website with a million pages... they will want to be able to filter data but also dive through the directory structure as they please. (And enable whatever data columns they want)

Virtual Treeview is great in that regard since it is quite fast and quite memory friendly. It is a beautiful control for heavy duty stuff. (But yes, usually websites will have less pages.)



Posting this for myself to remind me of this option: http://wiki.lazarus.freepascal.org/Bounties#Cocoa_bounties
« Last Edit: August 17, 2018, 01:19:08 pm by MISV »

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2109
    • havefunsoft.com
There's an alternative to alternative of VirtualTreeView.

Instead of searching for something else, you could attempt to create a simple test case that demonstrated the problem.

It's potentially a simple task.
Implement some easy drawing using cliprect and see how it looks in any other widgetset (Win or Linux)
then run in on Cocoa.
If results are different (or worse, messing up drawing entirely), the project could be used to resolve the issue.
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

MISV

  • Hero Member
  • *****
  • Posts: 554
I did create a demo project demonstrating the problem if virtual treeview control was placed on a form.

However, I will consider seeing if I can create a demo project using cliprect directly! (Never had to touch that part of LCL before)

(Thank you for all the Cocoa fixes)


« Last Edit: August 19, 2018, 01:42:03 am by MISV »

MISV

  • Hero Member
  • *****
  • Posts: 554
If simple cliprect examples fail to reproduce:

I am wondering if perhaps a good approach would be to test other components using cliprect. If they fail, maybe report to the author of the component. They have inrinsic knowledge of their code which will help them figure out what is wrong.

If people have suggestions for components to test on Cocoa (ideally available in OPM or FPCUpDeluxe) let me know


MISV

  • Hero Member
  • *****
  • Posts: 554
I found various sprite/clipping/drawing demos here:
https://forum.lazarus.freepascal.org/index.php?topic=36871.0

...

One can download a relative simple demo here
https://forum.lazarus.freepascal.org/index.php/topic,36871.msg246309.html#msg246309
called SpriteTest2.Zip and it uses copyrect, mask, union
It works on both Lazarus/Windows and Lazarus/Cocoa so I did not manage to reproduce error using this

...

Nextup was to test Mr.Madguy code listed here which uses intersect, fillrect, cliprect
https://forum.lazarus.freepascal.org/index.php/topic,36871.msg246790.html#msg246790
It works on both Lazarus/Windows and Lazarus/Cocoa so I did not manage to reproduce error using this

...


Should anyone else have better ideas for testing/reproducing, I am crossing fingers you will manage at reproducing the problem! :)
« Last Edit: August 21, 2018, 06:15:20 pm by MISV »

MISV

  • Hero Member
  • *****
  • Posts: 554
There's an alternative to alternative of VirtualTreeView.

Instead of searching for something else, you could attempt to create a simple test case that demonstrated the problem.

It's potentially a simple task.
Implement some easy drawing using cliprect and see how it looks in any other widgetset (Win or Linux)
then run in on Cocoa.
If results are different (or worse, messing up drawing entirely), the project could be used to resolve the issue.

Unfortunately the problem has been hard to reproduce - even with non-trivial examples. (See other posts)

If you have more ideas, please let me know!



skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2109
    • havefunsoft.com
If you have more ideas, please let me know!
Well, sure.
You might want to show these simple samples to the authors of TVirtualTree,
and ask them what TVirtualTreeView is doing different then than those tests?

You could also ask them how to modify those simple tests to how TVirtualTreeView is actually drawing its contents.

Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

MISV

  • Hero Member
  • *****
  • Posts: 554
Almost ahead of you:
https://github.com/blikblum/VirtualTreeView-Lazarus/issues/8
But I will try ask explicitly instead of just listing that I have tried duplicate the issue using other demos.

Currently I am looking into the VConfig.inc that can alter defines

1) I can not comment USE_DELPHICOMPAT define out since virtualreeview wont compile then. (So that suggestion won't fly it seems) - I think USE_DELPHICOMPAT is what uses the lcl_extensions unit albeit not sure. In the link above, you can see the lazarus-port/maintainer recommend commenting the define out

2) However, I can comment EnableAdvancedGraphics define out... That does not seems to make any difference (todo repeat test)

« Last Edit: August 23, 2018, 02:31:48 pm by MISV »

MISV

  • Hero Member
  • *****
  • Posts: 554
I think this is a Lazarus/LCL issue and not virtualtreeview-new/5.x port

The reason is is that if you look here: https://github.com/blikblum/luipack/tree/master/lclextensions/include there is no Cocoa version (but there is e.g. a Carbon version) - 4 important units

However, the virtual-treeview that ships with Lazarus/trunk *has* those carbon units translated to Cocoa code placed in a Cocoa folder.

So someone added those things for Lazarus but never merged back into the website for Lazarus virtual treeview port.

That problem also relates to this issue: https://bugs.freepascal.org/view.php?id=33973


MISV

  • Hero Member
  • *****
  • Posts: 554
For what it is worth :

There is a new virtual treeview version out
https://github.com/blikblum/VirtualTreeView-Lazarus/tree/lazarus-v5
which allows to complile with USE_DELPHICOMPAT define commented out

The clipping problem remains unsolved though, but it means VT can be compiled without lcl-extensions.

MISV

  • Hero Member
  • *****
  • Posts: 554
Virtual Treeview Lazarus port maintainer has come up with multiple good test cases - next time I get lazarus/cocoa/64bit trunk working (I have a weird issue rendering my IDE unusuable) I will try those (but since trunk is not working for me, anyone else please feel free to chip in)

1)
In the past this was fixed for Carbon LCL related to virtual treeview
https://bugs.freepascal.org/view.php?id=28689 / http://bugs.freepascal.org/view.php?id=25564 (latter contains demo)
He suggests trying the attached demo on the Cocoa LCL implementation.

Bug? Lazarus/Cocoa: Seems seems to yield different results than other platforms with the BitBlt/SetWindowOrgEx demo



2)
He suggest trying this ExcludeClipRect demo:
https://bitbucket.org/blikblum/pascal-demos/src/16fc10cb12ed7a9fb1c4793bd592efb8ca198a9f/lazarus/LCLTests/ExcludeClipRect/?at=master

Bug? Lazarus/Cocoa: Seems ExcludeClipRect is ignored


See also
https://github.com/blikblum/VirtualTreeView-Lazarus/issues/8
« Last Edit: August 28, 2018, 12:04:11 am by MISV »

MISV

  • Hero Member
  • *****
  • Posts: 554
Bump - believe above post includes two examples of where Lazarus/Cocoa misbehaves