Hallo Leute eine frage und zwar hae ich ne gui mit nem bild das bild fungiert als button und jetzt die frage kann ich nen fokus auf das bild setzten ? so das ich nur enter drücken mus und das bild quasi gedrückt wird ?
MFG Eistee
Hallo Leute eine frage und zwar hae ich ne gui mit nem bild das bild fungiert als button und jetzt die frage kann ich nen fokus auf das bild setzten ? so das ich nur enter drücken mus und das bild quasi gedrückt wird ?
MFG Eistee
Hallo Eistee,
das könntest du über diesen Workaround machen:
#include<WindowsConstants.au3>
#include<GUIConstantsEx.au3>
#include<StaticConstants.au3>
Global $pic = @SystemDir & '\oobe\images\nextover.jpg'
Global $pic2 = @SystemDir & '\oobe\images\nextdown.jpg'
$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()
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
;==================================================================================================
; 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
abgeändertes Skript von BugFix
mfg (Auto)bert
Ah jetzt hab ich es gesehen da war ein button versteckt xD cool danke hatt mir sehr geholfen