我有3个复选框和1个输入文本。
如果我单击复选框,然后在输入文本中输入一些文本,那么我不希望出现该消息框。
如果我未单击复选框,但输入了文字,则消息框应显示。
我的问题是“如何在Powerbuilder中做到这一点?”
这是我的代码:
if Not IsNull(f_na) or Not IsNull(f_dep) or Not IsNull(f_krd) and IsNull (c_ao) then
messagebox ('Perhatian','Kode AO baru harus diisi')
return
end if
答案 0 :(得分:0)
如果选中任何复选框将阻止在输入文本后显示消息,则:
如果是SingleLineEdit或MultiLineEdit控件,则在文本控件的modified
事件处理程序中(即SingleLineEdit控件):
String ls_EditControlText
ls_EditControlText = this.Text
// If the text is not empty, and none of the checkboxes are checked, then
// show a message and clear the input
IF NOT IsNull(ls_EditControlText) AND (ls_EditControlText <> "") THEN
// f_na, f_dep, and f_krd are the Checkbox controls
IF NOT (f_na.Checked OR f_dep.Checked OR f_krd.Checked) THEN
MessageBox("Attention", "A new AO code must be filled in")
this.Text = "" // clear the input
END IF
END IF
RETURN
对于DataWindow上的Edit或EditMask控件,您可以使用itemchanged
事件处理程序作为DataWindow控件:
String ls_EditControlText
ls_EditControlText = data
// If the text is not empty, and none of the checkboxes are checked, then
// show a message and clear the input
IF NOT IsNull(ls_EditControlText) AND (ls_EditControlText <> "") THEN
// f_na, f_dep, and f_krd are the Checkbox controls
IF NOT (f_na.Checked OR f_dep.Checked OR f_krd.Checked) THEN
MessageBox("Attention", "A new AO code must be filled in")
RETURN 2 // Reject the text input data but allow focus to change
END IF
END IF
RETURN 0