Run a form using OnPush trigger of a CommandButton

Hi all!!

Once again I turn to your help in the search for some answers.

In a simple way this is what I need: 1) push a command button on a form that will run another form passing to it the displayed data; 2) make some changes and validate them and push a menu button (this menu button allows me to either print the data or simply “register” it); and, 3) return to the first form.

I have already solved the first 2 points: either Form.RUN and Form.RUNMODAL seems to work for me. The 3rd one seems a little bit more complicated because I can’t go back to the previous form.

This is the code in the OnPush trigger of the command button:

IF CONFIRM(Question, TRUE) THEN BEGIN



COMMIT;

rec_TableName := Rec;
rec_TableName.SETRECFILTER();
Form.SETTABLEVIEW(rec_TableName);
Form.RUN;
//Form.RUNMODAL; this seems to work as well
END;

Thaks for your precious help. [Y]

ZP.

So you have two forms FormA and FormB

FormA have a command button E.G(Button1)

FormB also Have Menu Button E.G(Menu Button)

while clicking button1 FormB will be open with same record and you are doing some changes at FormB.

Now come to your 3rd point

Clicking the any of the menu item of menu Button of FormB

FormB should be Closed ?

or

FormA should get the changed values ?

Give us the clear details

Thanks
marshal.J

FormB should be closed and return to FormA.

It is not necessary to display the changed values in FormA.

Thank you.

Hi

Place the following code at the end of each menu item of Menu Button of FormB

CurrForm.CLOSE;

Thanks

Jerome Marshal.J

Hi Jose,

This silly code might work:

FormB.SetValue(g_Var);

IF FormB.RUNMODAL=ACTION::Close THEN BEGIN

FormB.GetValue(g_VAR);

END;

in FormB you create 2 Function to set and get the value. Before you run the FormB you pass the value through SetValue function. Do what ever you want to do for g_Var in FormB. After user close (ACTION::Close) the form, you call GetValue function to get a modified value from B.

Maybe there is a better solution for this…

Regards,

-TR-

Hi Jose,

Try to run again the first form in the OnCloseForm Trigger of the second form…

Thanks