Overriding pointer_focus()

customcontainer.C gives an example of overriding pointer_focus() in the implementation object. The main window's grid layout manager provides a 10 millimeter padding() for the custom container. The custom container's grid layout manager provides an additional 10 millimeter padding for its small input field.

pointer_focus() gets invoked whenever the pointer moves into, or out of, a display element. Moving the pointer ten millimeters into the window crosses into the custom container, triggering a call to pointer_focus(). The custom implementation uses this to set the custom display element's background color to a radial gradient color. Moving the pointer out of the container restores the default background color.

Note

The entire window's background color changes, and not just the custom container's This is because a display element's background color includes any padding around the display element. The custom container's background color gets extended to the padding area around it.