Here I am attempting to access one of 3 Overlaid Panels, created on each of 4 tabs of a Page control.
The calling combobox change holds the Panel index, The combobox Tag holds the Required Tab number, The component names indicate the correct tab
The first tab is Called Channel1, and the Tabs are not auto created.
The problem is so that the procedure can access any panel on any tab it need to be able to find it . To illustrate the problem here 'C1ConstPan'
If I hard code the Correct tab Findcomponent works correctly (Commented out here) But SetupTabs.Findcomponent returns nil.
I also tried using SetupTabs.Findcomponet(Channel1) to get the Tab and then use Findcomponent on that to find the panel.
But again the first step returns nil, I guess this is because the Tabs are not components but properties?
Is there any way to do this?
Steve: N.M.N.F.
If something is popular, it must be wrong: Mark Twain
That's just perfectly normal Paranoia everyone in the universe has that: Slartibartfast
The calling combobox change holds the Panel index, The combobox Tag holds the Required Tab number, The component names indicate the correct tab
The first tab is Called Channel1, and the Tabs are not auto created.
The problem is so that the procedure can access any panel on any tab it need to be able to find it . To illustrate the problem here 'C1ConstPan'
If I hard code the Correct tab Findcomponent works correctly (Commented out here) But SetupTabs.Findcomponent returns nil.
I also tried using SetupTabs.Findcomponet(Channel1) to get the Tab and then use Findcomponent on that to find the panel.
But again the first step returns nil, I guess this is because the Tabs are not components but properties?
Is there any way to do this?
Code:
procedure TBattForm.TypeChange(Sender: TObject);
var c: integer;
Comp, Comp1: TComponent;
begin
Comp := nil;
C := (sender as TComboBox).Tag;
case (sender as TComboBox).itemindex of
CONSTANT: begin
// Comp1 := SetupTabs.FindComponent('Channel' + inttostr(C)); // nope returns nil
// Comp := Channel1.FindComponent('C' + inttostr(C)+ 'ConstPan'); // OK
Comp := Setuptabs.FindComponent('C' + inttostr(C)+ 'ConstPan'); // Returns nil
end;
MAINT: begin
// this works but needs the tab name
Comp := Channel1.FindComponent('C' + inttostr(C)+ 'MaintPan');
end;
PULSE: begin
Comp := Channel1.FindComponent('C' + inttostr(C)+ 'PulsePan');
end;
end;
if Comp <> nil then
(Comp as TPanel).BringToFront;
end;
Steve: N.M.N.F.
If something is popular, it must be wrong: Mark Twain
That's just perfectly normal Paranoia everyone in the universe has that: Slartibartfast