OBJECT Page 99999 CurrPage.CLOSE { OBJECT-PROPERTIES { } PROPERTIES { Editable=No; PageType=Card; OnOpenPage=BEGIN f.CREATE('c:\started.txt'); f.CLOSE; CREATE(timer); timer.Interval(2000); timer.Enabled(TRUE); END; } CONTROLS { { 1000000002;0;Container; ContainerType=ContentArea } { 1000000001;1;Group ; GroupType=Group } { 1000000003;2;Field ; SourceExpr=TIME } } CODE { VAR timer@1000000004 : Automation "{3B311C81-140E-11D5-8B18-00D0590B4EC5} 1.0:{3B311C92-140E-11D5-8B18-00D0590B4EC5}:'Navision Timer 1.0'.Timer" WITHEVENTS; f@1000000005 : File; PROCEDURE dostuff@1000000000(); BEGIN f.CREATE('c:\ended.txt'); f.CLOSE; CurrPage.UPDATE(FALSE); CurrPage.CLOSE; END; EVENT timer@1000000004::Timer@1(Milliseconds@1000000000 : Integer); BEGIN timer.Enabled(FALSE); dostuff; timer.Enabled(TRUE); END; EVENT timer@1000000004::TimerError@2(ErrorString@1000000000 : Text[1024]); BEGIN END; BEGIN END. } }Any ideas for workarounds??
Comments
Anyways, I've done some further investigation which has led me to two conclusions:
1) The NavTimer automation does not work on the RTC so don't attempt to use it.
2) A page will not run code unless it has focus.
Seeing as my original problem was to launch a sub process (a page) and have it running independently of the main process (the RTC), the conclusion is that it cannot be done ](*,)
Ideas for workarounds are still welcome - I'm out of ideas.
Senior NAV Developer
Elbek & Vejrup
The AddIn could sit on the Page which you want to close automatically.
In .NET you can access your Page through the Application.OpenForms collection.
Senior NAV Developer
Elbek & Vejrup
I don't experience any "non executing code"... no matter wheter the page has focus or not.
The page I created uses a .NET - Timer (based on Freddy's AddIn-Example) and is in the background most of the time.
The timer looks for a specific txt-File every second and is processed in Navision. The page gets activated and is in the foreground whenever the specific file is created.
Senior NAV Developer
Elbek & Vejrup
I would suggest to start with Freddy's Timer-AddIn-Example and then ask questions here.
http://blogs.msdn.com/b/freddyk/archive ... -page.aspx