是否存在由 ItemIndex 指定的启用数据的单选组组件?
我正在将其中一个表单中的多个组件替换为支持数据的版本,当我的新 TDBRadioGroup 未与分配给它的数字字段链接时,我感到有点惊讶。 事实证明,TDBRadioGroup 的“值”不是存储在 ItemIndex 属性中,而是存储在必须手动填充的 TString 中。 我可以理解这在某些情况下很有用,但是当它仅链接到数字字段时,必须执行以下操作:
for i := 0 to myRadioGroup.Items.Count - 1 do
myRadioGroup.Values.Add(intToStr(i));
有点矫枉过正。 有谁知道启用数据的单选组组件将使用 ItemIndex 作为其值参数?
I'm replacing several components in one of my forms with data-enabled versions, and it was a bit of a surprise when my new TDBRadioGroup didn't link up with the numeric field it was assigned to. Turns out that instead of going by the ItemIndex property, TDBRadioGroup's "value" is stored in a TStrings that you have to populate manually. I can understand that that would be useful in some cases, but when it's just linked to a numeric field, having to do something like this:
for i := 0 to myRadioGroup.Items.Count - 1 do
myRadioGroup.Values.Add(intToStr(i));
is kinda overkill. Does anyone know of a data-enabled radio group component that will use ItemIndex for its value parameter?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以专门化 TDBRadioGroup 并按索引添加值,我建议您覆盖该事件
程序已加载; 覆盖;
You can specialize a TDBRadioGroup and add values By Index, I suggest you override the event
procedure Loaded; override;