rasim Posted January 21, 2008 Share Posted January 21, 2008 Hi! I ask about subj several times, but not found solution? I tryed processing double click on button control with below code, but unsuccessful expandcollapse popup#include <GuiConstantsEx.au3> #include <GuiListView.au3> $hGui = GuiCreate("TestGui", 200, 100) $hListView = _GUICtrlListView_Create($hGui, "Item|Subitem", 5, 5, 195, 50) $LV_Item1 = _GUICtrlListView_AddItem($hListView, "Item1") $button = GUICtrlCreateButton("Click", 10, 70, 50, 25) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUISetState() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $hWndButton $hWndButton = GUICtrlGetHandle($button) $hWndListView = $hListView If Not IsHWnd($hWndListView) Then $hWndListView = GUICtrlGetHandle($hListView) $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndListView Switch $iCode Case $NM_DBLCLK MsgBox(0, "ListView Itmem", "Double click") EndSwitch Case $hWndButton Switch $iCode Case $NM_DBLCLK MsgBox(0, "Button", "Double click") EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Link to comment Share on other sites More sharing options...
rasim Posted January 21, 2008 Author Share Posted January 21, 2008 Anyone know? Link to comment Share on other sites More sharing options...
Siao Posted January 21, 2008 Share Posted January 21, 2008 (edited) $cBtn = GUICtrlCreateButton("", 0, 0) ;~ Global Const $BN_CLICKED = 0 ;~ Global Const $BN_DBLCLK = 5 GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam) $nNotifyCode = BitShift($wParam, 16) $nID = BitAnd($wParam, 0x0000FFFF) $hCtrl = $lParam If $nID = $cBtn Switch $nNotifyCode Case $BN_CLICKED ConsoleWrite('Single clicked' & @CRLF) Case $BN_DBLCLK ConsoleWrite('Double clicked' & @CRLF) EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc Edited January 21, 2008 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
rasim Posted January 21, 2008 Author Share Posted January 21, 2008 SiaoHello! I glad for your help! Single click work correctly, but double click not work #include <GuiConstants.au3> Global Const $BN_CLICKED = 0 Global Const $BN_DBLCLK = 5 GUICreate("Double Click Demo", 400, 300) $button = GUICtrlCreateButton("start", 10, 10, 50, 25) GUIRegisterMsg($WM_COMMAND, "MY_WM_COMMAND") GUISetState() While GUIGetMsg() <> -3 ;Sleep(20) WEnd Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam) $nNotifyCode = BitShift($wParam, 16) $nID = BitAnd($wParam, 0x0000FFFF) $hCtrl = $lParam If $nID = $button Then Switch $nNotifyCode Case $BN_CLICKED ConsoleWrite('Single clicked' & @CRLF) Case $BN_DBLCLK ConsoleWrite('Double clicked' & @CRLF) EndSwitch EndIf Return $GUI_RUNDEFMSG EndFunc Link to comment Share on other sites More sharing options...
Siao Posted January 21, 2008 Share Posted January 21, 2008 Hm, you need to set the $BS_NOTIFY style for the button to be able to receive $BN_DBLCLK messages. GUICtrlCreateButton() article in the helpfile says that this style is forced, but actually that isn't so. "be smart, drink your wine" Link to comment Share on other sites More sharing options...
rasim Posted January 22, 2008 Author Share Posted January 22, 2008 SiaoYou guru! Nobody don`t give me correct solve. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now