pupsik писал(а):Осмелюсь спросить: вы хоть знаете что делает RecreateWnd?
- Код: Выделить всё
{------------------------------------------------------------------------------
RecreateWnd
This function was originally member of TWincontrol. From a VCL point of view
that made perfectly sense since the VCL knows when a win32 widget has to be
recreated when properties have changed.
The LCL however doesn't know, the widgetset does. To avoid old VCL behaviour
and to provide a central function to the widgetset, it is moved here.
MWE.
------------------------------------------------------------------------------}
procedure RecreateWnd(const AWinControl:TWinControl);
var
IsFocused: Boolean;
begin
if csDestroying in AWinControl.ComponentState then Exit;
if wcfCreatingHandle in AWinControl.FWinControlFlags then exit;
if not AWinControl.HandleAllocated
then begin
// since only the interface (or custom interface dependent controls) should
// call us, the handle is always created
{$IFNDEF DisableChecks}
DebugLN('WARNING: obsolete call to RecreateWnd for %s', [AWinControl.ClassName]);
{$ENDIF}
//DumpStack;
end;
IsFocused := AWinControl.Focused;
AWinControl.DestroyHandle;
AWinControl.UpdateControlState;
if IsFocused and AWinControl.HandleAllocated
then SetFocus(AWinControl.FHandle);
end;