CurrPage.CLOSE

rocatisrocatis Member Posts: 163
edited 2010-08-09 in NAV Three Tier
I know there are some other discussions about CurrPage.CLOSE not working in the OnOpenPage trigger but as far as I can figure out it doesn't work anywhere, except on actions. It seems that CurrPage.UPDATE has the same problem which raises the question if any of the CurrPage commands actually work.

My problem stems from the fact that I need to close a page from code without user intervention. In this example the page should close 2 seconds after being opened. If you remove the CurrPage.CLOSE the page should continually show the current time on the page - it doesn't.

The f.CREATEs are a debug tool to convince me that the code is actually running - which it is.
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??
Brian Rocatis
Senior NAV Developer
Elbek & Vejrup

Comments

  • rocatisrocatis Member Posts: 163
    Kinda limited response to that one...

    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.
    Brian Rocatis
    Senior NAV Developer
    Elbek & Vejrup
  • wakestarwakestar Member Posts: 207
    You'll have to write an AddIn and close the Page through .NET - Code.
    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.
  • rocatisrocatis Member Posts: 163
    wakestar wrote:
    You'll have to write an AddIn and close the Page through .NET - Code.
    You'd still have the problem with code on the page not executing unless it has focus.
    Brian Rocatis
    Senior NAV Developer
    Elbek & Vejrup
  • wakestarwakestar Member Posts: 207
    rocatis wrote:
    wakestar wrote:
    You'll have to write an AddIn and close the Page through .NET - Code.
    You'd still have the problem with code on the page not executing unless it has focus.

    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.
  • rocatisrocatis Member Posts: 163
    wakestar wrote:
    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.
    This sounds exactly like what I'm trying to obtain. Is it something you want to share with me? [-o<
    Brian Rocatis
    Senior NAV Developer
    Elbek & Vejrup
  • wakestarwakestar Member Posts: 207
    I'm not supposed to send you the objects from the solution.
    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
Sign In or Register to comment.