Fokus auf eine element setzn ?

  • Hallo Eistee,

    das könntest du über diesen Workaround machen:

    Spoiler anzeigen
    [autoit]

    #include<WindowsConstants.au3>
    #include<GUIConstantsEx.au3>
    #include<StaticConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Global $pic = @SystemDir & '\oobe\images\nextover.jpg'
    Global $pic2 = @SystemDir & '\oobe\images\nextdown.jpg'

    [/autoit] [autoit][/autoit] [autoit]

    $gui = GUICreate("Test", Default, Default, -1, -1)
    $btnPic = GUICtrlCreatePic($pic, 30, 40, 24, 24)
    $btnPic2 = GUICtrlCreateButton("OK",-100,-100,1,1)
    GUICtrlSetState($btnPic2,$GUI_FOCUS)
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    While 1
    $msg = GUIGetMsg()
    Select
    Case $msg = $btnPic
    If _AnimButton($gui, $btnPic) Then MsgBox(0, '', 'click Pic')
    GUICtrlSetState($btnPic2,$GUI_FOCUS)
    Case $msg = $btnPic2
    _AnimButton($gui, $btnPic)
    MsgBox(0, '', 'auch ein click')
    Case $msg = $GUI_EVENT_CLOSE
    Exit
    EndSelect
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    ;==================================================================================================
    ; Function Name: _AnimButton($IDgui, $IDbtn [, $delay=150])
    ; Description: animiert ein Pic, wie einen geklickten Button
    ; Parameter(s): $IDgui ID der GUI
    ; $IDbtn ID des Picture als Button
    ;==================================================================================================
    Func _AnimButton($IDgui, $IDbtn)
    Local $pos = ControlGetPos($IDgui, '', $IDbtn)
    Local $pWin = WinGetPos(GUICtrlGetHandle($IDbtn))
    ControlMove($IDgui, '', $IDbtn, $pos[0], $pos[1] + 1, $pos[2] - 1, $pos[3] - 1)
    Sleep(10)
    ControlMove($IDgui, '', $IDbtn, $pos[0], $pos[1] + 2, $pos[2] - 2, $pos[3] - 2)
    Sleep(10)
    ControlMove($IDgui, '', $IDbtn, $pos[0], $pos[1] + 3, $pos[2] - 3, $pos[3] - 3)
    GUICtrlSetImage($IDbtn, $pic2)
    ;Local $tmpGui = GUICreate('', $pos[2], $pos[3], $pWin[0], $pWin[1], $WS_POPUP, $WS_EX_TOOLWINDOW)
    ;WinSetTrans($tmpGui, '', 120)
    ;GUISetState(@SW_SHOWNOACTIVATE, $tmpGui)
    $return = 1
    Do
    $x = GUIGetCursorInfo($IDgui)
    If $x[4] <> $IDbtn Then $return = 0
    Sleep(10)
    Until $x[2] = 0
    ;GUIDelete($tmpGui)
    ControlMove($IDgui, '', $IDbtn, $pos[0], $pos[1] + 2, $pos[2] - 2, $pos[3] - 2)
    Sleep(10)
    ControlMove($IDgui, '', $IDbtn, $pos[0], $pos[1] + 1, $pos[2] - 1, $pos[3] - 1)
    Sleep(10)
    ControlMove($IDgui, '', $IDbtn, $pos[0], $pos[1], $pos[2], $pos[3])
    GUICtrlSetImage($IDbtn, $pic)
    Return $return
    EndFunc ;==>_AnimButton

    [/autoit]

    abgeändertes Skript von BugFix

    mfg (Auto)bert