[ 파워빌더.Window - Timer ]

 

☞   

  Timer는 Window에 있는 기능이죠.

X초가 지나면 Timer 이벤트를 실행시켜라..

API로도 있죠. 1/1000초 단위로 컨트롤 해주는.
FUNCTION ULONG SetTimer(long hwnd, ULONG nIDEvent, ULONG elapse, long zero) LIBRARY "USER32.DLL"FUNCTION BOOLEAN KillTimer(long hwnd, ULONG nIDEvent) LIBRARY "USER32.DLL"

그리고 또.. Object Timing이 있습니다.
Window에 있는 Timer랑 동일합니다.

1개를 생성해보겠습니다.
=============================================================================
forward
global type n_timing from timing
end type
end forward

global type n_timing from timing
event ue_setparent ( readonly powerobject apo_parent,  readonly string as_event )
end type
global n_timing n_timing

type variables
Protected:

powerobject ipo
string is_event
end variables

event ue_setparent(readonly powerobject apo_parent, readonly string as_event);/*-------------------------------------------------------
오브젝트명  : n_timing
이  벤  트  : ue_setParent
비      고  : 2007.07.29  By JH
-------------------------------------------------------*/
ipo = apo_parent
is_event = as_event
end event

on n_timing.create
call super::create
TriggerEvent( this, "constructor" )
end on

on n_timing.destroy
TriggerEvent( this, "destructor" )
call super::destroy
end on

event timer;/*-------------------------------------------------------
오브젝트명  : n_timing
이  벤  트  : Timer
비      고  : 2007.07.29  By JH
-------------------------------------------------------*/
IF ISVALID(ipo) THEN
ipo.TriggerEvent(is_event)
END IF
end event
=============================================================================

Timing Object 를 상속받는 n_timing Object이죠.

n_timer.Start(Integer Num) : Num 초 주기로 Timer를 발생시킨다.
n_timer.Stop() : Timer 구동 중지
n_timer.ue_setparent(Object, Event ID) : 정해진 시간 이후에 Object의 Event를 호출한다.

Non-Visual Object 이기 때문에 Object내에서 사용하시려면
Instance로 사용하셔야 합니다.

PB 특성상 Event 또는 Function이 끝나면 그 안에 선언된 변수 메모리는 반환(자동 소멸)되니까요.

수고하세요

 

Posted by 농부지기
,