Mega Code Archive

 
Categories / Delphi / VCL
 

Find (other) controls on a certain page of a TNotebook

Title: Find (other) controls on a certain page of a TNotebook Question: How can I find other/all controls on a certain page of a TNotebook? Answer: Here is how: two different ways -- one to find all controls on a page of a TNotebook -- one to find other controls the a certain on a page of a TNotebook procedure TForm1.CheckBox1Click(Sender: TObject); var b: byte; function GetListOfControlsOnAGivenPageOfATNotebook(NoteBook: TNotebook; memo: TMemo; Page: byte): byte; var w: byte; begin memo.clear; for w := 0 to TPage(Notebook1.Controls[Page]).ControlCount - 1 do with Notebook do memo.Lines.Add ( TPage(Notebook1.Controls[Page]).Controls[w].Name ); result := TPage(Notebook1.Controls[Page]).ControlCount; end; begin //function GetListOfControlsOnAGivenPageOfATNotebook(NoteBook: TNotebook; memo: TMemo; Page: byte): byte; Memo_FoundItems.lines.Add('Number of controls on Page 0 of Notebook Notebook1: ' + inttostr( GetListOfControlsOnAGivenPageOfATNotebook(Notebook1,Memo_FoundItems,0) ) ); {== //here: which other controls than Checkbox1 are on the part. page of Notebook1 Memo_FoundItems.Lines.Clear; for b := 0 to (sender as TCheckbox).Parent.ControlCount - 1 do if (sender as TCheckbox).Parent.Controls[b].Name (sender as TCheckBox).Name then Memo_FoundItems.Lines.Add ( (sender as TCheckbox).Parent.Controls[b].Name ); ==} end;