Page 1 sur 1

[R] Détecter le changement de focus d'une combo box

Posté : ven. 01 nov. 2013 16:16
par losutak
Bonjour,
J'aimerais que ma condition s'active si la ligne de la combobox change, j'ai pas mal cherché dans l'aide sans trouvé quelque chose de concret :?
Merci de votre aide (encore :D ).

Re: [..] Détecter le changement de focus d'une combo box

Posté : ven. 01 nov. 2013 16:32
par mikell
Si la ligne de la combo change c'est que tu y as changé l'item sélectionné non ?

Code : Tout sélectionner

While 1
  $msg = GUIGetMsg()
      If $msg = $GUI_EVENT_CLOSE Then ExitLoop
      If $msg = $combo Then msgbox(0,"", GuiCtrlRead($combo) )
WEnd

Re: [..] Détecter le changement de focus d'une combo box

Posté : ven. 01 nov. 2013 16:43
par losutak
Si la ligne de la combo change c'est que tu y as changé l'item sélectionné non ?
Exactement ce que je voulais dire :)
If $msg = $combo Then msgbox(0,"", GuiCtrlRead($combo) )
Alors la j'ai pas compris :?
ma combobox :
Global $CMB_Macro_liste = GUICtrlCreateCombo("", 88, 80, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
J'ai donc fait ça :
If $nMsg = $CMB_Macro_liste Then
msgbox(0,"", GuiCtrlRead($CMB_Macro_liste) )
EndIf
Mais il ne se passe rien quand je change l'item de la combobox :?:

Re: [..] Détecter le changement de focus d'une combo box

Posté : ven. 01 nov. 2013 16:59
par mikell

Code : Tout sélectionner

#include <GUIConstantsEx.au3>
#include <ComboConstants.au3>

GUICreate("My GUI combo") 
$CMB_Macro_liste = GUICtrlCreateCombo("item1", 88, 80, 145, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "item2|item3", "item1") 
GUISetState()

While 1
  $msg = GUIGetMsg()
     If $msg = $GUI_EVENT_CLOSE Then ExitLoop
     If $msg = $CMB_Macro_liste Then
          msgbox(0,"", GuiCtrlRead($CMB_Macro_liste) )
     EndIf
WEnd

Re: [..] Détecter le changement de focus d'une combo box

Posté : ven. 01 nov. 2013 17:07
par losutak
C'est bon ça fonctionne ! Merci beaucoup :)
En copiant ton code ça ne fonctionner pas puis enfaîte je me suis rendu conte que j'avais déjà initialiser un switch avec GUIGetMsg() :lol: