d2a007 Posted April 20, 2006 Share Posted April 20, 2006 Hi guys I'm back to trying to find time to make little programs for fun. Currently I'm trying to make a program that will use combo boxes and I'm completly lost. The layout is picking an item type then based on that a class then an item and then a modification to that item. In the end I'll add one more combo box and end up with a total of 5. As you select items in the top box the second box will populate based on the first selection and so on down to the 5th. Here is the Func that i have so far that's not working: $Combo_1 = GuiCtrlCreateCombo("Select", 180, 50, 120, 21) $Combo_1 = GUICtrlSetData(-1,"Weapon|Armor","Select") GUICtrlSetOnEvent(-1, "COMBO1Selected") $Combo_2 = GuiCtrlCreateCombo("Select Above", 180, 80, 120, 21) Func COMBO1Selected() $ComboText_1 = Guictrlread($Combo_1) If $ComboText_1 = "Armor" Then GUICtrlSetData(4,"|Select|Helm|Body Armor|Shield", "Select") If $ComboText_1 = "Weapon" Then GUICtrlSetData(4,"|Select|Axes|Bows|Crossbows|Daggers|Maces|Polearms|Scepters|Spears|Staves|Swords|Wands", "Select") MsgBox(0, "Testing", "The read is " & $ComboText_1) I think I'm not using the read correctly I think, but over the last 30 minutes I can't figure out how I'm doing it wrong. No matter what I select it puts the weapons in the second combo box. Also the msgbox s just so I could see what's in "$ComboText_1" and it always outputs "0". Any help would be great Thanks, d2a007 Link to comment Share on other sites More sharing options...
GaryFrost Posted April 20, 2006 Share Posted April 20, 2006 (edited) $Combo_1 = GuiCtrlCreateCombo("Select", 180, 50, 120, 121) GUICtrlSetData(-1,"Weapon|Armor","Select");********** this is the line that had to be changed ****** GUICtrlSetOnEvent(-1, "COMBO1Selected") $Combo_2 = GuiCtrlCreateCombo("Select Above", 180, 80, 120, 121) Edited April 20, 2006 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted April 20, 2006 Moderators Share Posted April 20, 2006 (edited) Try this:#include <GUIConstants.au3> Opt("GUIOnEventMode", True) GUICreate("Test") GUISetOnEvent($GUI_EVENT_CLOSE, "Gui_Close") $Combo_1 = GUICtrlCreateCombo("Select", 180, 50, 120, 21) GUICtrlSetData(-1, "Weapon|Armor", "Select") GUICtrlSetOnEvent(-1, "COMBO1Selected") $Combo_2 = GUICtrlCreateCombo("Select Above", 180, 80, 120, 21) GUISetState() While 1 Sleep(250) WEnd Func COMBO1Selected() $ComboText_1 = GUICtrlRead($Combo_1) If $ComboText_1 = "Armor" Then GUICtrlSetData($Combo_2, "|Select|Helm|Body Armor|Shield", "Select") If $ComboText_1 = "Weapon" Then GUICtrlSetData($Combo_2, "|Select|Axes|Bows|Crossbows|Daggers|Maces|Polearms|Scepters|Spears|Staves|Swords|Wands", "Select") EndFunc ;==>COMBO1Selected Func Gui_Close() Exit EndFunc ;==>Gui_CloseEdit: minor change in script Edited April 20, 2006 by big_daddy Link to comment Share on other sites More sharing options...
GaryFrost Posted April 20, 2006 Share Posted April 20, 2006 Try this: #include <GUIConstants.au3> Opt("GUIOnEventMode", True) GUICreate("Test") GUISetOnEvent($GUI_EVENT_CLOSE, "Gui_Close") $Combo_1 = GUICtrlCreateCombo("Select", 180, 50, 120, 21) $Combo_1 = GUICtrlSetData(-1, "Weapon|Armor", "Select") GUICtrlSetOnEvent(-1, "COMBO1Selected") $Combo_2 = GUICtrlCreateCombo("Select Above", 180, 80, 120, 21) GUISetState() While 1 Sleep(250) WEnd Func COMBO1Selected() $ComboText_1 = GUICtrlRead($Combo_1) If $ComboText_1 = "Armor" Then GUICtrlSetData($Combo_2, "|Select|Helm|Body Armor|Shield", "Select") If $ComboText_1 = "Weapon" Then GUICtrlSetData($Combo_2, "|Select|Axes|Bows|Crossbows|Daggers|Maces|Polearms|Scepters|Spears|Staves|Swords|Wands", "Select") EndFunc ;==>COMBO1Selected Func Gui_Close() Exit EndFunc ;==>Gui_Close try again big_daddy $Combo_1 = GUICtrlSetData(-1, "Weapon|Armor", "Select") change to GUICtrlSetData(-1, "Weapon|Armor", "Select") SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Moderators big_daddy Posted April 20, 2006 Moderators Share Posted April 20, 2006 try again big_daddy $Combo_1 = GUICtrlSetData(-1, "Weapon|Armor", "Select") change to GUICtrlSetData(-1, "Weapon|Armor", "Select")Lol, I didn't even notice that. It still works though. Link to comment Share on other sites More sharing options...
d2a007 Posted April 20, 2006 Author Share Posted April 20, 2006 Thank you Big_daddy & Gafrost, worked like a charm! d2a007 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