Options

Page in Foreground?

Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
edited 2011-05-05 in NAV Three Tier
Hi guys!

I've a question for you. To help creation of new customers I created a wizard that creates correctly the customer.
While closing the wizard it launches the customer card page.
The problem is that the card remains behind the RTC.
So I'm wondering if exist a way to specify to open the page in foreground.
Could anyone help me?

Thx in advance guys!
~Rik~
It works as expected... More or Less...

Answers

  • Options
    ara3nara3n Member Posts: 9,255
    I don't think there is in NAV any property to control that, but you could send shortcut keys using windows host scrip automation for ALT+TAB
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    ara3n wrote:
    I don't think there is in NAV any property to control that, but you could send shortcut keys using windows host scrip automation for ALT+TAB
    Ok Ara3n, thx for reply!
    ~Rik~
    It works as expected... More or Less...
  • Options
    Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    Hi guys, the following could be a solution:

    1. Define a function in the wizard that indicates if user have clicked finish. Its boolean return value will be used in the page from which wizard had been launched (CreatedCustomer).
    2. Define a function that gives back the id of customer just created (GetCustomerID)
    3. insert following code in the page that launch wizard, after the wizard call
    IF PageWizard.CreatedCustomer THEN BEGIN
      RecordCustomer.RESET;
      RecordCustomer.GET(PageWizard.GetCustomerID);
      PAGE.RUN(PAGE::"Customer Card",RecordCustomer);
    END;
    
    wizard is closed when card will be opened and it will be showed in Foreground.
    Thx to Ara3n and to my colleague Belias that helps me to solve this problem.
    ~Rik~
    It works as expected... More or Less...
  • Options
    InfoWisslerInfoWissler Member Posts: 10
    I have a similar problem (only in RTC). I would like to open a page at the end of the OnValidate-Trigger of the Sell-To-Customer-No.-Field of the Sales Header-table.

    If no(!) message appears before my page opens, my page appears very shortly and is sent to the background. If a message appears (e.g. "Do you want to change the Sell-To-Customer-No. ?") before my page opens, it stays in the foreground.

    It does not help if I call the function which opens the page in the OnValidate-Trigger of the Sell-To-Customer-No.-Field on the Sales Header-page.
  • Options
    Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    I have a similar problem (only in RTC). I would like to open a page at the end of the OnValidate-Trigger of the Sell-To-Customer-No.-Field of the Sales Header-table.

    If no(!) message appears before my page opens, my page appears very shortly and is sent to the background. If a message appears (e.g. "Do you want to change the Sell-To-Customer-No. ?") before my page opens, it stays in the foreground.

    It does not help if I call the function which opens the page in the OnValidate-Trigger of the Sell-To-Customer-No.-Field on the Sales Header-page.
    could you post function's code used to launch this page?
    ~Rik~
    It works as expected... More or Less...
  • Options
    InfoWisslerInfoWissler Member Posts: 10
    Of course, sorry:
    Bemerkung.SETRANGE("Table Name",Bemerkung."Table Name" :: Customer);
    Bemerkung.SETRANGE("No.","Sell-to Customer No.");
      IF Bemerkung.FIND('-') THEN
        FORM.RUN(FORM::"Comment Sheet",Bemerkung);
    
  • Options
    Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    Of course, sorry:
    Bemerkung.SETRANGE("Table Name",Bemerkung."Table Name" :: Customer);
    Bemerkung.SETRANGE("No.","Sell-to Customer No.");
      IF Bemerkung.FIND('-') THEN
        FORM.RUN(FORM::"Comment Sheet",Bemerkung);
    

    have you already tried to use the runmodal function instead of run?
    ~Rik~
    It works as expected... More or Less...
  • Options
    InfoWisslerInfoWissler Member Posts: 10
    Yes, but it is not possible to use the RUNMODAL function within write transactions.
  • Options
    Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    it's very strange thingh because I made a test now.
    I created a new simple page:
    type: card
    sourcetable: customer
    field: No., Name and Name2
    I put this code in OnValidate of Name2 field
    FORM.RUN(FORM::"Customer Card",Rec);
    
    but it opens page in foreground...
    :-k
    ~Rik~
    It works as expected... More or Less...
  • Options
    InfoWisslerInfoWissler Member Posts: 10
    Thank you for your effort :)

    To reproduce the problem, I think it is important that the Form.RUN is at the end of the Sell-To-Customer-Field of the Sales Header-table, because there are major differences between a Customer-Field/almost-empty page and the Sell-To-Customer-field/Sales Order page.
  • Options
    InfoWisslerInfoWissler Member Posts: 10
    Does anyone have an idea to solve this?
  • Options
    Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    Have you already tried the following?
    (where CommentSheet is a Page variable that has as subtype "Comment Sheet")
    Bemerkung.SETRANGE("Table Name",Bemerkung."Table Name" :: Customer);
    Bemerkung.SETRANGE("No.","Sell-to Customer No.");
    IF Bemerkung.FIND('-') THEN   
      Clear(CommentSheet);
      CommentSheet.run(Bemerkung);
    
    ~Rik~
    It works as expected... More or Less...
  • Options
    InfoWisslerInfoWissler Member Posts: 10
      CommentSheet.run(Bemerkung);
    

    It is not possible to pass arguments while using the RUN function of a form variable.
  • Options
    Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
      CommentSheet.run(Bemerkung);
    

    It is not possible to pass arguments while using the RUN function of a form variable.

    you're right I'm sorry..
    and with this?
    MyPage.SETTABLEVIEW(MyRecord);
    MyPage.SETRECORD(MyRecord);
    MyPage.RUN;
    
    ~Rik~
    It works as expected... More or Less...
  • Options
    InfoWisslerInfoWissler Member Posts: 10
    Nope, still same problem :-k
  • Options
    Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    I tried to create your scenario...
    I put form.run in the trigger onvalidate of the field "Sell-to customer no." in sales order, but the page is opened in foreground... it's very very strange behaviour...
    ~Rik~
    It works as expected... More or Less...
  • Options
    MattKeyesMattKeyes Member Posts: 41
    Same here... I posted the exact same code you did (opening the comment page at the end of the Sell-to Customer No. OnValidate trigger) and it opened in the foreground.

    Are you using 2009 R2? That is what I did my testing in.
  • Options
    Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    MattKeyes wrote:
    Are you using 2009 R2? That is what I did my testing in.
    Me too. :thumbsup:
    ~Rik~
    It works as expected... More or Less...
  • Options
    InfoWisslerInfoWissler Member Posts: 10
    I tested the code on R2 and 2009 SP1.

    Are you sure that you do not have any messages (like "do you really want to change the customer no.?" or "Check Credit Limit") while validating the customer no.? Because only if no message appears while validating the customer no., the page is opened in background, otherwise it works fine.
  • Options
    Troubles_In_ParadiseTroubles_In_Paradise Member Posts: 588
    I tested the code on R2 and 2009 SP1.

    Are you sure that you do not have any messages (like "do you really want to change the customer no.?" or "Check Credit Limit") while validating the customer no.? Because only if no message appears while validating the customer no., the page is opened in background, otherwise it works fine.

    Yes! I've no messages. Only one question... the page that remains in foregroud is launched with .Run or .Runmodal?
    ~Rik~
    It works as expected... More or Less...
  • Options
    MattKeyesMattKeyes Member Posts: 41
    No messages here either.

    One suggestion perhaps is to try this in a CRONUS database (as I did) and then post a link to the fob file to check it out.
Sign In or Register to comment.