2 Replies - 7731 Views - Last Post: 02 April 2010 - 03:56 AM Rate Topic: -----

#1 lighten123  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 23-March 10

[inno setup] Pascal and Delphi Syntax Error?!

Posted 01 April 2010 - 08:55 PM

This is the code section from inno setup.My intention is to make two Checkbox where at a time one is being selected.
But this code return error.

[Code]
procedure CheckBoxonclick(Sender: TObject);
var
Box2,CheckBox: TNewCheckBox;
begin
if CheckBox.Checked then
   CheckBox.State := cbUnchecked;
   Box2.State := cbChecked;
else                                //THIS LINE RETURNS AN ERROR: "Identifier Expected."
   CheckBox.State := cbChecked;
   Box2.State := cbUnchecked;
end;

procedure Box2onclick(Sender: TObject);
var
Box2,CheckBox: TNewCheckBox;
begin
if Box2.Checked then
   CheckBox.State := cbChecked;
   Box2.State := cbUnchecked;
else                               //same error
   CheckBox.State := cbUnchecked;
   Box2.State := cbChecked;
end;

procedure CreateTheWizardPages;
var
  Page: TWizardPage;
  Box2,CheckBox: TNewCheckBox;
begin
  { TButton and others }

  Page := CreateCustomPage(wpWelcome, '', '');

  CheckBox := TNewCheckBox.Create(Page);
  CheckBox.Top :=ScaleY(8)+ScaleX(50);
  CheckBox.Width := Page.SurfaceWidth;
  CheckBox.Height := ScaleY(17);
  CheckBox.Caption := 'Do this';
  CheckBox.Checked := True;
  CheckBox.onclick := @CheckBoxonclick;
  CheckBox.Parent := Page.Surface;

  Box2 := TNewCheckBox.Create(Page);
  Box2.Top :=ScaleY(8)+ScaleX(70);
  Box2.Width := Page.SurfaceWidth;
  Box2.Height := ScaleY(17);
  Box2.Caption := 'No,Thanks.';
  Box2.Checked := False;
  Box2.onclick := @Box2onclick;
  Box2.Parent := Page.Surface;
end;


procedure InitializeWizard();
//var
begin
  { Custom wizard pages }
  CreateTheWizardPages;
end;



Please tell me where to change..

Is This A Good Question/Topic? 0
  • +

Replies To: [inno setup] Pascal and Delphi Syntax Error?!

#2 n8wxs  Icon User is offline

  • --... ...-- -.. . -. ---.. .-- -..- ...
  • member icon

Reputation: 972
  • View blog
  • Posts: 3,878
  • Joined: 07-January 08

Re: [inno setup] Pascal and Delphi Syntax Error?!

Posted 02 April 2010 - 01:10 AM

try this instead:
...
if CheckBox.Checked then
   begin
      CheckBox.State := cbUnchecked;
      Box2.State := cbChecked;
   end;
else                                //THIS LINE RETURNS AN ERROR: "Identifier Expected."
   begin
      CheckBox.State := cbChecked;
      Box2.State := cbUnchecked;
   end;
...



More than one statement after an if or else requires bracketing the statements with begin and end
Was This Post Helpful? 0
  • +
  • -

#3 lighten123  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 23-March 10

Re: [inno setup] Pascal and Delphi Syntax Error?!

Posted 02 April 2010 - 03:56 AM

My bad thanks n8wxs.
But there i got another problem:

Posted Image

line 19 is:
if CheckBox.Checked then

Now what to do...?? :sweatdrop:

This post has been edited by lighten123: 02 April 2010 - 04:13 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1