925 new features in WINDEV, WEBDEV and WINDEV Mobile 2025
247 N e w f e a t u r e W D W B WM A POWERFUL CONCEPT Reactive Procedures are used to automatically trigger the execution of processes. A Reactive Procedure is executed when a variable or the value or content of a control used in the procedure is modified, either by the end user or programmatically. The Reactive Procedure constantly "observes" the variables and controls to detect value changes, and in this case, it is automatically executed. Key takeaway: The procedure is automatically executed when a variable or a control changes. Benefit of this new feature in version 2025: You'll love it 248 N e w f e a t u r e W D W B WM WHERE TO USE IT? HERE’S A SIMPLE EXAMPLE Why create a Reactive Procedure? Because it’s really practical. Here’s a simple example: Entering an amount before and after tax. When an amount is entered in a control, the other controls update automatically. Of course, you could write this operation in WLanguage, directly in each control. In that case, you would need to create a procedure that performs the calculation, and include a call to this procedure in the Modifi- cation process of each of the 3 controls. With a Reactive Procedure, you can simply write the calculation process... and that's all there is to it. It’s a simple comparison, but with 5 or more controls, code is sig- nificantly simplified and modification errors are eliminated. Now, how to handle a change of value in one of the Edit controls programmatically? With a Reactive Procedure, there's nothing to program. The proce- dure will be automatically executed. There’s no risk of forgetting. Benefit of this new feature in version 2025: Avoids code sprawl 249 N e w f e a t u r e W D W B WM UNIQUE AND CENTRALIZED CODE The main advantage of this method is that the framework takes care of “observing” for changes in control values. There's no need to write the calls in every control where changes can be made. This results in minimal resource consumption, because the frame- work takes care of everything in an optimized way. The control (or variable) automatically signals its change of value to the Reactive Procedure. This simple and clear code of Reactive Procedures makes it possi- ble to "observe" and update several different controls and variables. Benefit of this new feature in version 2025: Code in one place 250 N e w f e a t u r e W D W B WM HOW TO DECLARE A REACTIVE PROCEDURE The Reactive keyword indicates that the procedure must observe the variables and controls used in its code. The keyword also tells the procedure to execute if any change is detected. REACTIVE PROCEDURE CalculateTotal () A Reactive Procedure can be global (and therefore permanently reactive), local to a window or local to a control. Benefit of this new feature in version 2025: You decide the scope REACTIVE PROCEDURE AUTOMATICALLY EXECUTED WHEN A CONTROL OR VARIABLE IS MODIFIED N e w f e a t u r e s i n W I ND E V 2 0 2 5 WE B D E V 2 0 2 5 W I ND E V Mo b i l e 2 0 2 5 & W I ND E V S u i t e S a a S 50
Made with FlippingBook
RkJQdWJsaXNoZXIy NDQ0OA==