Inno Setup and checkbox problem

I have problem with caption parameter because can't put there long sentence since it's cutted to window width instead of word wrapping...
Anyone know solution?

 CheckBox := TCheckBox.Create(Page);
  CheckBox.Width := Page.SurfaceWidth;
  CheckBox.Height := ScaleY(17);
  CheckBox.Caption := 'TCheckBox';
  CheckBox.Checked := False;
  CheckBox.Parent := Page.Surface;
NoradEEAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mirtheilSoftware DeveloperCommented:
I couldn't find a way to change the size of the checkbox text size so I added a label and have the checkbox underneatch.
Try this:

; -- CodeDlg.iss --
;
; This script shows how to insert custom wizard pages into Setup and how to handle
; these pages. Furthermore it shows how to 'communicate' between the [Code] section
; and the regular Inno Setup sections using {code:...} constants. Finally it shows
; how to customize the settings text on the 'Ready To Install' page.

[Setup]
AppName=My Program
AppVerName=My Program version 1.5
DefaultDirName={pf}\My Program
DisableProgramGroupPage=yes
UninstallDisplayIcon={app}\MyProg.exe
OutputDir=userdocs:Inno Setup Examples Output

[Files]
Source: "MyProg.exe"; DestDir: "{app}"; Flags: ignoreversion

[Code]
var
Page: TWizardPage;

procedure  ChkOnChange (Sender: TObject);
var
MyCheckBox : TCHeckBox;
begin
MyCheckBox := TCheckBox(Sender);
if MyCheckBox.Checked then
  WizardForm.NextButton.Enabled := true
else
  WizardForm.NextButton.Enabled := false;
end;


procedure InitializeWizard;
var
  CheckBox: TCheckBox;
  MyLabel : TLabel;
begin
  Page := CreateCustomPage(wpWelcome, 'Custom wizard page controls', 'TCheckBox example');

  MyLabel := TLabel.Create(Page);
  //MyLabel.height := ScaleY(34);
  MyLabel.Width := Page.SurfaceWidth;
  MyLabel.Caption := 'I have problem with caption parameter because cannot put there long sentence ' + #13#10 + 'since it is cutted to window width instead of word wrapping...';
  MyLabel.WordWrap := true;
  MyLabel.Parent := Page.Surface;

  CheckBox := TCheckBox.Create(Page);
  CheckBox.Width := Page.SurfaceWidth;
  CheckBox.Height := ScaleY(34);
  CheckBox.Caption := 'I agree.';
  CheckBox.Checked := False;
  CheckBox.Parent := Page.Surface;
  CheckBox.OnClick := @ChkOnChange;
  CheckBox.Top := MyLabel.Top + MyLabel.Height + 20;
  

;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageId = Page.ID then
  WizardForm.NextButton.Enabled := false;
end;

end.

Open in new window

0
NoradEEAuthor Commented:
looks badly in real, comes to next line on word "sentence" since it's already on begening of new line...
0
mirtheilSoftware DeveloperCommented:
Okay, I found that you have to set AutoSize to False before setting the caption and wordwrap values.  Something like:
MyLabel := TLabel.Create(Page);
  MyLabel.Width := Page.SurfaceWidth;
  MyLabel.AutoSize := false;
  MyLabel.Height := ScaleX(100);
  MyLabel.Caption := 'I have problem with caption parameter because cannot put there long sentence since it is cutted to window width instead of word wrapping...';
  MyLabel.WordWrap := true;

You may needplay around with the Height value to match the text you have.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Installation

From novice to tech pro — start learning today.