Run form on opening a form

ROBOROBO Member Posts: 39
I've got the following question i've got a form with buttons on it that opens other forms with multiple filters. Is there a posibility that when i klik the button and then close the "main" form the 2 form starts up the next time i open the "main" form with the same filters? And when i go to another "relation" the filters apply to that relation?

ThanX

Comments

  • krikikriki Member, Moderator Posts: 9,118
    ROBO wrote:
    I've got the following question i've got a form with buttons on it that opens other forms with multiple filters. Is there a posibility that when i klik the button and then close the "main" form the 2 form starts up the next time i open the "main" form with the same filters?
    The only thing I can think of is using subforms.
    ROBO wrote:
    And when i go to another "relation" the filters apply to that relation?
    For this you can use property "RunFormLinkType"=OnUpdate on the button.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • ROBOROBO Member Posts: 39
    Is there a possibilty that I can run a button when I open a form(simulate a click)
  • krikikriki Member, Moderator Posts: 9,118
    Put the code behind the button in a function.
    In the "OnOpenForm"-trigger, run that function.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • ROBOROBO Member Posts: 39
    Can you help me with the code?
  • krikikriki Member, Moderator Posts: 9,118
    ROBO wrote:
    Can you help me with the code?
    BTW : if you use code, your second form will not be updated when in the first you change record (property "RunFormLinkType"=OnUpdate is not used because you run the form by code)
    Function MyButtonOnClick:
      MyRecord.RESET;
      MyRecord.SETCURRENTKEY(...);
      MyRecord.SETRANGE(...);
      FORM.RUN(0,MyRecord); // or FORM.RUN(FORM::"My Form",MyRecord);
    END;
    

    OnOpenForm:
    MyButtonOnClick();
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • ROBOROBO Member Posts: 39
    It is not quit what i mean. I've got a few buttons on my form. Can I push one of the the buttons by a code on a form start?


    ThanX
  • DenSterDenSter Member Posts: 8,307
    No you cannot 'push buttons' in C/AL code. You CAN however, put the click code inside a function, and call the function in the OnPush trigger of the button. Then you can add a call to the function in the OnOpen trigger, and you will have the same result. All that the button does is run the function, you add the function call to OnOpen, and it does the same thing.

    My guess though is that you don't have the C/AL editor in your license?
  • ROBOROBO Member Posts: 39
    This had solved the "problem": http://www.mibuso.com/forum/viewtopic.p ... highlight=

    ThanX all for your help
Sign In or Register to comment.