Step 2. Understanding Events

1.  Drag field STD_DESCL onto the web page in row 1, column 1.

a.  On the Layout ribbon, change Alignment to Top Left and Flow to Down.

b.  Change margin Left to 20 and margin Top to 20.

c.  On the Details tab, set up the field's properties as follows:

Property

Value

CaptionType

Caption

Caption

Display the Results

Width

500

 

2.  Change the properties of the first field, STD_TEXT, as follows:

Property

Value

Caption

Enter some text

 

     At the moment your design should look like the following:

3.  Save your web page.

4.  Select the first field STD_TEXT and create a Changed event for it. You can do this using the Events tab on the Details tab, or using the context menu on the field and selecting Events : STD_TEXT / Changed. Note that in this case the Source tab will open with the editor positioned at the new event.

5.  With the STD_TEXT field selected, press F2. Alternatively use the context menu and select Field : STD_TEXT / Features.

     The Features tab shows the properties, events and methods for the selected component, in this case the field STD_TEXT.

6.  Click on the Features tab toolbar Views button on the toolbar and select the Category View:

     Note this view groups the components features, as shown below:

7.  Expand the Intrinsics for this type of field. Scroll down and note that there is an UpperCase method.

8.  Double-click on UpperCase to see the Help displayed in your default browser.

 

9.  Add the following code to the STD_TEXT.Changed event:

Evtroutine Handling(#STD_TEXT.Changed)

#STD_DESCL := #STD_TEXT.UpperCase

Endroutine

 

10. Change the ASSIGN statement in the CLEAR.Click event to include the field STD_DESCL.
#STD_TEXT #STD_DESCL := *blanks

11. Recompile and test your web page. It should now look like the following:

     Observe that for every Change event, that is for every character typed, the STD_TEXT.Changed event routine is executed and replaces field STD_DESCL with the new value of STD_TEXT in upper case.

12. Change the STD_TEXT.Changed event to include the following logic:

#STD_DESCL := #STD_TEXT.UpperCase.Reverse

 

     Note: The field intrinsic functions have been used in the statement above. As noted earlier, you can discover or review these using F2 help on a field. Intrinsic functions available depend on field type.

13. Recompile your web page.

14. Test your web page. Type into the first field. The results should look like the following:

15. Click the Clear button.

16. Click the Hello button. Your web page should look like the following:

     Note: The Changed event for field STD_TEXT has not been triggered. Programmatic changes to a component (in this case a field component) do not trigger events.

     For general information about Intrinsics, refer to Understanding Intrinsics in the Technical Reference Guide.