[R] Evènement "onChange" avec _GUICtrlComboBoxEx
Posté : lun. 02 juin 2008 13:53
Bonjour,
J'utilise un objet de type Combo box créé avec
Son contenu est généré dynmiquement avec
Je souhaiterais lancer une fonction lorsque l'utilisateur sélectionne un élément. Lorsque j'utilisais le contrôle par défaut (GUICtrlCreateCombo()), je fais passais par la boucle
Avec le passage en UDF, je suis obligé de passer par la fonction WM_NOTIFY :
Le problème c'est que je ne trouve pas quelle variable iCode correspond à la sélection d'un élément, j'ai essayé BEGINUPDATE, ENDUPDATE, GETDISPINFO, aucune ne correspond à ce que je recherche. Les deux premières répondent quand j'ouvre le Combo pour voir son contenu, donc avant même qu'un élément ait été sélectionné.
(Voir http://msdn.microsoft.com/fr-fr/library ... S.71).aspx)
Peut-être y a-t-il une alternative à ce WM_NOTIFY ?
Merci pour vos tuyaux
A+
J'utilise un objet de type Combo box créé avec
Code : Tout sélectionner
_GUICtrlComboBoxEx_Create()
Code : Tout sélectionner
_GUICtrlComboBoxEx_AddString()
Code : Tout sélectionner
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $MonCombo
MaFonction()
...
...
...
Code : Tout sélectionner
Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR
$tNMHDR = DllStructCreate($tagNMHDR, $lParam)
$hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
$iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
$iCode = DllStructGetData($tNMHDR, "Code")
Switch $hWndFrom
Case $hTreeStartMenus
Switch $iCode
Case $NM_CLICK
;$tagTVHITTESTINFO = "int X;int Y;int Flags;int Item"
Local $tMPos = _WinAPI_GetMousePos(True, $hWndFrom), $tHit = _GUICtrlTreeView_HitTestEx($hWndFrom, DllStructGetData($tMPos, 1), DllStructGetData($tMPos, 2))
Local $hItem = DllStructGetData($tHit, "Item"), $iFlags = DllStructGetData($tHit, "Flags")
If $hItem <> 0 And BitAND($iFlags, $TVHT_ONITEMSTATEICON) Then
_TV_Checkbox_MultiSet($hWndFrom, $hItem, 1)
EndIf
Case $TVN_KEYDOWN
Local $tNMTVKEY = DllStructCreate("hwnd;int;int;short key;uint", $lParam)
Local $hSelected = _GUICtrlTreeView_GetSelection($hWndFrom)
If DllStructGetData($tNMTVKEY, "key") = 0x20 And $hSelected Then ;;space
_TV_Checkbox_MultiSet($hWndFrom, $hSelected, 1)
EndIf
Case Else
EndSwitch
Case $MonCombo
Switch $iCode
Case ??????????????????????
MaFonction()
EndSwitch
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc
(Voir http://msdn.microsoft.com/fr-fr/library ... S.71).aspx)
Peut-être y a-t-il une alternative à ce WM_NOTIFY ?
Merci pour vos tuyaux
A+