lordicast Posted December 6, 2007 Posted December 6, 2007 Ok so i want to use the same GUICtrlCreatecombo to display 2 different data dropdowns ; Example Problem is when i select water in also gives me the values of the rest of the forms ie; water|fire|wind|earthSplash|Swim|Back","Forms I want 1 at a time CODE$Forms = GUICtrlCreatecombo('Forms', 776, 144, 153, 25) GUICtrlSetData($Forms,"water|fire|wind|earth","Forms") $n2= GUICtrlCreateButton("Format", 776, 166, 50,25) While 1 $Msg = GUIGetMsg() Select Case $msg = $n2 $whatnow = GUICtrlRead($Forms) If GUICtrlRead($Forms) = 'water' Then hnote() If GUICtrlRead($Forms) = 'back' Then bnote() EndSelect WEnd Func hnote() GUICtrlSetData($Forms,"Splash|Swim|Back","Splash") EndFunc Func bnote() GUICtrlSetData($Forms,"water|fire|wind|earth","Forms") EndFunc Is this the way to do it or is there somthing more simple? [Cheeky]Comment[/Cheeky]
Monamo Posted December 6, 2007 Posted December 6, 2007 (edited) Just use a GUICtrlSetData() to clear the combobox data before creating the new entries:Func hnote() GUICtrlSetData($Forms,"") GUICtrlSetData($Forms,"Splash|Swim|Back","Splash") EndFunc Func bnote() GUICtrlSetData($Forms,"") GUICtrlSetData($Forms,"water|fire|wind|earth","Forms") EndFunc Edited December 6, 2007 by Monamo - MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]
PsaltyDS Posted December 6, 2007 Posted December 6, 2007 Ok so i want to use the same GUICtrlCreatecombo to display 2 different data dropdowns ; Example Problem is when i select water in also gives me the values of the rest of the forms ie; water|fire|wind|earthSplash|Swim|Back","Forms I want 1 at a time Is this the way to do it or is there somthing more simple? You need to get in the habbit of posting working code... Your problem is that GuiControlSetData() can only ADD items, not replace them. But the UDF functions have handy things like _GuiCtrlComboBox_ResetContent(): #include <GuiConstants.au3> #include <GuiComboBox.au3> $hGUI = GUICreate("Test", 170, 85) $Forms = GUICtrlCreateCombo('Forms', 10, 10, 150, 25) $hForms = ControlGetHandle($hGUI, "", $Forms) GUICtrlSetData($Forms, "water|fire|wind|earth", "Forms") $n2 = GUICtrlCreateButton("Format", 35, 45, 100, 30) GUISetState() While 1 $Msg = GUIGetMsg() Select Case $Msg = $GUI_EVENT_CLOSE Exit Case $Msg = $n2 $whatnow = GUICtrlRead($Forms) If GUICtrlRead($Forms) = 'water' Then hnote() If GUICtrlRead($Forms) = 'back' Then bnote() EndSelect WEnd Func hnote() _GUICtrlComboBox_ResetContent($hForms) GUICtrlSetData($Forms, "Splash|Swim|Back", "Splash") EndFunc ;==>hnote Func bnote() _GUICtrlComboBox_ResetContent($hForms) GUICtrlSetData($Forms, "water|fire|wind|earth", "Forms") EndFunc ;==>bnote Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
lordicast Posted December 6, 2007 Author Posted December 6, 2007 You need to get in the habbit of posting working code...sorry bout that im horrible at posting code, this script is 50 functions deep and looks like a maze i forget about includes.thanks for the advice. [Cheeky]Comment[/Cheeky]
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