0
procedure qweClick(Sender: TObject);
    var
		CheckBox1: TCheckBox;
		Edit1: TEdit;
    begin
    if (Sender is TCheckBox) then
      CheckBox1:= TCheckBox(Sender);
      Edit1:= TEdit(CheckBox1.Parent.FindComponent('Edit'));
    end;

Umm...your not disabling the Edit1 here...

procedure qweClick(Sender: TObject);
    var
		a_CheckBox1: TCheckBox;
		a_Edit1: TEdit;
//I always use a_ for local scope variables...so that their is no ambiguity between variables...
    begin
    if (Sender is TCheckBox) then
    begin
      a_CheckBox1:= TCheckBox(Sender);
      a_Edit1:= TEdit(a_CheckBox1.Parent.FindComponent('Edit'));
      if Assigned(a_Edit1) then
        a_Edit1.Enabled := not a_Checkbox1.checked;
    end;
  end;
0
procedure qweClick(Sender: TObject);
    var
		CheckBox1: TCheckBox;
		Edit1: TEdit;
    begin
    if (Sender is TCheckBox) then
      CheckBox1:= TCheckBox(Sender);
      Edit1:= TEdit(CheckBox1.Parent.FindComponent('Edit'));
    end;

Umm...your not disabling the Edit1 here...

procedure qweClick(Sender: TObject);
    var
		a_CheckBox1: TCheckBox;
		a_Edit1: TEdit;
//I always use a_ for local scope variables...so that their is no ambiguity between variables...
    begin
    if (Sender is TCheckBox) then
    begin
      a_CheckBox1:= TCheckBox(Sender);
      a_Edit1:= TEdit(a_CheckBox1.Parent.FindComponent('Edit'));
      if Assigned(a_Edit1) then
        a_Edit1.Enabled := not a_Checkbox1.checked;
    end;
  end;

Sorry, I was disabling Edit, removed it for some troubleshooting. But I just tried what you posted there and it doesn't work. When it checks to see if a_Edit1 is assigned, the answer is false so it never reaches the code to disable it. For some reason it's not assigning a_Edit1 when using the FindComponent method.

0

Thats because its looking for one called "Edit" ... it is case sensitive other issues can be you may need to check the name you gave it, as well as if checkbox is in a panel and the edit is in another, then the .parent wont be sufficient

0

I posted all my code on the last page.

Edit is named via Edit.Name := 'Edit'; and neither is on a panel. I also assigned CheckBox.Parent := Page.Surface; and Edit.Parent := Page.Surface;
They're also both on the same page.

0


Page := CreateCustomPage(Page.ID, 'ODBC Setup', 'Legacy Applications Require ODBC Connectivity')

CheckBox := TNewCheckBox.Create(Page);
CheckBox.Parent := Page.Surface;

Edit := TEdit.Create(Page);
Edit.Parent := Page.Surface;


[/code]

There you go, I'm trying to use the CheckBox with the OnClick method to disable Edit and Edit2. What am I doing wrong?

k...Here's your problem...

you are using :

a_Checkbox1.Parent.FindComponent('Edit');

it should be...

a_Checkbox1.Owner.FindComponent('Edit');

The Parent is ... Page.Surface
The owner is ....Page...

FindComponent uses the Component list of the Owner to find the component...

0

You, my good friend, are a God among men. It works great now with Owner, I'm disabling all the components I wanted right in the procedure. Everything is find and dandy again!

0

Yeah, thanks for solving! Even tough parent works for me, cause I tested it... this means I could've never solved it. So I thank you very much too!

About another question:
"Created on the fly" means that it wasn't just dragged onto the form in the IDE. When you drag something onto a form in IDE, you'll get valuable shortcuts, so you can write eg. Form1.Edit1.Whatever .
Without these you can create your own shortcuts (this was the list), or query the components as we did.
Of course if that code is not even yours, then for the 1st one, you would have to know that code first, which is a lot of time and work. This is why we did a "less pro" approach. (Well, you did before I replied, so I thought I can solve it without knowing innosetup at all.)

Thanks to everybody for the help!

0

You, my good friend, are a God among men. It works great now with Owner, I'm disabling all the components I wanted right in the procedure. Everything is find and dandy again!

You're welcome

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.