Inno Setup: Capture control events in wizard page
-
02-07-2019 - |
Question
In a user defined wizard page, is there a way to capture change or focus events of the controls? I want to provide an immediate feedback on user input in some dropdowns (e.g. a message box)
Solution
Took me some time to work it out, but after being pointed in the right direction by Otherside, I finally got it (works for version 5.2):
[Code]
var
MyCustomPage : TWizardPage;
procedure MyEditField_OnChange(Sender: TObject);
begin
MsgBox('TEST', mbError, MB_OK);
end;
function MyCustomPage_Create(PreviousPageId: Integer): Integer;
var
MyEditField: TEdit;
begin
MyCustomPage := CreateCustomPage(PreviousPageId, 'Caption', 'Description');
MyEditField := TEdit.Create(MyCustomPage);
MyEditField.OnChange := @MyEditField_OnChange;
end;
OTHER TIPS
Since the scripting in innosetup is loosely based on Delphi, the controls should have some events like OnEnter
(= control got focus) and OnExit
(= control lost focus). You can assign procedures to these events, something like this:
ComboBox.OnExit := ComboBoxExit;
procedure ComboBoxExit(Sender: TObject);
begin
end;
I don't have access to Innosetup right now, so you will need to lookup the available events and parameters for the procedures.