简体   繁体   中英

How to set tab order in embedded frames? (C++ FMX, C++ Builder)

I am trying to set the tab order for fields that are in frames within the main form, however, the edit boxes are never activated. The only time I can activate the top edit field is when I use the SetFocus function. What am I missing?

Relevant code

__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
    Frame31->Edit1->TabOrder = 0;
    Frame21->Rectangle1->TabOrder = 1;
    Frame22->Rectangle1->TabOrder = 2;
    Button1->TabOrder = 3;
}

App screenshot with labels

在此处输入图像描述

Component Hierarchy

在此处输入图像描述

Reference

http://docwiki.embarcadero.com/Libraries/Rio/en/FMX.Controls.TControl.TabOrder

Edit

Updated question to reflect design of application; included component hierarchy image and updated labels in application screenshot.

The TabOrder works per parent. The form is the parent of the frames and the button. So, set

Frame31->Taborder = 0;
Frame21->Taborder = 1;
Frame22->Taborder = 2;
Button1->TabOrder = 3;

All TEdit controls have separate parents, and can therefore be left with the default

TabOrder = 1;`.
TabStop = True;

If there would have been more than one TEdit (or other controls) on any of the frames, then the TabOrder between those controls would have to be specified.


Edit

I must appologize for the TabStop = False for the frames. It has no effect in this scenario. So just leave them as the default True

I can confirm, that when you have a TRectangle as parent to the TEdit , then the TEdit will not be tabbed to. I can not explain why this is so, and I did not immediately find anything about that on Embarcaderos quality reporting system.

Perhaps you can remove the rectangles, alternatively rearrange the TEdit to be a child of the TFrame directly and just place it over the TRectangle so it visually looks like it would be a part of the TRectangle . The downside of this would be that you could eg not move the TEdit with the TRectangle .

在此处输入图像描述

I am a little late but I had the same problem. The solution is to set the Rectangle's unpublished TabOrder property to 0.

All the best,

Aggie85

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM