powerbuilder - 查询 Powerbuilder 以获取某些复选框并输入 text/singelineedit 以获取 showig 消息框
问题描述
我有 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
解决方案
如果选中的任何复选框将阻止在输入文本后显示消息,则: 如果是 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
推荐阅读
- android - 从 Firebase 数据库中检索 Uid
- android - 将项目添加到 RecyclerView 嵌入在主活动的片段中
- javascript - 将更新的值传播到对象中会删除未修改的属性
- php - 下载使用 phpexcel 创建的 excel 时出错
- java - 微服务广播消息
- android - 活动暂停后 ProgressDialog 不更新进度
- python - 如何使用 OpenCV 识别空矩形
- angular - Angular 应用程序在生产中部署 - 获取不同的 cli 版本
- delphi - 如何从 Firemonkey 中的文件加载自定义光标以在 Mac 应用程序上使用?
- c# - 如何在后面的 C# 代码中获取 CSS 样式值?