Jump to content

Recommended Posts

Posted (edited)

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
Posted (edited)

Ok

I get it now. It was only a coincidence that it worked

with "OR". When I put a coma, this behavior disapears.

Thanks Siao and Gary

And sorry (my fault)

Edited by grham

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
  • Recently Browsing   0 members

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