tags:

views:

740

answers:

2

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)

+1  A: 

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.

Otherside
+3  A: 

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;
Treb
Can you add the version of Inno Setup that you are using this code with? It looks like version 5. I ask this because I know there is quite a lot of difference regarding custom pages between versions 4 and 5.
Otherside
Hi Otherside, I added the version number to my answer. Thanks again for the help!
Treb