rebecca
rebecca

Reputation: 113

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

enter image description here

Component Hierarchy

enter image description here

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.

Upvotes: 0

Views: 545

Answers (2)

user12548819
user12548819

Reputation:

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

Upvotes: 1

Tom Brunberg
Tom Brunberg

Reputation: 21045

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 e.g. not move the TEdit with the TRectangle.

enter image description here

Upvotes: 1

Related Questions