1,建一 popup! 类型的窗口,放上你的GIF图片,存储的名称如 w_base_wait ;
2,将下面的代码另存为 n_cst_thread_basewait.sru ,再在你的 pbl 上右键 import... 得到一个名为n_cst_thread_basewait 的 Custom Class ;
$PBExportHeader$n_cst_thread_basewait.sru
$PBExportComments$打开或关闭等待窗口的线程
forward
global type n_cst_thread_basewait from nonvisualobject
end type
end forward
global type n_cst_thread_basewait from nonvisualobject
end type
global n_cst_thread_basewait n_cst_thread_basewait
type prototypes
end prototypes
type variables
end variables
forward prototypes
public function integer of_close_wait ()
public function integer of_open_wait ()
end prototypes
public function integer of_close_wait ();if isvalid(w_base_wait) then close(w_base_wait)
return 0
end function
public function integer of_open_wait ();if not isvalid(w_base_wait) then open(w_base_wait)
return 0
end function
on n_cst_thread_basewait.create
call super::create
TriggerEvent( this, "constructor" )
end on
on n_cst_thread_basewait.destroy
TriggerEvent( this, "destructor" )
call super::destroy
end on
3,在应用里定义一个全局变量 n_cst_thread_basewait gwait 并添加一个名为 of_cthread_wait 的函数,返回integer:
ErrorReturn err
err = SharedObjectRegister( "n_cst_thread_basewait", "nwait")
IF err <> Success! THEN
messagebox('', '注册共享对象失败! ', stopsign!)
return -1
END IF
err = SharedObjectGet( "nwait", gwait)
if err <> Success! then
messagebox('', '从注册的共享对象生成线程失败! ', stopsign)
return -1
end if
SharedObjectUnregister('nwait')
if isvalid(gwait) then
return 0
else
return -1
end if
4,在应用的 open 事件 里写上:of_cthread_wait()
5,在需要打开等待窗口的地方写:gwait.post of_open_wait(), 在需要关闭的地方写:gwait.post of_close_wait()
如:在数据窗口的retrievestart事件中写:gwait.post of_open_wait(),在retrieveend事件中写gwait.post of_close_wait()