2017-04-04 88 views
0

我有这三列的数据窗口对象:返回到默认值的PowerBuilder 11

  • 状态 - 这是一个复选框
  • 标准 - 这是一个dropdownDW
  • 另一

当状态为1(选中),然后criteria.Protect='0'。如果用户从标准列表中选择“另一个标准”,则another.Protect='0'和用户可以写他想要的任何东西。

问题是当用户改变主意并取消选中状态时。 标准和另一列有他以前选择/写入的最后值。如何重置dropdownDW或如何返回默认值?

在itemchange事件中,我有这样的:

choose case dwo.name 
    case "status" 
    if data ='0' then 
     dw_list.modify("criteria.Protect='1'") 
     dw_list.modify("another.Protect='1'") 
    else 
     dw_list.modify("criteria.Protect='0'") 
    end if 

回答

0
String ls_criteriaProtect 
String ls_anotherProtect 

//Save default values: 
ls_criteriaProtect = dw_list.describe("criteria.Protect") 
ls_anotherProtect = dw_list.describe("another.Protect") 

choose case dwo.name 
    case "status" 
    if data ='0' then 
     dw_list.modify("criteria.Protect='1'") 
     dw_list.modify("another.Protect='1'") 
    else 
     dw_list.modify("criteria.Protect='0'") 
    end if 
    case else 

     //Apply initial values: 
     dw_list.modify("criteria.Protect='" + ls_criteriaProtect + "'") 
     dw_list.modify("another.Protect='" + ls_anotherProtect + "'") 
End Choose 
+0

的OP想如果用户取消选中复选框来执行一种回滚。 – Seki

+0

这与“commit”或“rollback”无关......当用户改变主意并取消选中复选框时,OP只想将“criteria”和“another”列中的值重置为默认值。 只需将“this.setItem(row,”criteria“,)”和“this.setItem(row,”another“,)”添加到现有的itemChanged事件中。 –

0

使用在数据窗口对象中的地位列的保护属性的表达式。

喜欢的东西:

case (describe('criteria.protect') when '0' then 1 else 0)