Sign in to follow this  
Followers 0
rasim

Processing double click on Label

4 posts in this topic

How can processing double click on Label control?

I tryed with this code, but futile :) :

#include <GuiConstants.au3>

$hGui = GUICreate("Test", 200, 100)

$label = GUICtrlCreateLabel("Click", 70, 45, 50, 17)
GUICtrlSetBkColor(-1, 0xFFFF00)

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
        ExitLoop
    EndSwitch
WEnd

Func WM_COMMAND($hWnd, $MsgID, $wParam, $lParam)
    MsgBox(0, "", "")
    Local $tagNMHDR, $code
    $tagNMHDR = DllStructCreate("int;int;int", $lParam)
    If @error Then Return 0
    $code = DllStructGetData($tagNMHDR, 3)
    If $wParam = $label And $code = $NM_DBLCLK Then MsgBox(0, "Ok", "Double click")
    Return $GUI_RUNDEFMSG
EndFunc

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi, you could make it a bit tidier but it's something like this..

#include <GuiConstants.au3>

Global $label, $DoubleClick

$hGui = GUICreate("Test", 200, 100)
$label = GUICtrlCreateLabel("Click", 70, 45, 50, 17)
GUICtrlSetBkColor(-1, 0xFFFF00)
GUISetState()

GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
    If $DoubleClick = 1 Then
        $DoubleClick = 0
        MsgBox(0, "Ok", "Double click")
    EndIf
WEnd

Func WM_COMMAND($hWnd, $MsgID, $wParam, $lParam)
    Local Const $STN_DBLCLK = 1
    Local $nID = BitAND($wParam, 0xFFFF)
    Local $nNotifyCode = BitShift($wParam, 16)
    If $nID = $label And $nNotifyCode = $STN_DBLCLK Then $DoubleClick = 1
    Return $GUI_RUNDEFMSG
EndFunc

Cheers

Edited by smashly

Share this post


Link to post
Share on other sites

smashly

Nice example, thanks, but where you take this code?

Share this post


Link to post
Share on other sites

#4 ·  Posted

it works for me , thx

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0