比如说有一个窗体;w_1,它有一个CloseQuery事件,当执行CloseQuery事件时,PowerBuilder会检查Message.RuturnValue的值,若为1,则不能关闭此窗体.
CloseQuery事件的代码如下;
if messagebox("退出窗口","真的要退出吗?",question!,yesno!)<>1 then
message.returnvalue=1
end if
执行时,打开窜体,单击关闭按钮,此时触发CloseQuery事件,执行处理程序,谈除一提示框,如果选"否",则在事件处理程序中设置Message.ReturnValue为1,取消关闭;选"是"就关闭窗体
Processed Boolean A boolean value set in the script for the user-defined event or the Other event. Values are:
?True ?The script processed the event; do not call the default window Proc (DefWindowProc) after the event has been processed.
?False ?(Default) Call DefWindowProc after the event has been processed.
ReturnValue Long When Message.Processed is True, specifies the value you want returned to Windows. This property is ignored when Message.Processed is False.