具有VCL样式的默认按钮 [英] Default Button with VCL Styles

查看:67
本文介绍了具有VCL样式的默认按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对具有Default:= True的TButton的样式感到困惑。问题是,至少对于某些样式(例如Luna),最近关注的按钮突出显示为橙色,这与默认按钮使用的样式相同。结果,我担心用户可能对默认的按钮感到困惑,或者至少会认为两个按钮被高亮显示很奇怪。这种行为可以在XE7中看到(并且根据评论,也可以在XE8中看到)。
问题:

I am puzzled by the styling of TButtons that have Default:=True. The issue is that at least with some styles (Luna, for example), the most recently focused button is highlighted orange, which is the same styling used for a default button. As a result, I am concerned that users might be confused as to which button is the default or will at least think it odd that two buttons are highlighted. This behavior can be seen in XE7 (and according to a comment, also in XE8). Questions:


  1. 这是否被认为是一种现代的方式(相对于无样式的VCL)来显示默认按钮?

  2. 如果这不是标准行为,则可以通过策略性地启用/禁用默认按钮来在自己的对话框中解决该问题,但是我想知道我是否错过了一些控制默认按钮与大多数按钮之间关系的设置。 -最近聚焦的按钮。是否有控制此的设置?


推荐答案

我怀疑这是VCL样式的错误。创建使用标准OS主题的默认VCL应用程序。然后添加两个按钮和一个编辑控件。将其中一个按钮设为默认按钮。

I suspect that this is a VCL styles bug. Create a default VCL application that uses the standard OS theme. Then add two buttons and an edit control. Make one of the buttons be the default button.

现在,使用Tab键循环显示焦点。当编辑控件具有焦点时,默认按钮将突出显示。这表示如果您按 ENTER ,则将按下该按钮。

Now use the tab key to cycle round the focus. When the edit control has the focus, the default button is highlighted. That indicates that if you press ENTER then that button will be pressed.

但是,如果两个按钮中的任何一个都有焦点,则具有焦点的按钮会突出显示。这是因为如果在按钮具有焦点时按 ENTER ,则无论是否是默认按钮,都会按焦点按钮。

However, if either of the buttons has the focus, then the button with the focus is highlighted. That's because if you press ENTER when a button has the focus, the focused button is pressed, irrespective of whether it is the default button.

规则如下:


  • 如果按钮具有焦点,则将其突出显示为默认按钮。

  • 如果按钮以外的控件具有焦点,则突出显示默认按钮(如果有)。

因此,这是具有系统主题的XE7中的应用程序外观。非默认按钮具有焦点。

So, here's what the application looks like in XE7 with the system theme. The non-default button has the focus.

请注意,仅突出显示了一个按钮,而不是默认按钮。

Note that only one button is highlighted, and it is not the default button.

这是XE7中具有Luna样式的同一应用程序。

And here is the same application in XE7 with the Luna style.

在这里,我们有默认按钮和带有焦点的按钮,两者被突出显示。我认为这是一个错误,应该报告。

Here we have the default button, and the button with the focus, both being highlighted. I would regard that to be a bug, and it should be reported.

这篇关于具有VCL样式的默认按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆