First coding - First Problem - RTC Newbie

MauddibMauddib Member Posts: 269
edited 2014-03-20 in NAV Three Tier
So finally getting to code on RTC in my company as the company have finally ok'ed my project to upgrade our system from classic to RTC.

Programming my first pages today. All very exciting. For me anyway. I know some of you have been at this 5 years :)

Quick question - for my education as much as for solving a requirement in my company. On an old style list form it was possible to put code on a button, set the button to be the "default" button for the form, and then if you DOUBLE CLICKED a line in the list the code behind that button would run.

Can similar be done in RTC? I tried creating an ACTION and putting code on it. I then set the ShortCutKey for that action to "Return". But when I double click OR press the ENTER key the code in my OnAction does not run. Here is my VERY simple page I created to demonstrate an example:
OBJECT Page 50002 Test Default 1
{
  OBJECT-PROPERTIES
  {
    Date=19.03.14;
    Time=17:28:43;
    Modified=Yes;
    Version List=;
  }
  PROPERTIES
  {
    SourceTable=Table27;
    PageType=List;
    ActionList=ACTIONS
    {
      { 1000000003;  ;Action    ;
                      Name=<Action1000000003>;
                      ShortCutKey=Return;
                      CaptionML=ENU=My First TEST;
                      OnAction=BEGIN
                                 MESSAGE(Description);
                               END;
                                }
    }
  }
  CONTROLS
  {
    { 1000000000;0;Container;
                ContainerType=ContentArea }

    { 1000000001;1;Group  ;
                Name=Group;
                GroupType=Repeater }

    { 1000000002;2;Field  ;
                SourceExpr="No." }

  }
  CODE
  {

    BEGIN
    END.
  }
}

Comments

  • MauddibMauddib Member Posts: 269
    It is always you that comes to my rescue - even after all this time :)

    However is that not exactly what I tried? I do not see what I am doing different to you - but it is definitely not working for me. Double clicking on the lines when my action is set to "Return" does nothing.
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    Please add "Item Card" in CardPageID property of page and try..

    Don't forget to set Editable property of List page to No.
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    If the required action is to open the card, then do like Mohana suggests. This is the default behaviour in Dynamics NAV. The return property is to create exceptions.
  • suraj92291suraj92291 Member Posts: 49
    It's done,Try this
    OBJECT Page 50002 Test Default 1 Sam
    {
      OBJECT-PROPERTIES
      {
        Date=20/03/14;
        Time=[ 4:08:59 PM];
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
        Editable=No;
        SourceTable=Table27;
        PageType=List;
        ActionList=ACTIONS
        {
          { 1000000004;  ;ActionContainer;
                          ActionContainerType=NewDocumentItems }
          { 1000000005;1 ;ActionGroup }
          { 1000000006;2 ;Action    ;
                          Name=<Action1000000003>;
                          ShortCutKey=Return;
                          CaptionML=ENU=My First TEST;
                          Promoted=Yes;
                          OnAction=BEGIN
                                     MESSAGE(Description);
                                   END;
                                    }
        }
      }
      CONTROLS
      {
        { 1000000000;0;Container;
                    ContainerType=ContentArea }
    
        { 1000000001;1;Group  ;
                    Name=Group;
                    GroupType=Repeater }
    
        { 1000000002;2;Field  ;
                    SourceExpr="No." }
    
      }
      CODE
      {
    
        BEGIN
        END.
      }
    }
    
    
    

    Regards,
    Suraj
    “Any fool can know. The point is to understand.”
    ― Albert Einstein
  • MauddibMauddib Member Posts: 269
    Thanks guys. The goal was not to open the Item Card - but to have a table of dynamic records of our objects (Codeunits, XMLPorts, Reports) so I can "Per Company" define a report/export list that users can run in our database. The goal is to have a list form of objects the user can run, which we can edit dynamically and per company, and when the user Double Clicks one it runs automatically.

    The code solution above works perfectly when I import it. Strangely it does not work when I try to manually reproduce it myself in my own form, rather than simply importing the code above. So I must be doing something wrong. But I trust I will find my error. My guess is it has something to do with how I am putting the Actions in the group and in the container or something like this.

    But since the above was just a "proof of concept" for an internal requirement, this is enough for now.

    So thanks muchly for the help all. I will try not to bother you TOO often with these newbie questions.
  • DenSterDenSter Member Posts: 8,307
    Mauddib wrote:
    I will try not to bother you TOO often with these newbie questions.
    Come back and ask exactly as many questions as you want/need :mrgreen:
  • I just love the NAV community:)
    This posting is provided "AS IS" with no warranties, and confers no rights.
Sign In or Register to comment.