Ok 440bx, but i'd like to remark that there might be also some other reasons possible:
- The subclassing NPP theme layer had already picked up the ownership of the drawing
- the null_brush works for the form, but this is not noticeable (no form's flicker before, and not after). But the treeview flicker continues because it's Invalidates causes control's repaint in light
- RegisterClassEx is not designed for/not able to have an update capability
- Within FormCreate it is done too late
For to come nearer, some checks:
wnd.hCursor := Windows.LoadCursor(0, IDC_WAIT); // This should directly be visible on the form ..
anAtom := Windows.RegisterClassEx(wnd);
No effect. 'anAtom' is 0. It should contain a unique id for the class, so '0' is probably wrong.
That does mean imo, no modification of the class attributes had happened. So it's not likely it's about the NULL_BRUSH only.
Next checks:
- try to do it at an earlier stage (CreateWnd):
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure CreateWnd; override;
procedure THelloWorldDockingForm.CreateWnd;
var wnd: Windows.TWNDClassEx; szClassName: String; anAtom: ATOM;
begin
inherited CreateWnd;
szClassName := 'Window';
if GetClassInfoEx(hInstance, PChar(szClassName), @wnd) then
begin
wnd.hCursor := Windows.LoadCursor(0, IDC_WAIT);
anAtom := Windows.RegisterClassEx(wnd); // After that, 'anAtom' is 0.
end;
end;
No change of the cursor. - Now, an attempt using CreateParams, where one can influence styles:
procedure THelloWorldDockingForm.CreateParams(var Params: TCreateParams);
begin
//inherited CreateParams(Params);
with Params do begin
//Style := Style or WS_BORDER;
//ExStyle := WS_EX_TOOLWINDOW or WS_EX_TOPMOST;
//WindowClass.Style := CS_SAVEBITS;
WindowClass.hbrbackground := HBRUSH(GetStockObject(NULL_BRUSH));;
WindowClass.hCursor := Windows.LoadCursor(0, IDC_WAIT);
end;
inherited CreateParams(Params);
end;
No wait cursor for the form, and no reduction of the treeview's flicker.
I'll give up this way and go back to observe if i see side-effects of the proposed code change in TCustomTreeView.UpdateHotTrack next days.