Jump to content

WM_Notify for two controls


grham
 Share

Recommended Posts

Hi!

I have discovered something "strange" (for me)

while using (registering) a wm_notify function for

two controls.

Details:

In my exemple it was for a rich text box and (then) a toolbar in

another (child) window.

When I put within the "switch hWndFrom" first the "case" of

a toolbar and then the "case" for the RTB, the RTB doesn't send

any message. In reversed order : first the "case" of the TRB and then

the "case" of the toolbar, both of them send messages.

So my solution was only to "reorder" the "case's" within the

"switch hWndFrom" and that's it.

Used with 3.2.10.

an exemple of illustration (now correct!!!):

Func _WM_NOTIFY($hWndGUI, $MsgID, $wParam, $lParam)
    #forceref $hWndGUI, $MsgID, $wParam
    Local $tNMHDR, $event, $hwndFrom, $code, $i_idNew, $dwFlags, $lResult, $idFrom, $i_idOld
    Local $tNMTOOLBAR, $tNMTBHOTITEM
    
    $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
    $hwndFrom = DllStructGetData($tNMHDR, "hWndFrom")
    $idFrom = DllStructGetData($tNMHDR, "IDFrom")
    $code = DllStructGetData($tNMHDR, "Code")
    Switch $hwndFrom
        Case $RichEdit
            Switch $code
                Case $EN_SELCHANGE
                    Local $tSELCHANGE = DllStructCreate($tagSELCHANGE, $lParam)
                    Local $cpMin = DllStructGetData($tSELCHANGE, 4)
                    Local $cpMax = DllStructGetData($tSELCHANGE, 5)
                    ConsoleWrite("Sel change:" & @LF & $cpMin & " --- " & $cpMax & @LF)
            EndSwitch
        
        Case $Typo_Toolbar, $Typo_Toolbar2
            Switch $code
                Case $NM_LDOWN
        ;----------------------------------------------------------------------------------------------
                    $What_TB = $hWndFrom
                    ConsoleWrite("$NM_LDOWN: Clicked Item: " & $iItem & " at index: " & _GUICtrlToolbar_CommandToIndex ($What_TB, $iItem) & @CRLF)
        ;----------------------------------------------------------------------------------------------
                Case $TBN_HOTITEMCHANGE
                    $tNMTBHOTITEM = DllStructCreate($tagNMTBHOTITEM, $lParam)
                    $i_idOld = DllStructGetData($tNMTBHOTITEM, "idOld")
                    $i_idNew = DllStructGetData($tNMTBHOTITEM, "idNew")
                    $iItem = $i_idNew
                    $dwFlags = DllStructGetData($tNMTBHOTITEM, "dwFlags")
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc;==>_WM_NOTIFY

???

Maybe it has to be like this.

Edited by grham
Link to comment
Share on other sites

What Siao is saying is:

Case $Typo_Toolbar Or $Typo_Toolbar2oÝ÷ ÚÈhºW[y«­¢+Ø
ÍÀÌØíQåÁ½}Q½½±È°ÀÌØíQåÁ½}Q½½±È

Because you used Switch

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...