Page 1 sur 1

[..] Problème interaction GUI

Posté : lun. 09 déc. 2013 08:12
par kalli
Salut salut, je programme quelque chose permettant de faire des calculs (pour pokémon...)
Cependant je m'occupe de la GUI et j'ai quelques problèmes ...
La fenêtre principale passe en "lock" (avec @SW_LOCK) pour laisser place a une autre fenêtre, et reviens pas la suite (avec @SW_UNLOCK) le problème est que lorsqu'elle revient, elle est planté (je peux plus interagir avec...)

Pouvez-vous m'aider ?

Voici le code :

Code : Tout sélectionner

_Main()

Func _Main()



    GUICreate("IV Calculator", 250, 175)

    GUICtrlCreateLabel ("Stats", 10, 41, 25, 20)
    GUICtrlCreateLabel ("EVs", 10, 68, 25, 20)

    GUICtrlCreateLabel ("HP", 54, 21, 25, 20)
    $inputHP = GUICtrlCreateInput ("", 50, 41, 25, 20)

    GUICtrlCreateLabel ("Atk", 84, 21, 25, 20)
    $inputAtk = GUICtrlCreateInput ("", 80, 41, 25, 20)

    GUICtrlCreateLabel ("Def", 114, 21, 25, 20)
    $inputDef = GUICtrlCreateInput ("", 110, 41, 25, 20)

    GUICtrlCreateLabel ("SAtk", 140, 21, 25, 20)
    $inputSAtk = GUICtrlCreateInput ("", 140, 41, 25, 20)

    GUICtrlCreateLabel ("SDef", 170, 21, 25, 20)
    $inputSDef = GUICtrlCreateInput ("", 170, 41, 25, 20)

    GUICtrlCreateLabel ("Spd", 202, 21, 25, 20)
    $inputSpd = GUICtrlCreateInput ("", 200, 41, 25, 20)


    $inputHPEV = GUICtrlCreateInput ("0", 50, 68, 25, 20)
    $inputAtkEV = GUICtrlCreateInput ("0", 80, 68, 25, 20)
    $inputDefEV = GUICtrlCreateInput ("0", 110, 68, 25, 20)
    $inputSAtkEV = GUICtrlCreateInput ("0", 140, 68, 25, 20)
    $inputSDefEV = GUICtrlCreateInput ("0", 170, 68, 25, 20)
    $inputSpdEV = GUICtrlCreateInput ("0", 200, 68, 25, 20)


    $pokeChoix = GUICtrlCreateCombo ("PokTest",80,100,115,25)
    GUICtrlSetData(-1, "YAYAYAYYYAYAYAY|Test|Retest")
    $BoutonOK = GUICtrlCreateButton("OK", 23, 132, 95, 25)
    $BoutonAuto = GUICtrlCreateButton("PasOK", 128, 132, 95, 25)
    GUISetState(@SW_SHOW)

    While 1


        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $BoutonOK

                $caracHP = GUICtrlRead($inputHP)
                $EVHP = GUICtrlRead($inputHPEV)

                $caracAtk = GUICtrlRead($inputAtk)
                $EVAtk = GUICtrlRead($inputAtkEV)

                $caracDef = GUICtrlRead($inputDef)
                $EVDef = GUICtrlRead($inputDefEV)

                $caracSAtk = GUICtrlRead($inputSAtk)
                $EVSAtk = GUICtrlRead($inputSAtkEV)

                $caracSDef = GUICtrlRead($inputSDef)
                $EVSDef = GUICtrlRead($inputSDefEV)

                $caracSpd = GUICtrlRead($inputSpd)
                $EVSpd = GUICtrlRead($inputSpdEV)

                $choix = GUICtrlRead($pokeChoix)

                GUISetState (@SW_LOCK)

                GUIiv(1,2,3,4,5,6,7,8,9,10,11,12)

                GUISetState(@SW_UNLOCK)
        EndSwitch
    WEnd

EndFunc


Func GUIiv($hpMin,$hpMax,$atkMin,$atkMax,$defMin,$defMax,$satkMin,$satkMax,$sdefMin,$sdefMax,$spdMin,$spdMax)

    $testboucle2 = 1

    GUICreate("IV Calculator", 250, 175)

    GUICtrlCreateLabel ("", 10, 41, 25, 20)
    GUICtrlCreateLabel ("IV", 10, 68, 25, 20)

    GUICtrlCreateLabel ("HP", 54, 21, 25, 20)
    GUICtrlCreateLabel ($hpMin&" - "&$hpmax, 50, 68, 25, 20)

    GUICtrlCreateLabel ("Atk", 84, 21, 25, 20)
    GUICtrlCreateLabel ($atkMin&" - "&$atkMax, 80, 68, 25, 20)

    GUICtrlCreateLabel ("Def", 114, 21, 25, 20)
    GUICtrlCreateLabel ($defMin&" - "&$defMax, 110, 68, 25, 20)

    GUICtrlCreateLabel ("SAtk", 140, 21, 25, 20)
    GUICtrlCreateLabel ($satkMin&" - "&$satkMax, 140, 68, 25, 20)

    GUICtrlCreateLabel ("SDef", 170, 21, 25, 20)
    GUICtrlCreateLabel ($sdefMin&" - "&$sdefMax, 170, 68, 25, 20)

    GUICtrlCreateLabel ("Spd", 202, 21, 25, 20)
    GUICtrlCreateLabel ($spdMin&" - "&$spdMax, 200, 68, 25, 20)

    $BoutonOK = GUICtrlCreateButton("OK", 23, 132, 95, 25)
    GUISetState()


    While ($testboucle2 <> 0)
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                $testboucle2 = 1
                GUISetState (@SW_HIDE)
            Case $BoutonOK
                $testboucle2 = 1
                GUISetState (@SW_HIDE)
            EndSwitch
    WEnd

EndFunc

 

Merci :)

Re: [..] Problème interaction GUI

Posté : mar. 24 déc. 2013 19:53
par xPunKx
Voilà, j'espère que ça va t'aider ! N'oubli pas les #include :wink:
► Afficher le texte
Désolé du délais, je suis nouveau sur se forum!