PowerBuilder:数据窗口中的复选框
我在数据窗口中有一个复选框,可以选中和取消选中它。 db 中的默认值为 0。选中时,db 值将更新为 1,取消选中时,该值将再次更新为 0。
但是,我只想在数据库值为 0 时更新数据库。如果它已经是 1,那么我不希望用户能够将其更改回 0。所以请告诉我该怎么做? 以下是我的数据窗口中复选框列的代码:
column=(type=decimal(0) update=yes updatewhereclause=yes name=ok dbname="table.ok" values="1/0" )
I have a checkbox in the DataWindow, It can be checked and unchecked. The default value in the db is 0. When it's checked, the db value is updated to 1 and on uncheck, the value is updated to 0 again.
However, I want to update the database only if it has value 0. If it is already 1, then I don't want the user to be able to change it back to 0. So please tell me how can I do that?
Here is the code from my DataWindow for the checkbox column:
column=(type=decimal(0) update=yes updatewhereclause=yes name=ok dbname="table.ok" values="1/0" )
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以保护该复选框以防止取消选中它:在复选框的“常规/保护”字段中:
选中该复选框后,它就会受到保护(您仍然需要将数据更新到基础)。
下次检索时,您可以看到该复选框已受到保护。
您可能必须对
Pointer
使用类似的表达式来显示该字段已被阻止,例如使用NoPointer!
光标。You could protect the checkbox to prevent unchecking it : in the
general / protect
field of your checkbox :Once the checkbox has been checked, it becomes protected (you still have to update the data to the base).
On the next retrieve, you can see that the checkbox is already protected.
You might have to use a similar expression for the
Pointer
to show that the field is blocked, for example with theNoPointer!
cursor.尝试使用:
if(upper(ok) = 'OFF', 1, 0)
或者反过来:
if(upper(ok) = 'ON', 1, 0)
取决于您如何在复选框的属性中设置开/关值。
注意我正在使用 PowerBuilder 2017
try using:
if( upper(ok) = 'OFF', 1, 0)
or the other way around:
if(upper(ok) = 'ON', 1, 0)
depending on how you set the on/off values in the properties of the check box.
Note I'm using PowerBuilder 2017