Delphi - 使用 DBGrid 从搜索中选择行
我使用查询搜索了数据库。
搜索结果显示在 DBGrid 组件中,供用户选择她/他希望继续的行。
DBGrid 始终将记录指针设置为结果集中的第一条记录,因此默认情况下始终“选择”一行。我需要将此行为更改为首次呈现数据时不选择任何行,以便我可以确定用户是否确实进行了选择。
是否可以判断是否没有进行选择,即用户没有选择任何行?
非常欢迎任何帮助!
I have searched a database using a query.
The results of the search are displayed in a DBGrid component for the user to select the row s/he wishes to proceed with.
DBGrid always sets the record pointer to the first record in the results set, so a row is always "selected" by default. I need to change this behaviour to no row being selected when the data is first presented so that I can determine if the user has actually made a selection.
Is it possible to tell if no selection has been made, i.e. no row has been selected by the user?
Any help very much welcomed!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将 dgMultiSelect 包含到 DBGrid.Options 中,然后 DBGrid.SelectedRows 将包含显式选择的记录书签的列表。如果没有 dgMultiSelect,DBGrid 将始终跟踪当前数据集记录。
You can include dgMultiSelect into DBGrid.Options, then DBGrid.SelectedRows will contain list of explicitly selected record bookmarks. Without dgMultiSelect the DBGrid always track the current dataset record.