IntraWeb Archive

New feature in IntraWeb XIV: LockOnAsyncEvents

New feature in IntraWeb XIV: LockOnAsyncEvents

There is a new feature in IntraWeb XIV: LockOnAsyncEvents

Sometimes you have an async request that takes a long time to respond. For instance, you have a IWButton with an OnAsyncClick event which inserts lots of records to a database and it takes a few seconds. You probably want to give some visual feedback to the application user that the application is working. At the same time, you probably don’t want the user to click on other buttons, triggering other actions and requests. So we created a new property named LockOnAsyncEvents, present in every TCustomControl descendant. This new property is available in IntraWeb 14.0.29 and newer versions.

In the Object Inspector are only shown the options associated with some Async event of the control. For instance: TIWButton only have OnAsyncClik, OnAsyncDoubleClick, OnAsyncEnter, OnAsyncExit, OnAsyncMouseMove, OnAsyncMouseOver and OnAsyncMouseOut events. So the only options available through Object Inspector are: aeClick, aeDoubleClick, aeEnter, aeExit, aeMouseMove, aeMouseOver and aeMouseOut.

As you can see, a different control like a TIWComboBox exposes different options in Object Inspector:

In our example, we just need to set IWButton1.LockOnAsyncEvents = [aeClick], so during an OnAsyncClick request the IWLocker will be visible (just like a full submit request when IWForm.LockOnSubmit = True) and actually “lock” the screen. The IWLocker will be hidden again when the response is received.

There is a new demo showing the LockOnAsyncEvents property in action in our CodePlex repository here.