Coordinate TTreeview with TPageControl lazarus / 31-LCL ---------------------------------------------------------------------- mcwbr · 2022-08-29 14:13 I am missing something incredibly simple here: What's the best way to coordinate a TTreeview with a TPageControl such that the currently selected item in the tree activates a page on the page control? Thanks in advance. Pity there's not an emoji of Homer doing the Doh! slap, 'cause I'm going to need it. ---------------------------------------------------------------------- dsiders · 2022-08-29 14:50 Quote from: mcwbr on August 29, 2022, 04:13:09 pmI am missing something incredibly simple here: What's the best way to coordinate a TTreeview with a TPageControl such that the currently selected item in the tree activates a page on the page control? Thanks in advance. Pity there's not an emoji of Homer doing the Doh! slap, 'cause I'm going to need it. The simplest thing that works... Create a TTreeView.OnSelectionChanged event handler to select the tabsheet in the page control. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.TreeView1SelectionChanged(Sender: TObject);begin  if TreeView1.SelectionCount <> 0 then    PageControl1.PageIndex := TreeView1.Selected.Index;end; ---------------------------------------------------------------------- mcwbr · 2022-08-29 15:31 Doh! Thanks for the fast reply. This is just what I need. ---------------------------------------------------------------------- mcwbr · 2022-08-30 11:58 Index is parent-based, restarting at zero as you descend the tree. Use SelectedIndex to arbitrarily map TreeView items to pages (or whatever). Not only is Lazarus fantastic, but the community is even better. Thanks to dsider's fast response, my numberless paperclips will take over the universe!!! I think this can be closed.