执行代码顺序的问题!!

nainai 2003-03-04 12:04:18
....

open(w_window)
if flag='ok then
....
end if

.....


flag 是一个全局变量,在w_window中赋值为'ok'了,并以关闭,可if 语句老是不执行,请问各位大侠,怎么回事阿?
...全文
91 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
ddsbpu 2003-03-07
  • 打赏
  • 举报
回复
问题是你的w_window窗口不是response类型,当你执行open(w_window)语句后,if语句会跟着执行,这时你的flag变量还不等于'ok',所以窗口不会关闭,并不是if语句不执行。如果你把w_window窗口的窗口类型设为response,这时if语句就要到w_window窗口关闭后才执行。这也就是模式窗口和非模式窗口的区别了,response就是一种模式窗口。
nainai 2003-03-07
  • 打赏
  • 举报
回复
说的好啊!主要就是想在多个窗口间共用变量。请问还有什么可供参考的没有啊!
fibbery 2003-03-05
  • 打赏
  • 举报
回复
还是换换思路吧!程序要有个好的结构。
response固然解决问题,关键在于搂住想实现什么!
nainai 2003-03-04
  • 打赏
  • 举报
回复
高手
ice2water 2003-03-04
  • 打赏
  • 举报
回复
将w_window的类型改为Response,
此外,flag一般不用全局变量,使用CloseWithReturn()
This statement closes the response window w_employee_response, returning the string emp_name to the window that opened it:

CloseWithReturn(Parent, "emp_name")

Suppose that a menu item opens one window if the user is a novice and another window if the user is experienced. The menu item displays a response window called w_signon to prompt for the user's experience level. The user types an experience level in the SingleLineEdit control sle_signon_id. The OK button in the response window passes the text in sle_signon_id back to the menu item script. The menu item script checks the StringParm property of the Message object and opens the desired window.

The script for the Clicked event of the OK button in the w_signon response window is a single line:

CloseWithReturn(Parent, sle_signon_id.Text)

The script for the menu item is:

string ls_userlevel

// Open the response window
Open(w_signon)
// Check text returned in Message object
ls_userlevel = Message.StringParm
IF ls_userlevel = "Novice" THEN

Open(win_novice)

ELSE
Open(win_advanced)

END IF
pingjeff 2003-03-04
  • 打赏
  • 举报
回复
同意上面的用法,
chengjian 2003-03-04
  • 打赏
  • 举报
回复
同意!

1,079

社区成员

发帖
与我相关
我的任务
社区描述
PowerBuilder 相关问题讨论
社区管理员
  • 基础类社区
  • WorldMobile
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧