Inno Setup having multiple UpdateReadyMemo events

51 Views Asked by At

I'm using Inno Setup 6.2. I need to add a custom contents to "Ready to Install" page. For that I'm using

function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;

According to the documentation, function's return value is the displayed string/contents.
This works fine so far.

I've added a third party component (https://github.com/DomGries/InnoDependencyInstaller) which also implements the event and updates the page content too.

<event('UpdateReadyMemo')>
function Dependency_Internal3(const Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;

Note the event identifier.

Documentation also points out that those events are called in order of their definition, stopping in case one of them returns a non-empty string.
As the return string is the displayed text, this behavior prevents having multiple UpdateReadyMemo events where each provides a part of the summary page.

Currently I removed the event identifier and call the function manually

function UpdateReadyMemo(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
var
    s: string;
begin
    s := Dependency_Internal3(Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo);

    ...
      
    Result := s
end;

Is there a better way without modifying and without accessing internal implementation of third party code to get a summary content from multiple modules?

thanks
Tom

1

There are 1 best solutions below

2
Martin Prikryl On

As Inno Setup stops on the UpdateReadyMemo function that returns something, you just need to make sure your implementation is before the InnoDependencyInstaller implementation.

But as you need to be able to call the Dependency_Internal3, before it is declared, you need to forward declare it.

Something like this:

[Code]

function Dependency_Internal3(
  const Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo,
  MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String; forward;

function UpdateReadyMemo(
  Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo,
  MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo: String): String;
var
  s: string;
begin
  s :=
    Dependency_Internal3(
      Space, NewLine, MemoUserInfoInfo, MemoDirInfo, MemoTypeInfo, 
      MemoComponentsInfo, MemoGroupInfo, MemoTasksInfo);

  // ...
      
  Result := s
end;

// Include the (unmodified) InnoDependencyInstaller only now
#include "CodeDependencies.iss"

If you need even better solution, you will need to ask the library authors to make their API better.