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)

ParameterDescription
eStyleFocus ring appearance.
iLeftX-coordinate of the top left corner of the focus ring, expressed in standard coordinates.
iTopY-coordinate of the top left corner of the focus ring, expressed in standard coordinates.
iWidthWidth of the focus ring, expressed in standard coordinates.
iHeightHeight 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:

ConstantValueDescription
hbFocusRingDefault&H0000Use a focus ring that matches the underlying UI object.
hbFocusRingSquare&H0001A rectangular focus ring with square corners.
hbFocusRingRound&H0002A rectangular focus ring with rounded corners.
hbFocusRingHorizontalBars&H0003Horizontal 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

SystemMinimal versionRemarks
Palm OSPalm OS 3.0Only effective on devices with one-handed navigation enabled.