Tabstop and TRectangle

894 views Asked by At

I'm have TTabControl with some controls (Delphi XE7 Firemonkey app). All works fine, tabstop too. Now I need to colorize one panel with CheckBox. Add TRectangle to this panel and set parent for CheckBox to this TRectangle. Interface looks fine but now this CheckBox not in the taborder list and not received tabstop command.

How to fix this issue?

How to reproduce: Add to the form TRectangle, add 3 CheckBox, move one CheckBox3 to the TRectangle using Structure panel (set TRectangle as parent for the CheckBox3). Run this application and try navigation using Tab key. You can't navigate to the CheckBox3!

1

There are 1 answers

1
Honza R On BEST ANSWER

You either have to manually set TabOrder to some (reasonable) value because TShape doesn't have it published and is thus set to -1 (which does the same thing as TabStop = False) or doesn't place the TCheckBox in the TRectangle, just place it in front of the TRectangle so it draws over the TRectangle.

Another option is not to use the TRectangle at all and change the style of the TPanel: Right click on the panel in the designer and select Edit Custom Style.... Then select the style newly created for you (something like panel1style: TRectangle) and change Fill property however you need. Click Apply and Close and you're done. By using styles you can create complex looks for any control that may look simple at first. For more information see http://docwiki.embarcadero.com/RADStudio/XE7/en/Customizing_FireMonkey_Applications_with_Styles and related topics.