在 DevExpress 中量子网格,如何将带有复选框的单元格的单击区域限制为实际复选框,而不是整个单元格
我使用 Delphi (2010) 和 DevExpress Quantum Grid (v. 6.52)
当我有一个带有复选框编辑器的 TcxGridColumn 时,当用户单击单元格内的任意位置时,复选框会切换。我想限制这一点,以便用户必须单击实际的复选框。
有没有简单的方法可以做到这一点?我们的应用程序中有大量的网格,其中许多带有复选框编辑器,所以我希望有一个“神奇”的小技巧来为我做到这一点。我不想为我们应用程序中的每个网格编写自定义代码:-/
I use Delphi (2010) and a DevExpress Quantum Grid (v. 6.52)
When I have a TcxGridColumn with a CheckBox editor, the checkbox toggles when the user clicks anywhere within the cell. I want to restrict this so that the user has to click on the actual checkbox.
Is there an easy way to do this? We have an enormous amount of grids in our application, many with checkbox editors, so I'm hoping for a "magic" little trick to do this for me. I would hate to write custom code for every grid in our application :-/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您(或您的客户)希望在单击单元格时复选框不会立即更改,那么将
ImmediatePost
属性设置为false
可能会有所帮助。If you (or your customers) want that the checkbox doesn't change immediately if you click in the cell, then it could help if you set the
ImmediatePost
property tofalse
.也许不是您正在寻找的确切答案,但也许它满足您客户的要求。
对于 cxGrid 中的每个单元格,您可以打开或关闭 ImmediateEditor 属性。此属性确定在单击适当的单元格后是否立即激活特定的列编辑器。
来自 cxGrid 版本 6 的帮助文件:
property ImmediateEditor: Boolean;
描述
使用 ImmediateEditor 属性来确定当用户单击适当的单元格时是否激活特定的列编辑器。如果此属性值为 False,则当焦点位于特定单元格内时按 Enter 键即可激活网格单元格编辑器。
Maybe not the exact answer you are looking for, but perhaps it satisfies your customers request.
For each cell in your cxGrid you can switch on or off the ImmediateEditor property. This property determines whether a specific column editor is activated immediately after an appropriate cell is clicked.
From the help file for cxGrid version 6:
property ImmediateEditor: Boolean;
Description
Use the ImmediateEditor property to determine whether a specific column editor is activated when a user clicks an appropriate cell. If this property value is False, then the grid cell editor is activated by pressing the Enter key when focus is located within a specific cell.
我向 DevExpress 发送了同样的问题作为支持请求,我得到了这样的答案:
“Hello Svein。
感谢您的消息。您可以使用 GridView 的 OnMouseDown 事件处理程序实现所需的结果并在那里检查命中信息。
随附的示例显示了如何执行此任务。请尝试这个解决方案,并让我们知道您的结果。”
测试项目有一个带有复选框列的简单网格。GridView 的 OnMouseUp 事件具有以下代码:
不幸的是,由于 MouseUp 事件位于网格上,而不是列,我无法为我的复选框列创建存储库项目,但至少现在我知道一种方法来做到这一点。
I sent the same question as a support request to DevExpress, and I got this answer:
"Hello Svein.
Thank you for your message. You can achieve the desired result using the GridView's OnMouseDown event handler and checking the hit information there.
Attached is an example that shows how to perform this task. Please try this solution, and let us know your results."
The test project had a simple grid with a checkbox column. The GridView's OnMouseUp-event had the following code:
Unfortunately, since the MouseUp-event was on the grid, rather than the column, I can't make a repository-item for my checkbox-columns, but at least now I know a way to do it.