What clause do I need to wait until get_Busy() = true ?
Any other way to use a timer ?
Here is a part of my actual code :
Code: Select all
facts - mem_timer mem_timer:(string Action,timerId,string Marque).
clauses
onShow(_Source, _Data) :-
retractFactDb(mem_timer),
%
% Create ActiveX control container and WebBrowser control inside
%
Container = activeXContainer::new(This:getVpiWindow()),
Container:attachListener(browserListener),
Obj=Container:createControl(webBrowser::componentClassID,Rct,idc_browser),
if not(Obj=uncheckedConvert(iOleObject_native,null)) then
_=Obj:queryInterface(iWebBrowser2_native::iid,IUnk),
IDisp=uncheckedConvert(iWebBrowser2_native,IUnk),
browser := iWebBrowser2_import::new(IDisp),
HomePage = "http://www.my_site.fr",
browser:navigate(HomePage,comDomains::unsigned(0x0),comDomains::null,comDomains::null,comDomains::null),
Id = timerSet(10),
assertz(mem_timer("end navigate",Id,"my_site"))
end if
.
predicates
onTimer : window::timerListener.
clauses
onTimer(_Source, TimerId):-
timerKill(TimerId),
mem_timer(Action,TimerId,Marque),
retractall(mem_timer(Action,TimerId,Marque)),
if Action = "end navigate" and Marque = "my_site" then
OQP = browser:get_Busy(),
if OQP = true() then
NewId = timerSet(50),
assertz(mem_timer(Action,NewId,Marque))
else
programControl::sleep(1000),
traiter(Marque)
end if
end if,
!.