Bug in TTMSFNCMemo: Control 'memo' has no parent window.

Hi,

In Delphi 13 latest update, TMS FNC UI Pack latest, I get this error when I close a form with a TTMSFNCMemo component on it.

This error comes from your own demo:
tms.fnc.uipack\Demos\VCL\Memo\Default\VCLTMSFNCMemoDemo.dproj

Any suggestions?

thank you.

We’ll investigate asap

1 Like

Thank you!
In the meanwhile, the error was tracked:

The issue is located in `VCL.TMSFNCWebBrowser.Win.pas` at line 2497, in the `GetControlHandle` function:

function TTMSFNCWinWebBrowser.GetControlHandle: HWND;

begin

Result := 0;

if Assigned(FWebControl) then

begin

{$IFDEF CMNLIB}

Result := FWebControl.Handle;  // <-- PROBLEM HERE

{$ENDIF}

...

end;

end;

A potential fix (at least in my first test in VCL):

function TTMSFNCWinWebBrowser.GetControlHandle: HWND;

{$IFDEF FMXLIB}

var

f: TCustomForm;

{$ENDIF}

begin

Result := 0;

if Assigned(FWebControl) then

begin

{$IFDEF CMNLIB}

if Assigned(FWebControl.Parent) then

  Result := FWebControl.Handle;

{$ENDIF}

{$IFDEF FMXLIB}

f := TTMSFNCUtils.GetParentForm(FWebControl);

if Assigned(f) then

  Result := WindowHandleToPlatform(f.Handle).Wnd

else if (FWebControl.Parent is TFrame) and Assigned(Application.MainForm) then

begin

  Result := WindowHandleToPlatform(Application.MainForm.Handle).Wnd;

end;

{$ENDIF}

end;

end;

Can you try with FWebControl.HandleAllocated?

We tested here and couldn’t really see an issue with the memo, we didn’t have the control has no parent window exception, can you provide some more steps to reproduce?

Thank you.

When rebuilding the pack (using the TMS setup) with the fix you provided for the other issue, this problem appears to be resolved. I don’t know what happened.

I’ll let you know if it comes up again.