OK / Cancel buttons on a page

Rob_HansenRob_Hansen Member Posts: 296
edited 2011-04-28 in NAV Three Tier
Greetings -

In the classic client this one is simple to handle, but I'm not sure how to approach it in the RTC...

I need to open a page with OK and Cancel buttons prompting the user to fill in some lines (so there is an underlying recordset). In the classic client, I use the "IF FORM.RUNMODAL(...) = Action::LookupOK THEN..." and all is fine. When I take the same approach in the RTC though, the form opens up in non-editable mode (like any list would) so the user has to right-click in the lines and select Edit to open an editable version. That's ugly. I've tried adding code to explicitly set EDITABLE to TRUE, but no luck.

In the classic client I could manually create my own form with OK and Cancel buttons with code behind the OK button to set a variable to TRUE (i.e. ClickedOK := TRUE), then I could read that back in my calling function. In the RTC I don't know if I can do the same thing...is it possible to manually define buttons to appear on a Page for OK and Cancel at the bottom?

Help!

Comments

  • freddy.dkfreddy.dk Member, Microsoft Employee Posts: 360
    Could you upload a screenshot of the page, what pagetype is it and you said that you have a sourcetable on the page - how does the code look that sets the record on the page - and where is it?
    Freddy Kristiansen
    Group Program Manager, Client
    Microsoft Dynamics NAV
    http://blogs.msdn.com/freddyk

    The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.
  • jwhitejwhite Member Posts: 1
    Hi,

    Was any solution found for this problem? I am having the same problem where I am running the sales order page modally to allow the user to edit a record and then I do some processing with that record afterwards. I would like to be able to not do the processing if the user clicked cancel, but if I check the modal result the sales order lines show up as readonly (header details can be changed).

    Does anyone know of a way around this problem?
  • deV.chdeV.ch Member Posts: 543
    Don't Use Lookupmode := TRUE because this is for showing the page in a view mode (for looking up data)

    use this isntead:
    CLEAR(SalesOrderPage);
    IF SalesOrderPage.RUNMODAL = ACTION::OK THEN BEGIN
      MESSAGE('pressed ok');
    END;
    
  • johannajohanna Member Posts: 369
    I have tried your solution. But, without LOOKUPMODE(TRUE), the page show in View Mode. Please advise how to show Page in Select Mode? Thank you.
    Best regards,

    Johanna
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Try below logic
    CLEAR(FMSAddInfoList);
          FMSAddInfoList.SetNewDoc("Document No.");
          FMSAddInfoList.SETTABLEVIEW(FMSAddInfo);
          FMSAddInfoList.EDITABLE(TRUE); 
          FMSAddInfoList.LOOKUPMODE(TRUE);
          IF FMSAddInfoList.RUNMODAL = ACTION::LookupOK THEN
    
  • johannajohanna Member Posts: 369
    Thanks Mohana. I have tried :
    CLEAR(FormPostedSI);
    FormPostedSI.SETTABLEVIEW(recSalesInvHeader);
    FormPostedSI.SETRECORD(recSalesInvHeader);
    FormPostedSI.LOOKUPMODE(TRUE);
    IF FormPostedSI.RUNMODAL = ACTION::LookupOK THEN BEGIN
       InvNo := recSalesInvHeader."No.";
    END;
    

    But, the page is shown with Close button only and there are no OK and cancel button. Please advise. Thank you.
    Best regards,

    Johanna
  • johannajohanna Member Posts: 369
    No, I put that code on InvNo.OnLookup :)
    InvNo is variable with data type Code.
    Best regards,

    Johanna
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Is your base page in Editable mode?

    the best example is Chart Of Accounts..

    If we lookup totalling field in COA when it is in View mode, we will have only close button in G/L Account List page.
    If we open COA page in editable mode and click totaling, we will have Ok and Cancle buttons in G/L Account List page.
  • henrikmhenrikm Member, Microsoft Employee Posts: 66
    I have tried this:

    myPage.LOOKUPMODE := true;
    IF myPage.RUNMODAL = ACTION::LookupOK THEN BEGIN
    Message('Ok Clicked');
    END;

    pointing the myPage variable to page 36 (bill of materials) - the Ok / Cancel buttons do show up.

    I added an action on which I added the above code in the OnAction trigger.
    “This posting is provided "AS IS" with no warranties, and confers no rights.”

    Henrik Metzger, Software Development Engineer, Dynamics NAV
    MSFT
Sign In or Register to comment.