What you would write an IF_MODE statement in a LANSA function often corresponds to what you write in an event routine in Visual LANSA. For instance, in a LANSA function you would normally delete an item by writing a DELETE statement in the IF_MODE statement testing for the *DELETE mode. In Visual LANSA you would put the DELETE statement in the Click event of the Delete button:
|
Just as the code in the in the IF statement only gets executed when the condition is true, the code in the Click event of the Delete button only gets executed when you click the button.
You will probably find that your programs become simpler when they are event driven because there will be fewer nested control structures as the code is broken down to event routines. Also, it is easy to follow a program when you can see straight away which component and event will cause which action.
In the simplest case, when you convert an existing LANSA function to a Visual LANSA form you can: