# Function Reference

# _GUICtrlIpAddress_SetFocus

Sets the keyboard focus to the specified field in the IP address control

#include <GuiIPAddress.au3>
_GUICtrlIpAddress_SetFocus ( $hWnd, $iIndex )

## Parameters

$hWnd | Handle to the control
$iIndex | 0-based field index to which the focus should be set. If this value is greater than the number of fields, focus is set to the first blank field. If all fields are nonblank, focus is set to the first field.

## Return Value

None.

## Example

    #include <GUIConstantsEx.au3>
    #include <GuiIPAddress.au3>

    Example()

    Func Example()
        Local $hGui, $hIPAddress

        $hGui = GUICreate("IP Address Control Set Focus Example", 400, 300)
        $hIPAddress = _GUICtrlIpAddress_Create($hGui, 2, 4)
        GUISetState(@SW_SHOW)

        _GUICtrlIpAddress_Set($hIPAddress, "24.168.2.128")

        _GUICtrlIpAddress_SetFocus($hIPAddress, 1)
        ; Wait for user to close GUI
        Do
        Until GUIGetMsg() = $GUI_EVENT_CLOSE
    EndFunc   ;==>Example