Delphi Tab 键顺序

发布于 2024-12-27 12:13:56 字数 1131 浏览 1 评论 0原文

我的 Delphi 表单(Embarcadero® Delphi® 2010 版本 14.0)中的 Tab 键顺序不正确,这意味着 Tab 键会跳到表单中看似随机的项目。

然而,当我在 Delphi 中更改它时,它会以相同的错误顺序为我重新排列它们!

所以,我决定以编程方式分配它们:(

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;

我尝试向后和向前分配它;它做了同样的事情。)

但这仍然不起作用。消息框每次都会弹出 7 而不是 100。有些东西一直在改变顺序,但这不是我的代码。

为什么会这样,可以解决吗?

这是我的 A2 计算项目

The tab order on my form in Delphi (Embarcadero® Delphi® 2010 Version 14.0) is incorrect, which means the tab key skips to seemingly random items in the form.

However, when I go and change it in Delphi, it rearranges them for me, in the same incorrect 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 assigning it both backwards and forwards; it does the same thing.)

But this still doesn't work. The message box pops up with 7 instead of 100, every time. Something is consistently changing the order, but it's not my code.

Why is this, and is it possible to fix it?

This is for my A2 Computing Project

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

沐歌 2025-01-03 12:13:56

TabOrder 是连续的。第一个控件的 TabOrder0。接下来是 TabOrder1 等等。你不能留下任何间隙。

虽然您可以通过编程方式分配 TabOrder,但我个人发现使用 GUI 来执行此操作最简单。右键单击窗体或容器控件,然后选择“Tab Order”菜单项。然后您将看到如下对话框:

在此处输入图像描述

您可以使用箭头按钮重新排序,或者您只需拖动项目即可重新排序。在我看来,它工作得相当好,但您必须记住,包含其他控件(例如面板、选项卡等)的控件有自己的选项卡顺序。对于此类控件,您需要选择该控件,右键单击,然后修改该容器子级的 Tab 键顺序。

TabOrder is contiguous. The first control has TabOrder of 0. The next has TabOrder of 1 and so on. You cannot leave any gaps.

Whilst you can assign TabOrder programmatically, I personally find it easiest to use the GUI to do so. Right click on the form, or indeed on a container control, and select the Tab Order menu item. Then you will see a dialog like this:

enter image description here

You can use the arrow buttons to re-order, or you can simply drag items to re-order. It works reasonably well in my view but you must remember that controls which contain other controls (e.g. panels, tabsheets etc.) have their own tab order. For such a control you need to select that control, right-click and then modify the tab order for the children of that container.

裂开嘴轻声笑有多痛 2025-01-03 12:13:56

如果我确实理解你的话,CnPack 可以在设计时提供帮助。

下面您可以看到一项功能。当您将组件放入表单中时,CnPack 可以显示 Tab 键顺序。当您进行大量编辑、按钮或面板时,这会很有帮助。
CnPack 在设计模式下显示 TabOrders

另一个功能是“在表单中自动设置 Tab 键顺序”按钮,用于设置 Tab 键顺序使用每个控件的位置来定义其 Tab 键顺序。按下按钮后,请参阅下面相同的表格。
“在表单中自动设置 Tab 键顺序”按钮

我发现它们在设计大型表单时非常有帮助。
另一种选择是 GExperts Tab Order 屏幕,具有相同的“按位置排序”功能:
在此处输入图像描述

If I did understand you well, CnPack can help in design time.

Below you can see one feature. CnPack can show you the Tab Orders as you put the components in form. This can help when you have many edits, buttons or panels.
CnPack Display TabOrders in Designing Mode

Another feature is the button "Auto Set Tab Orders in the Form", that set the Tab Orders using the position of each controls to define it's Tab Order. See below the same form after pressed the button.
"Auto Set Tab Orders in the Form" button

I find them extremely helping when designing big forms.
Another option would be GExperts Tab Order screen that have the same "order by position" feature:
enter image description here

醉态萌生 2025-01-03 12:13:56

我设置 Tab 键顺序的方法是按照您想要的 Tab 键顺序选择每个组件,然后将控件剪切到剪贴板 (CTRL-X),然后粘贴 (CTRL-V< /kbd>) 他们又回来了。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文