[Lazarus] RegisterWSComponent documentation?

Zoë Peterson zoe at scootersoftware.com
Wed Nov 11 21:31:22 CET 2020


Dmitry,

Thanks for the write-up, that's what I thought was going on, and details 
like the "inherited" call were what I was worried about. :)

Now that I've had a chance to shake out the design, I do see a patch I 
could pull together if you think it would be merged.  General details are:

1) Add a new NSVisualEffectView descendant that wraps a 
TCocoaManualScrollHost and passes things down to it, just like 
TCocoaManualScrollHost does for its documentView.

2) TCocoaWSTreeView.CreateHandle would call the existing 
TCocoaWSCustomControl.CreateHandle to create the TCocoaManualScrollHost 
handle, then check the OS version, and if it's macOS 10.14 or later, it 
would create the NSVisualEffectView and nest the inherited handle within 
it.  This new view becomes the handle, but only on versions of macOS 
that require it.

3) Change a couple of places in TTreeView to call 
GetColorResolvingParent so it can use clDefault, and add a 
TCocoaWSTreeView.GetDefaultColor method that conditionally returns 
either clWindow or clNone.  The TTreeView code already skips doing a 
fillRect on the background if you set Color to clNone.

Personally I need the new behavior for any TCustomControl descendant, so 
I'd put most of the code in TCocoaWSCustomControl, but we have our own 
TUiTreeView/TUiCustomControl classes already, so I can add the extra 
configurability we'd need there.

The biggest concern I'd have with it being pushed into LCL proper is 
that FillRect(clWindow) doesn't look right.  The NSViualEffectView 
changes color based on the average color of the desktop wallpaper behind 
the window and shifts as you move the window around, so none of the 
NSColors can match it.  I had to adjust our owner draw functions to not 
rely on drawing an opaque rectangle to clear/overwrite things, but it 
wasn't too bad.

I know this might seem like an unnecessary flourish, but TListView and 
TListBox already have the color shifting background.  I'm just trying to 
make TTreeView match them and NSOutlineView.

-- 
Zoë Peterson
Scooter Software



More information about the lazarus mailing list