anchor a grid to a specific tab of a page control

anchor a grid to a specific tab of a page control

Post by Adam Sandl » Fri, 26 Aug 2005 00:44:02


I didn't mean to cross post, I just read the descriptions of the groups
an realized I posted to a group where the only new activity is mostly
spam...

I tried to search for help using the phrase anchor grid to tab and
couldn't find anything. I'm new to Delphi and I have question
about GUI layout. I have a form with a page control on it. In the
page control there's two tabs. Each tab will have unique information
displayed; that's why I wanted to separate tabs. At any rate, I want
a grid to be displayed on the first tab and I want it on the first tab
only. However, when I compile, the grid appears on both the first and
the second tab. Things like combo boxes or buttons don't do this.
If I place a button on a given tab, it's only visible when that tab
has focus. But the darn grid appears on all the tabs. I cannot find a
property to anchor the grid to a specific tab. Is there one? Is there
a way to fix this?

Thanks!
 
 
 

anchor a grid to a specific tab of a page control

Post by Rob Kenned » Fri, 26 Aug 2005 01:31:49


You must have erred when placing the grid on the page control. For each
tab of the page control, there is a TTabSheet object. It's the tab sheet
that needs to be the parent of your grid. You placed the button and the
combo box on the sheet, but perhaps you placed the grid on the form
itself, and because of Z-order it only _appears_ to be on the page control.

Cut the grid (Ctrl+X), switch to the tab you want, and then click
somwhere in the middle of the page control. The resize handles should be
positioned around the inside of the page, indicating that the TTabSheet
is selected and not the TPageControl. Paste the grid there (Ctrl+V).

Another way of selecting the tab sheet (besides clicking on it) is to
find it in the combo box at the top of the Object Inspector. If you have
the right Delphi version, you can also select it via the Structure View.

--
Rob

 
 
 

anchor a grid to a specific tab of a page control

Post by Adam Sandl » Fri, 26 Aug 2005 05:41:12

Rob... you suspicions were right... I probably couldn't duplicate it
but there must have been a problem with putting the grid on the page
control. It's just that since it was the first time I every tried
using these VCL components I incorrectly assumed there was a problem
with the component. Thanks for your help!