OnFocus - cWebBaseControl

Fires when a control gains the focus

Type: Event

Parameters: None

Procedure OnFocus 


OnFocus is an event that triggers when the application user tabs into or clicks on a control to give it the focus.

Set the pbServerOnFocus property to True to instruct the client to send the OnFocus event to the control's server-side object. Focus-related events such as OnBlur and OnFocus do not work well with server-side handlers. This is partly due to the inherent latency of server calls. If possible it is better to use a client-side handler for OnFocus (set via psClientOnFocus).

By default, pbServerOnFocus is False.


There are some fundamental differences between the Windows Entering and Exiting messages and the Web Focus and Blur messages. For example, the lack of support for focus scopes. OnFocus and OnBlur are also sent asynchronously, so when the server is still handling a Blur or Focus message, the user might have already made changes on the client.

See Also

OnValidate | OnBlur