TNewCheckListBox: Transparent Background - How?

37 views
Skip to first unread message

Alex Born

unread,
Jul 11, 2020, 6:29:14 AM7/11/20
to innosetup
Hello Everybody!

How make a control TNewCheckListBox with transparent background?
Or, or can someone add transparency support to the TNewCheckListBox control?

TNewCheckListBox01.png



There is really a lack of this property for creating game installers.

I know about third-party developments (e.g. Graphical Installer), but they are not free.
Why use a third-party, if you can simply supplement the code components?


I tried to resolve this issue using the section [Code].
But I do not have enough knowledge and understanding how to do it right.

Example:
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={autopf}\My Application
PrivilegesRequired=none
WizardImageFile=compiler:WizModernImage-IS.bmp
OutputDir=userdocs:Inno Setup Examples Output
DisableWelcomePage=no

[Code]
function GetWindowLong(hWnd: HWND; nIndex: Integer): Longint; external 'GetWind...@user32.dll stdcall';
function SetWindowLong(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint; external 'SetWind...@user32.dll stdcall';

const
    GWL_EXSTYLE
= (-20);
    WS_CLIPCHILDREN
= $2000000;
    WS_EX_TRANSPARENT
= $20;
    BS_CHECKBOX
= $0002;
    BS_OWNERDRAW
= $000B;
    BM_SETSTYLE
= $00F4;

var
 
CheckListBox: TNewCheckListBox;
 
Style: Word;


procedure
InitializeWizard();
begin
 
WizardForm.WizardBitmapImage.Align := alClient;
 
WizardForm.WelcomeLabel1.Hide;
 
WizardForm.WelcomeLabel2.Hide;

 
CheckListBox := TNewCheckListBox.Create(WizardForm);
 
Style := BS_CHECKBOX or BS_OWNERDRAW;
 
with CheckListBox do
   
begin
     
Left := ScaleX(50);
     
Top := ScaleY(50);
     
Width := ScaleY(300);
     
Height := ScaleY(200);
     
Anchors := [akLeft, akTop, akRight, akBottom];
     
Flat := True;
     
Parent := WizardForm.WizardBitmapImage.Parent;
     
AddCheckBox('TNewCheckListBox', '', 0, True, True, False, True, nil);
     
AddRadioButton('TNewCheckListBox', '', 1, True, True, nil);
     
AddRadioButton('TNewCheckListBox', '', 1, False, True, nil);
     
AddCheckBox('TNewCheckListBox', '', 0, True, True, False, True, nil);
     
AddCheckBox('TNewCheckListBox', '', 1, True, True, False, True, nil);
     
AddCheckBox('TNewCheckListBox', '', 2, True, True, False, True, nil);
     
AddCheckBox('TNewCheckListBox', '', 2, False, True, False, True, nil);
     
AddCheckBox('TNewCheckListBox', '', 1, False, True, False, True, nil);
     
SetWindowLong(Handle, GWL_EXSTYLE, GetWindowLong(Handle, GWL_EXSTYLE) or WS_EX_TRANSPARENT and not WS_CLIPCHILDREN);
     
SendMessage(Handle, BM_SETSTYLE, Style, 1);
     
Invalidate;
   
end;
end;

procedure
CurPageChanged(CurPageID: Integer);
begin
 
WizardForm.NextButton.Hide;
 
WizardForm.CancelButton.Caption := 'Close';
end;

procedure
CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
 
Confirm := False;
end;


Result:

TNewCheckListBox02.png



But in my opinion it is a "rake". The best solution is to change the code of the TNewCheckListBox component.

Can someone really do this? Please....

T Slappy

unread,
Jul 12, 2020, 1:18:34 AM7/12/20
to innosetup
Hello.


You indeed need to update the TNewCheckListBox component - you need to do your own drawing which is quite a lot of work because you need to change the sources of Inno Setup (recompile Inno).

I do not think it is enough to change the Code section

The Graphical Installer is perfect for game installers and that is reason why we developed that - but we keep it separate from official Inno as this installer design does not suit everyone.


P.S.: I am developer of the Graphical Installer, if you want to use it I can send you my promo code to have -20% off.

Slappy

On Saturday, July 11, 2020 at 12:29:14 PM UTC+2, Alex Born wrote:
Hello Everybody!

How make a control TNewCheckListBox with transparent background?
Or, or can someone add transparency support to the TNewCheckListBox control?

TNewCheckListBox01.png



There is really a lack of this property for creating game installers.

I know about third-party developments (e.g. Graphical Installer), but they are not free.
Why use a third-party, if you can simply supplement the code components?


I tried to resolve this issue using the section [Code].
But I do not have enough knowledge and understanding how to do it right.

Example:
[Setup]
AppName=My Application
AppVersion=1.5
DefaultDirName={autopf}\My Application
PrivilegesRequired=none
WizardImageFile=compiler:WizModernImage-IS.bmp
OutputDir=userdocs:Inno Setup Examples Output
DisableWelcomePage=no

[Code]
function GetWindowLong(hWnd: HWND; nIndex: Integer): Longint; external 'GetWindowLongW user32.dll stdcall';
function SetWindowLong(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint; external 'SetWindowLongW user32.dll stdcall';
Reply all
Reply to author
Forward
0 new messages