如何将数据窗口对象中的计算字段设为只读
我有一个数据窗口对象,在其中我从数据库中获取一些属性以将其显示给用户。我想将计算字段设为只读,以便用户无法修改它们。
如何将计算字段设置为只读?
I hava a data window object, in which I am fetching some attributes from the database to show it to the users. I want to make the computed fields read-only, so that the user can not modify them.
How can I make a computed field read-only?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您是否尝试过将其制表符序列设置为 0?
Have you tried setting their tabsequence to 0?
如果您使用的是 Edit 或 EditMask,则可以分别设置 DisplayOnly 或 ReadOnly 属性。请注意,尽管 PB 文档声称 ReadOnly 仅对旋转控件有效,但无论是否启用旋转它都有效。您还可以将整个数据窗口设置为只读。来自 PowerScript:
dw_control.Object.DataWindow.ReadOnly='yes'
。If you're using an Edit or an EditMask you can set the DisplayOnly or ReadOnly property, respectively. Note that although the PB docs claim that ReadOnly only is only valid for spin controls, it works whether or not spin is enabled. You can also set the entire DataWindow ReadOnly. From PowerScript:
dw_control.Object.DataWindow.ReadOnly='yes'
.如果您引用计算列(数据窗口中来自数据源 [例如 SQL] 的列,其中该列是计算值),则将 Protect 属性设置为 1。如果需要根据条件设置也可以使用表达式。
如果您指的是计算字段(数据窗口绘制器中添加的数据窗口上的字段,由 PowerBuilder 表达式而不是数据源驱动),那么您不必执行任何特殊操作,因为我相信计算字段是只读的。
If you are referring to a computed column (a column in a datawindow that comes from a data source [such as SQL] where a the column is a calculated value) then set the Protect property to 1. You can also use expressions if you need to set it based on conditions.
If you are referring to a computed field (a field on a datawindow added in the datawindow painter that is driven by a PowerBuilder expression rather than the data source) then you shouldn't have to do anything special as I believe computed fields are read-only.