Delphi Bookmark

The order of the tabs in my form in Delphi (Embarcadero® Delphi 2010 version 14.0) is incorrect, which means that the tab key jumps to the seemingly random elements in the form.

However, when I switch and change it in Delphi, it changes them for me in the same wrong order!

So, I decided to programmatically assign them:

procedure FixDelphiTabOrder; begin Form2.ButtonClear.TabOrder := 2000; Form2.ButtonExport.TabOrder := 1900; Form2.ButtonNew.TabOrder := 1800; Form2.MaxFreq.TabOrder := 1700; Form2.MinFreq.TabOrder := 1600; Form2.Summary.TabOrder := 1500; Form2.Plot6dB.TabOrder := 1400; Form2.Plot3dB.TabOrder := 1300; Form2.Use_dBs.TabOrder := 1200; Form2.PlotPoints.TabOrder := 1100; Form2.PlotPhase.TabOrder := 1000; Form2.Prop8Value.TabOrder := 900; Form2.Prop7Value.TabOrder := 800; Form2.Prop6Value.TabOrder := 700; Form2.Prop5Value.TabOrder := 600; Form2.Prop4Value.TabOrder := 500; Form2.Prop3Value.TabOrder := 400; Form2.Prop2Value.TabOrder := 300; Form2.Prop1Value.TabOrder := 200; Form2.FilterType.TabOrder := 100; ShowMessage(IntToStr(Form2.Prop1Value.TabOrder)); end; 

(I tried to assign it both backward and forward, it does the same.)

But that still doesn't work. A message field appears with 7 instead of 100, each time. Something is constantly changing order, but this is not my code.

Why is this, and can it be fixed?

This is for my A2 Computing project.

+7
source share
3 answers

TabOrder is contiguous. The first control has TabOrder 0 . Next TabOrder 1 , etc. You cannot leave spaces.

While you can programmatically assign TabOrder , it’s personally the easiest way for me to use the graphical interface for this. Right-click on the form or on the container control panel and select the "Order" menu item. Then you will see a dialog similar to this:

enter image description here

You can use the arrow buttons to reorder, or simply drag and drop items to reorder. It works well in my view, but you must remember that controls that contain other controls (such as panels, tables, etc.) have their own tab order. For such control, you need to select this control, right-click and then reorder the tabs for the children of this container.

+20
source

If I understood you well, CnPack might help during development.

Below you can see one function. CnPack can show you the Orders tabs when you add components to the form. This can help when you have many rights, buttons or panels.
CnPack Display TabOrders in Designing Mode

Another feature is the “Automatically set tabs on the form” button, which sets the “Orders” tabs using the position of each control to define its “Tab Order”. See below the same form after clicking a button. "Auto Set Tab Orders in the Form" button

I find them extremely useful in developing large forms. Another option would be GExperts Screen "Order Screen", which has the same function "in order": enter image description here

+11
source

The way I set the tab order is to select each component in the order you want to order on the tab, and then cut the controls to the clipboard ( CTRL-X ) and then paste ( CTRL-V ) back.

+1
source

All Articles