Page 1 sur 1
[R] Combobox de base
Posté : jeu. 17 avr. 2008 22:19
par lolingman2
bonjour/bonsoir a tous,
voila tout est dans le titre, j'ai fait du pascal objet, du java, du C, du C++ et je commence avec cet outil que l'on m'a conseiller.
ma question est donc comment faire une fonction qui affiche une combo box "item1|item2|item3" avec un bouton "ok" qui renvoie 1,2 ou 3 selon le choix de l'utilisateur (mon probleme n'est pas au niveau de la syntaxe d'une fonction mais dans l'utilisation basique des combobox.
j'ai chercher partout dans la doc/ fofo francais/ fofo anglais/tuto/exemples installés, et je ne trouve a ma deception aucun exemple de base qui correspond a ce que je cherche.
merci de votre aide car la je pagaie dans la semoule depuis 3heures.
Re: [..] Combobox de base
Posté : jeu. 17 avr. 2008 22:50
par arrkhan
Bienvenue sur le fofo,
Fait en speed mais je pense que ca peut te convenir
Code : Tout sélectionner
GUICreate("Test combo", 150, 80, -1, -1)
$combo = GUICtrlCreateCombo("Choississez un test…", 10, 10, 130, 20)
GUICtrlSetData(-1, "Test 1|Test 2|Test 3", "Choississez un test…")
$button = GUICtrlCreateButton("Button", 10, 40, 130, 30)
GUISetState()
While 1
$msg = GUIGetMsg()
if $msg = -3 then ExitLoop
$CR = GUICtrlRead($combo)
if $msg = $button Then
If $CR = "Test 1" Then
MsgBox(0, "Box", "1")
ElseIf $CR = "Test 2" Then
MsgBox(0, "Box", "2")
ElseIf $CR = "Test 3" Then
MsgBox(0, "Box", "3")
EndIf
EndIf
WEnd
Exit
Tu peux également le faire en passant par un tableau et un for...next.
En esperant que ca puisse t aider
Re: [..] Combobox de base
Posté : jeu. 17 avr. 2008 22:58
par lolingman2
merci : ca me donne un départ, j'étais arrivé à ca:
► Afficher le texte
Code : Tout sélectionner
#include <GUIConstants.au3>
$Form1 = GUICreate("Form1", 363, 298, 368, 146)
$Button1 = GUICtrlCreateButton("ok", 176, 16, 67, 97, 0)
$Group1 = GUICtrlCreateGroup("Hall", 8, 8, 153, 105)
$Radio1 = GUICtrlCreateRadio("Radio1", 16, 32, 113, 17)
$Radio2 = GUICtrlCreateRadio("Radio2", 16, 48, 113, 17)
$Radio3 = GUICtrlCreateRadio("Radio3", 16, 64, 113, 17)
$Radio4 = GUICtrlCreateRadio("Radio4", 16, 80, 113, 17)
GUICtrlSetState ($radio2, $GUI_CHECKED)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)
Global $temp=0
While 1
$nMsg = GUIGetMsg()
Select
Case $nMsg = $GUI_EVENT_CLOSE
ExitLoop
Case $nMsg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
MsgBox(64, 'Info:', 'You clicked the Radio 1 and it is Checked.')
Case $nMsg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
MsgBox(64, 'Info:', 'You clicked on Radio 2 and it is Checked.')
Case $nMsg = $radio3 And BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED
MsgBox(64, 'Info:', 'You clicked the Radio 1 and it is Checked.')
Case $nMsg = $radio4 And BitAND(GUICtrlRead($radio4), $GUI_CHECKED) = $GUI_CHECKED
MsgBox(64, 'Info:', 'You clicked on Radio 2 and it is Checked.')
Case $nMsg = $Button1
MsgBox(0,"",$Radio1)
EndSelect
Re: [..] Combobox de base
Posté : jeu. 17 avr. 2008 23:12
par lolingman2
merci j'ai trouvé.
Re: [..] Combobox de base
Posté : jeu. 17 avr. 2008 23:27
par arrkhan
Pense a mettre un [R] au début du titre de ton topic s'il est résolu