Jump to content

Problem with a Combo box


Recommended Posts

Hi,

I'm doing my first GUI script with AutoIt and I can't seem to be able to make the combo box control work properly. It doesn't show the dropdown list on my computer. I'm using the v3.1.1.61 (beta).

Does anybody knows what I'm doing wrong ? The code follows.

#include <GUIConstants.au3>
#include <GUICombo.au3>
#NoTrayIcon

;Variables
$strModem=""
$strLogin=""
$strPassword=""
$strMGCPName=""
$nDummy=0

;Création de la fenêtre principale
$wndMain=GUICreate("Configurateur", 400, 270)

;Création des boutons
$btnConf=GUICtrlCreateButton("&Configurer", 5, 240, 100, 25)
$btnExpert=GUICtrlCreateButton("&Expert", 105, 240, 100, 25)
$btnQuitter=GUICtrlCreateButton("&Quitter", 295, 240, 100, 25)

;Création du groupe
$grpGroup=GUICtrlCreateGroup("",5 ,5, 390, 225)
$lblModem=GUICtrlCreateLabel("Modem :", 40, 40, 100, 25)
$cbxModem=GUICtrlCreateCombo("Hitachi AH4021", 140, 40, 200, 25, $CBS_DROPDOWNLIST); <== This the problematic part. 
GUICtrlSetData($cbxModem, "Thomson ST530v5|Comtrend CT633", "Hitachi AH4021") 
GUISetState()

$lblLogin=GUICtrlCreateLabel("Nom d'utilisateur :", 40, 80, 100, 25)
$inpLogin=GUICtrlCreateInput("", 140, 80, 200, 20)

$lblPassword=GUICtrlCreateLabel("Mot de passe :", 40, 120, 100, 25)
$inpPassword=GUICtrlCreateInput("", 140, 120, 200, 20)

$lblMGCPName=GUICtrlCreateLabel("Code téléphonie :", 40, 160, 100, 25)
$inpMGCPName=GUICtrlCreateInput("", 140, 160, 200, 20)
GUICtrlCreateGroup("",-99 ,-99, 1, 1)

;Création de la fenêtre secondaire
$wndExpert=GUICreate("Configurateur", 270, 180, -1, -1, -1, $WS_EX_TOPMOST, $wndMain)

;Création des boutons
$btnRenewIP=GUICtrlCreateButton("&Renouveler l'adresse IP", 5, 150, 150, 25)
$btnOK=GUICtrlCreateButton("&Ok", 165, 150, 100, 25)

;Création du groupe
$grpGroup2=GUICtrlCreateGroup("Mode de connexion",60 ,20 , 160, 90)

$rdoPPPOA = GUICtrlCreateRadio("PPPoA", 80, 40, 120, 20)
;GUICtrlSetState ($rdoPPPOA, $GUI_CHECKED)
$PPPoA=1
$rdoPPPOE = GUICtrlCreateRadio("PPPoE", 80, 80, 120, 20)
GUICtrlCreateGroup("",-99 ,-99, 1, 1)

GUISwitch($wndMain)
GUISetState(@SW_SHOW)

While 1
  
  $msg = GUIGetMsg(1)
  Select

    Case $msg[0] = $btnOK
      $nDummy=ShowMainWindow()
      $nDummy=CheckRadioButton()
      
    Case $msg[0] = $btnExpert
      $nDummy=ShowExpertWindow()

    Case $msg[0] = $btnRenewIP
      $nDummy=OnRenewIPButtonclick()

    Case $msg[0] = $btnConf
      $nDummy=OnConfButtonclick()
      
    Case $msg[0] = $btnQuitter
      $nDummy=ConfirmExit()

    Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $wndMain 
      $nDummy=ConfirmExit()

    Case $msg[0] = $GUI_EVENT_CLOSE And $msg[1] = $wndExpert 
      $nDummy=ShowMainWindow()

  EndSelect

Wend

;Affiche la fenêtre principale
Func ShowMainWindow()
  GUISetState(@SW_HIDE)
  GUISwitch($wndMain)
  GUISetState(@SW_SHOW)
  Return 0
EndFunc

;Affiche la fenêtre expert
Func ShowExpertWindow()
  GUISwitch($wndExpert)
  If $PPPoA==1 Then
    GUICtrlSetState($rdoPPPOA, $GUI_CHECKED)
  Else
    GUICtrlSetState($rdoPPPOE, $GUI_CHECKED)
  EndIf
  GUISetState(@SW_SHOW)
  Return 0  
EndFunc

;Vérifie l'état des boutons radio de la fenêtre expert
Func CheckRadioButton()
  If GUICtrlRead($rdoPPPOA)==$GUI_CHECKED Then
    $PPPoA=1
  Else
    $PPPoA=0
  EndIf
  Return 0
EndFunc

;Gère le click sur le bonton Configurer
Func OnConfButtonclick()
 ;récupération des paramètres
  $strModem=GUICtrlRead($cbxModem)
  $strLogin=GUICtrlRead($inpLogin)
  $strPassword=GUICtrlRead($inpPassword)
  $strMGCPName=GUICtrlRead($inpMGCPName)
  
  If $strModem=="" Then
    MsgBox(16, "Erreur", "Veuiilez sélectionner un modem")
    Return 1
  ElseIf $strLogin=="" Then
    MsgBox(16, "Erreur", "Veuillez rentrer votre nom d'utilisateur")
    Return 2
  ElseIf $strPassword=="" Then
    MsgBox(16, "Erreur", "Veuillez rentrer votre mot de passe")
    Return 3
  Else
    MsgBox(64, "Information", $strModem & " " & $strLogin & " " & $strPassword & " " & $strMGCPName)
    Return 0
  EndIf
EndFunc

;Gestion du bouton Renouveller l'IP
Func OnRenewIPButtonclick()
  MsgBox(4096+64, "Information", "IP release/renew")
  Return 0
EndFunc

;Confirmation de sortie
Func ConfirmExit()
  If MsgBox(32+4, "Confirmation", "Êtes-vous sûr de vouloir quitter ?")==6 Then
    Exit
  EndIf
  Return 0
EndFunc
Thanks in advance.

Cubehead

Link to comment
Share on other sites

Set the height of the combobox to be around 100px.

Either it's the color of the progressbar, or it's a combox that's not showing.

What will it be in Longhorn ? Pink controls, which doesn't support any input ?

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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