Home > Language Reference > Classes > Control
DrawFocusRing Method
Draws the focus ring.
Syntax
Public Sub DrawFocusRing(ByVal eStyle As HbFocusRing, Optional ByVal iLeft As Integer = 0, Optional ByVal iTop As Integer = 0, Optional ByVal iWidth As Integer = 0, Optional ByVal iHeight As Integer = 0)
| Parameter | Description |
| eStyle | Focus ring appearance. |
| iLeft | X-coordinate of the top left corner of the focus ring, expressed in standard coordinates. |
| iTop | Y-coordinate of the top left corner of the focus ring, expressed in standard coordinates. |
| iWidth | Width of the focus ring, expressed in standard coordinates. |
| iHeight | Height of the focus ring, expressed in standard coordinates. |
Remarks
The DrawFocusRing method draws the focus ring around the specified control. If the ring was already drawn around a different control on the form, it is first erased. You typically call this method from a user control, in response to the GotFocus event, as shown below:
Private Sub UserControl_GotFocus() DrawFocusRing hbFocusRingDefault End Sub
The eStyle parameter specifies the graphical appearance of the focus ring, and can take one of the following values:
| Constant | Value | Description |
| hbFocusRingDefault | &H0000 | Use a focus ring that matches the underlying UI object. |
| hbFocusRingSquare | &H0001 | A rectangular focus ring with square corners. |
| hbFocusRingRound | &H0002 | A rectangular focus ring with rounded corners. |
| hbFocusRingHorizontalBars | &H0003 | Horizontal bars (not supported on all devices). |
Moreover, you can combine the hbFocusRingForceRestore constant to any of the previous ones to force the previous ring to be erased. This may prove useful drawing a different ring around the same control is required, for example to indicates that the focus switched from object to interaction mode.
The iLeft, iTop, iWidth and iHeight parameters specify the coordinates where the ring is to be drawn. If these parameters are omitted, the current coordinates of the control are used instead. Note that the ring is drawn outside this rectangle, not inside.
The focus ring can be erased by calling the RemoveFocusRing method. For more information about supporting the 5-way navigator and the blue focus ring feature in your applications, please refer to the One handed navigation section in the Programmer's Guide.
System requirements
| System | Minimal version | Remarks |
| Palm OS | Palm OS 3.0 | Only effective on devices with one-handed navigation enabled. |