View Issue Details

IDProjectCategoryView StatusLast Update
0034002LazarusLCLpublic2018-09-11 14:40
ReporterMIS5 Assigned ToDmitry Boyarintsev  
Status resolvedResolutionfixed 
Platformmacos lazarus trunk 
Product Version1.8.5 (SVN) 
Summary0034002: toolbars content disapears
DescriptionWhen window is maximized toolbar content disapears,41930.0.html
Steps To ReproduceToolbars on a Panel aligned to top. When window is maximized using the green apple button - the content of the toolbars disappear.

Additional Information"GetMem" in the forum post could duplicate error like this when I asked if other could duplicate:

"Yes I can. Just open OPM then go to the toolbar in the bottom. Suddenly the content of the toolbar disappear, then appears back again but at a higher position. If you move the mouse some of the buttons are redrawn, but not all of them."


I am not sure if related, but the tabs in a TPageControl (aligned just below the tpanel containing the toolbars in my own test case) has a paint problem when the window gets maximized (top half is whitish color) - but that is resolved by clicking the tabs.
TagsNo tags attached.
Fixed in Revision
Attached Files


parent of 0034196 resolvedDmitry Boyarintsev ExcludeClipRect is ignored 
parent of 0034197 resolvedDmitry Boyarintsev BitBlt/SetWindowOrgEx problem in Cocoa 


Dmitry Boyarintsev

2018-07-20 04:32

developer   ~0109581

needed: revision number
sample project


2018-07-20 19:03

reporter   ~0109590

Hi Dmitry

SVN Revision 58553

I am working hard on creating a demo project.

I see it all the time in my own project, but trying to duplicate it in a demo project is hard. (Tried many hours)

I have tried / trying investigating if related to actions, imagelist content, resizing etc. - so far not been able to pinpoint it except I think one trigger is happening at some point *after* a resize event.

I hope maybe @GetMem from forum thread can provide example.

Maybe here is some events I can place a breakpoint at...

Dmitry Boyarintsev

2018-07-20 19:15

developer   ~0109591

Start removing components from the project, until the bug disappears. (or until there’s nothing else to remove)

You will either get the minimal project
Find the conflicting combination


2018-07-22 00:36

reporter   ~0109614

Last edited: 2018-07-22 00:37

View 2 revisions

Here is a demo project which demonstrates multiple issues. It uses Mac/Cocoa fpcupdeluxe "trunk" and there is no real code in this project.


1) Demonstrates toolbuttons becoming invisible until clicked (just click on the top toolbar to expose them)

2) Demonstrates TPageControl tabsheets misdrawn until clicked

3) Demonstrates TEdit looking very weird with black background until clicked

4) Demonstrates 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.

There are more ways to trigger above errors, but the above is the easiest to make all the problems visible in one go :)


I will try simplify the case further - but I am just so happy I finally managed to make a test case that demonstrates the issue and wanted to upload it now.


2018-07-22 00:37

reporter (136,474 bytes)

Dmitry Boyarintsev

2018-07-22 07:48

developer   ~0109615

the problem seems to be caused by the presence of VirtualStringTree
try to set both VirtualStingTree visibility to false and try the project again.


2018-07-22 09:18

reporter   ~0109619

Hi Dimitry

It seems you are right.

I will try report this as a bug there as well...

And I will reference this bug report since I can not tell at present if this a bug in Virtual Treeview or because of Virtual Treeview "pushes" or uses rare features in Cocoa implementation.


2018-07-22 11:22

reporter   ~0109628

@Dimitry - let me know if you need me to test any solution or similar.

At this point I have submitted it as a bug/issue all relevant places for virtual treeview.

If this is a case of Cocoa implemention in Lazarus still being Alpha/Beta or it is virtualstringtree / virtual treeview "misusing" Cocoa I can not say :)

Dmitry Boyarintsev

2018-07-22 16:44

developer   ~0109637

The issue is with Cocoa implementation of graphics functions. More specifically - clipping area.
It’s not virtualtree bug


2018-07-31 13:30

reporter   ~0109780

Last edited: 2018-07-31 13:30

View 2 revisions

I have not yet learned the internals of the LCL or Cocoa for that matter, but I will be happy to test. (I may also try pick up documentation on the LCL design and how each widgetset is implemented, but I think it will take some time.) Meanwhile, maybe "severity" should be upgraded from "minor", but tha is of course my subjective opinion :)

The maintainer of Lazarus Virtual Treeview wrote back

"VirtualTreeView does not uses cocoa directly, just LCL and lclextensions."

"The way to go is to isolate the API that is broken and fix it."

"If you want to isolate code from lclextensions, compile with USE_DELPHICOMPAT directive disabled ("

So it seems you have reached the same conclusion.


2018-08-16 01:18

reporter   ~0110065

Just for reference, I have tested on latest trunk and the problem(s) still seem to be there.


2018-08-22 13:50

reporter   ~0110229

Last edited: 2018-08-22 13:50

View 2 revisions

For reference I have tried duplicate the problem manually without using virtual treeview, but so far unsuccessful:

I tried two demos that *appears* to work on Cocoa - a when least standalone:

called SpriteTest2.Zip and it uses copyrect, mask, union

Same thread, Mr.Madguy code listed uses intersect, fillrect, cliprect


2018-08-26 14:04

reporter   ~0110316

For what it is worth :

There is a new virtual treeview version out
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 which may be an advantage in locating the issue.


2018-08-28 00:13

reporter   ~0110334

Last edited: 2018-08-28 00:15

View 2 revisions

The maintainer of virtual tree view provided two demos testing ExcludeClipRect and BitBlt/SetWindowOrgEx and I believe both demonstrates a problem with Lazarus/Cocoa. Details:

In the past this was fixed for Carbon LCL related to virtual treeview / (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

He suggest trying this ExcludeClipRect demo:

Bug? Lazarus/Cocoa: Seems ExcludeClipRect is ignored


I have attached screenshots

The original discussion on GitHub:


2018-08-28 00:13


BitBltSetWindowOrgEx.png (21,505 bytes)   
BitBltSetWindowOrgEx.png (21,505 bytes)   


2018-08-28 00:14


ExcludeClipRect.png (20,083 bytes)   
ExcludeClipRect.png (20,083 bytes)   


2018-09-01 09:54



2018-09-04 22:58

reporter   ~0110501

Last edited: 2018-09-05 13:46

View 2 revisions

For what it is worth there has been made separate bug reports for:

ExcludeClipRect =
SetWindowOrgEx =


2018-09-05 13:46

reporter   ~0110513

Much better demo uploaded - simply do as the demo file name suggets "" and see all the problems.

After a continued amount of testing in this discussion thread:

It seems fixing the two reported issues will have a *high chance* of solving all the issues.

Dmitry Boyarintsev

2018-09-06 05:43

developer   ~0110529

the contents of the toolbar no longer disappears

please test and close if ok


2018-09-11 14:28

reporter   ~0110655

Last edited: 2018-09-11 14:40

View 5 revisions

Testing against shows the issues remain unsolved :(


I can see the demo app for the ExcludeClipRect child but report appears to be solved now


However, the reason I do not believe ExcludeClipRect is fixed yet is:

The demo will work if ExcludeClipRect is replaced by a complete dummy function (!)

The Lazarus maintainter of virtual reeview for Lazarus applied the "dummy exclupdecliprect" fix for testing:

Issue History

Date Modified Username Field Change
2018-07-18 13:34 MIS5 New Issue
2018-07-20 04:32 Dmitry Boyarintsev LazTarget => -
2018-07-20 04:32 Dmitry Boyarintsev Note Added: 0109581
2018-07-20 04:32 Dmitry Boyarintsev Assigned To => Dmitry Boyarintsev
2018-07-20 04:32 Dmitry Boyarintsev Status new => feedback
2018-07-20 19:03 MIS5 Note Added: 0109590
2018-07-20 19:03 MIS5 Status feedback => assigned
2018-07-20 19:15 Dmitry Boyarintsev Note Added: 0109591
2018-07-22 00:36 MIS5 Note Added: 0109614
2018-07-22 00:37 MIS5 File Added:
2018-07-22 00:37 MIS5 Note Edited: 0109614 View Revisions
2018-07-22 07:48 Dmitry Boyarintsev Note Added: 0109615
2018-07-22 09:18 MIS5 Note Added: 0109619
2018-07-22 11:22 MIS5 Note Added: 0109628
2018-07-22 16:44 Dmitry Boyarintsev Note Added: 0109637
2018-07-31 13:30 MIS5 Note Added: 0109780
2018-07-31 13:30 MIS5 Note Edited: 0109780 View Revisions
2018-08-16 01:18 MIS5 Note Added: 0110065
2018-08-22 13:50 MIS5 Note Added: 0110229
2018-08-22 13:50 MIS5 Note Edited: 0110229 View Revisions
2018-08-26 14:04 MIS5 Note Added: 0110316
2018-08-28 00:13 MIS5 Note Added: 0110334
2018-08-28 00:13 MIS5 File Added: BitBltSetWindowOrgEx.png
2018-08-28 00:14 MIS5 File Added: ExcludeClipRect.png
2018-08-28 00:15 MIS5 Note Edited: 0110334 View Revisions
2018-09-01 09:54 MIS5 File Added:
2018-09-04 22:58 MIS5 Note Added: 0110501
2018-09-05 13:46 MIS5 Note Added: 0110513
2018-09-05 13:46 MIS5 Note Edited: 0110501 View Revisions
2018-09-06 05:06 Dmitry Boyarintsev Relationship added parent of 0034196
2018-09-06 05:07 Dmitry Boyarintsev Relationship added parent of 0034197
2018-09-06 05:43 Dmitry Boyarintsev Note Added: 0110529
2018-09-06 05:43 Dmitry Boyarintsev Status assigned => resolved
2018-09-06 05:43 Dmitry Boyarintsev Resolution open => fixed
2018-09-11 14:28 MIS5 Note Added: 0110655
2018-09-11 14:32 MIS5 Note Edited: 0110655 View Revisions
2018-09-11 14:38 MIS5 Note Edited: 0110655 View Revisions
2018-09-11 14:39 MIS5 Note Edited: 0110655 View Revisions
2018-09-11 14:40 MIS5 Note Edited: 0110655 View Revisions