Not sure how best to explain this problem. Seems easiest to have you run this script: If you run this script a couple different times, tweaking it very slightly per my instructions below, you will see the problem right away.
(see the "TEST HERE" section in the code)
Code as of right now: CASE (A): When "$5.00" is selected in "Budget" combo box, MsgBox reads and returns the text in "Type" column. This works just fine. You can make changes to the "Type" column all day long and MsgBox will always return an accurate result. Great.
CASE B: However, if you change the code to say "$6.00 (or any other value besides $5.00)" , MsgBox fails.
Here's what I'm trying to do: For each different combination of values selected from the 3 columns in the parent window, when I press "Yes" in the child window, the script will then perform a unique operation.
The script seems to almost be working, but I can't get it any closer. I've tried as many things as my noob knowledge will allow, and am now completely out of ideas. Thanks for helping......
CODE#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.11.0 (beta)
Author: myName
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
#include <GUIConstants.au3>
#include <GUIComboBox.au3>
$Parent_Win = GUICreate("schedule", 700, 300)
GUISetBkColor(0xCCBBFF)
GUISetState(@SW_SHOW)
GUICtrlCreateLabel("budget", 188, 35)
GUICtrlCreateLabel("quantity", 325, 35)
GUICtrlCreateLabel("type", 455, 35)
$box1 = GUICtrlCreateCombo("$5.00", 150, 91, 120, 10)
GUICtrlSetData($box1, "$6.00 |$7.00 |$8.00")
$box2 = GUICtrlCreateCombo("1 pound", 287, 91, 120, 10)
GUICtrlSetData($box2, "2 pounds |3 pounds")
$box3 = GUICtrlCreateCombo("apples", 425, 91, 120, 10)
GUICtrlSetData($box3, "oranges |grapes")
$button1 = GUICtrlCreateButton("compute", 250, 220, 130, 40)
$Child_Win = GUICreate("START", 330, 150, 400, 300, $WS_CAPTION, -1, $Parent_Win)
GUICtrlCreateLabel("compute?", 20, 30, 300, 25, $SS_CENTER)
GUICtrlSetColor(4102, 0x0000)
GUICtrlSetFont(4102, 10, 550)
GUISetBkColor(0xCCBBFF, $Child_Win)
$button2 = GUICtrlCreateButton("yes", 60, 80, 80, 30)
GUICtrlSetFont(4103, 10, 600)
$button3 = GUICtrlCreateButton("no", 190, 80, 80, 30)
GUICtrlSetFont(4104, 10, 600)
While 1
$msg = GUIGetMsg()
$budget = GUICtrlRead(6)
$quantity = GUICtrlRead(7)
$type = GUICtrlRead(8)
If $msg = $button1 Then
GUISetState(@SW_SHOW, $Child_Win)
EndIf
If $msg = $button3 Then
GUISetState(@SW_HIDE, $Child_Win)
EndIf
===================================================================
; FYI:
; "$button2" is the "Yes" button in child window
; when code says "$5.00" below, user can manually select any value in the "Type" column of parent window, and MsgBox works all day long.
; when code is changed to "$6.00" below, Msgbox stops working
; TEST HERE BEGIN =======================================================
If $msg = $button2 And $budget = "$5.00" Then
MsgBox(0, "type is", $type)
EndIf
; TEST HERE END =========================================================
Select
Case $msg = $GUI_EVENT_CLOSE
GUIDelete()
Exit
EndSelect
WEnd