pete1234 Posted July 13, 2008 Share Posted July 13, 2008 I have a very simple GUI which consists of a single combo box with 2 possible values. I would like to call a function when one and only one of these values is selected, but I can't get things to work correctly. I'm trying to work in steps to get to that point, but I'm getting stuck pretty early on. Here's what I have right now (I've stripped out code that is irrelevant to this problem): Global $buCountDefault = "Specific";0 Global $buCountGlobal = "Global";1 GUICtrlCreateLabel("How many backups should be kept?", 10, 65, 200, 20) If FileExists($buIniPath) Then Local $buCountReadDefault = IniRead($buIniPath, "BackUp.Settings", "count", $sIniErrorMsg) Else $buCountSetDefault = $buCountDefault EndIf If FileExists($buIniPath) And $buCountReadDefault = 0 Then $buCountSetDefault = $buCountDefault EndIf If FileExists($buIniPath) And $buCountReadDefault = 1 Then $buCountSetDefault = $buCountGlobal EndIf $sConfigComboCount = GUICtrlCreateCombo($buCountDefault, 10, 85) GUICtrlSetData(-1,$buCountGlobal,$buCountSetDefault) $buCountRead = GUICtrlRead($sConfigComboCount) GUISetState () While 1 $sMsg = GUIGetMsg() Select Case $sMsg = $GUI_EVENT_CLOSE Or $sMsg = $sCancel GUISetState(@SW_HIDE) ExitLoop Case $sMsg = $sConfigComboCount; I haven't added criteria here yet because I can't get the basics working Msgbox(0, "", $buCountRead) EndSelect Wend I'm using the MsgBox just for testing right now, and it always returns the default value of the combo box instead of the selection. Anyone know where I'm going wrong? Thanks a bunch. Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted July 13, 2008 Share Posted July 13, 2008 Think about it, you read the value right after the combo is created, not when it is changed, you understand what I mean?? (move the GUICtrlRead() to after the Case) .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
pete1234 Posted July 13, 2008 Author Share Posted July 13, 2008 *smacks forehead* Thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now