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?
 
mirtheilConnect With a Mentor Commented:
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
 
mirtheilCommented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.