Question

I have created Custom Form (CreateCustomForm) and changed LicenseMemo.Parent to this Form. Unfortunately that results quite not as expected as the LicenseFile RTF is always displayed as Plain Text - all RTF formatting is gone (Font, Font Styles, Font Sizes, etc.).

Should I set additional formatting for LicenseMemo after changing it's parent?

Was it helpful?

Solution

This happens because when you are re-parenting a control, the control's window is internally re-created and since the TRichEditViewer component doesn't store the RTF stream anyhow, nor reload it when the control is being recreated, it simply loses its RTF content and shows only plain text which stored is.

What is also bad for this case is that even the RTFText property doesn't implement reading of the RTF stream from existing control instance, so you cannot even save the RTF by yourself before re-parenting for restoring it later on.

There is a way to get the RTF stream by using EM_STREAMOUT message, but that's a quite a lot of work which might finally be untranslatable for Inno Setup Pascal Script due to lack of missing pointer support.

The only easy workaround I can think of is to reload the RTF content file after re-parenting the control. I know that you'll need to include the license file into [Files] entries and extract it manually, but it's the least painful way to go.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top