I got a list of components (applications) that I can select to install (by default they are all checked) and all of those components got ExtraDiskSpaceRequired
. On the start, I dynamically change which applications should be checked or unchecked depending on are they installed and some other conditions.
Now problem is when I check components (TNewCheckListBox
items) from code on start "Disk space required" label is not updated until I change state of some checkbox from the list by mouse or keyboard.
I tried to fix it with:
WizardForm.Repaint
and other methods like thatTrying to send Space button down and up with SendInput
from Windows API but it returns 0 (not pressed). I called SendInput
in CurPageChanged
function when wpSelectComponents is shown and from Timer
Code I used for SendInput
:
type
TKeyboardInput = record
Itype: DWORD;
wVk: WORD;
wScan: WORD;
dwFlags: DWORD;
time: DWORD;
dwExtraInfo: DWORD;
end;
function SendInput(nInputs: UINT; pInputs: TKeyboardInput;
cbSize: Integer): UINT;
external 'SendInput@user32.dll stdcall';
function SendKeyPressed(KeyCode: Word): Boolean;
var
InputDown: TKeyboardInput;
InputUp: TKeyboardInput;
begin
Result := False;
InputDown.Itype := 1;
InputDown.wVk := KeyCode;
InputDown.wScan := 0;
InputDown.time := 0;
InputDown.dwFlags := 0;
InputUp.Itype := 1;
InputUp.wVk := KeyCode;
InputUp.wScan := 0;
InputUp.time := 0;
InputUp.dwFlags := 2;
MsgBox(IntToStr(SendInput(1, InputDown, SizeOf(InputDown))),
mbInformation, MB_OK);
Result := SendInput(1, InputUp, SizeOf(InputUp)) = 1;
if Result then
begin
MsgBox('Test2', mbInformation, MB_OK);
end;
end;
Any idea how can I solve this?
Example by default:
Example after changing state by code on start:
CheckBox2 7MB unchecked
Disk space label is still 12MB until I change state of checkbox by mouse or keyboard
Note: I am using Inno Setup 5.6.1 (u) and can not update for now.
Trigger TNewCheckListBox.OnClickCheck
event after you update the state of the list checkboxes:
WizardForm.ComponentsList.OnClickCheck(WizardForm.ComponentsList);