thienfu Posted June 17, 2010 Share Posted June 17, 2010 Helo can anyone help me for complete below script? how to do while function on below combo menu? cause i've try use while function on that but the button for print, add, edit delete and save will no display if using while function. i want that combomenu work like : first select block we want then press button go then on right si on button go will show new combomenu for unit that block we select. attachment are pic for success script. sorry my english no so good, hope u all can understand expandcollapse popup#include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIComboBox.au3> Global $cb1, $cb2, $cb3, $cb4, $cb5, $cb6, $cb7 Global $Label1, $Label2, $Label3, $Label4, $Label5, $Label6, $Label7 Main() Func Main() GUICreate("Schedulle Tenancy", 1000, 700) ; will create a dialog box GUISetBkColor(0xFFFBF0) ; will change background color $hTab = GUICtrlCreateTab(5, 10, 990, 685) $hTab0 = GUICtrlCreateTabItem("Main") GUICtrlCreateGroup("Owner", 15, 35, 70, 80) $cb1 = GUICtrlCreateCheckbox("KBI", 25, 50) $cb2 = GUICtrlCreateCheckbox("Buyers", 25, 70) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUICtrlCreateGroup("Type Unit", 90, 35, 80, 80) $cb3 = GUICtrlCreateCheckbox("Apartment", 100, 50) $cb4 = GUICtrlCreateCheckbox("Shop", 100, 70) $cb5 = GUICtrlCreateCheckbox("Office", 100, 90) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUICtrlCreateGroup("Status", 175, 35, 80, 80) $cb6 = GUICtrlCreateCheckbox("Occupied", 185, 50) $cb7 = GUICtrlCreateCheckbox("Vacant", 185, 70) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUICtrlCreateGroup("Status", 15, 120, 420, 80) GUICtrlCreateLabel("KBI Unit :", 20, 140) GUICtrlCreateLabel("Buyers Unit :", 20, 160) GUICtrlCreateLabel("Apartment :", 160, 140) GUICtrlCreateLabel("Shop :", 160, 160) GUICtrlCreateLabel("Office :", 160, 180) GUICtrlCreateLabel("Occupied :", 300, 140) GUICtrlCreateLabel("Vacant :", 300, 160) $Label1 = GUICtrlCreateLabel("[ Unshow ]", 90, 140, 100, 20) GUICtrlSetColor(-1, 0x0000FF) $Label2 = GUICtrlCreateLabel("[ Unshow ]", 90, 160, 100, 20) GUICtrlSetColor(-1, 0x0000FF) $Label3 = GUICtrlCreateLabel("[ Unshow ]", 230, 140, 100, 20) GUICtrlSetColor(-1, 0x0000FF) $Label4 = GUICtrlCreateLabel("[ Unshow ]", 230, 160, 100, 20) GUICtrlSetColor(-1, 0x0000FF) $Label5 = GUICtrlCreateLabel("[ Unshow ]", 230, 180, 100, 20) GUICtrlSetColor(-1, 0x0000FF) $Label6 = GUICtrlCreateLabel("[ Unshow ]", 370, 140, 100, 20) GUICtrlSetColor(-1, 0x0000FF) $Label7 = GUICtrlCreateLabel("[ Unshow ]", 370, 160, 100, 20) GUICtrlSetColor(-1, 0x0000FF) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUICtrlCreateGroup("Data", 15, 235, 420, 410) $block = "Block I|Block II|Block III" GUICtrlCreateLabel("Block :", 30, 260) $selectblock = GUICtrlCreateCombo("Select Block", 70, 255, 90,"", $CBS_DROPDOWNLIST) GUICtrlSetData($selectblock, $block) GUICtrlSetBkColor($selectblock, 0x00FFFF) $blockButton = GUICtrlCreateButton("GO",165,253,25) GUISetState() GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group $cmdPrint = GUICtrlCreateButton("&Print", 170, 205, 80, 31, 0) $cmdAdd = GUICtrlCreateButton("&Add", 20, 650, 80, 31, 0) $cmdEdit = GUICtrlCreateButton("&Edit", 120, 650, 80, 31, 0) $cmdDelete = GUICtrlCreateButton("&Delete", 220, 650, 80, 31, 0) $cmdSave = GUICtrlCreateButton("&Save", 320, 650, 80, 31, 0) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $cb1, $cb2, $cb3, $cb4, $cb5, $cb6, $cb7 checkbox($Msg) EndSwitch WEnd EndFunc Func Checkbox($iCtrlID) $sTxt = "[ Unshow ]" If BitAND(GUICtrlRead($iCtrlID), $GUI_CHECKED) Then $sTxt = "[ Show ]" Switch $iCtrlID Case $cb1 GUICtrlSetData($Label1, $sTxt) Case $cb2 GUICtrlSetData($Label2, $sTxt) Case $cb3 GUICtrlSetData($Label3, $sTxt) Case $cb4 GUICtrlSetData($Label4, $sTxt) Case $cb5 GUICtrlSetData($Label5, $sTxt) Case $cb6 GUICtrlSetData($Label6, $sTxt) Case $cb7 GUICtrlSetData($Label7, $sTxt) EndSwitch EndFunc ;==>Checkbox Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 17, 2010 Moderators Share Posted June 17, 2010 thienfu, Here is a short script to give you the idea of how I would do it: expandcollapse popup#include <GUIConstantsEx.au3> #Include <GuiComboBox.au3> ; List for first combo $sList_Combo_1 = "One|Two|Three|Four|Five" ; Array of lists for second combo Global $aLists_Combo_2[5] = ["|A|B|C|D", "|G|H|I|J", "|M|N|O|P", "|Q|R|S|T", "|W|X|Y|Z"] ; Note | delimiter as first character in lists $hGUI = GUICreate("Test", 500, 500) ; Create first combo and set list $hCombo_1 = GUICtrlCreateCombo("", 10, 10, 230, 20) GUICtrlSetData($hCombo_1, $sList_Combo_1) ; Create second combo and disable $hCombo_2 = GUICtrlCreateCombo("", 260, 10, 230, 20) GUICtrlSetState($hCombo_2, $GUI_DISABLE) GUISetState() ; Set flag for first combo text change $sCurrComboText = "" While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch ; read first combo $sText = GUICtrlRead($hCombo_1) ; If text has changed AND the combo is closed If $sText <> $sCurrComboText And _GUICtrlComboBox_GetDroppedState($hCombo_1) = False Then ; Set new change flag $sCurrComboText = $sText ; Determine which element of the list was selected $iIndex = _GUICtrlComboBox_FindStringExact($hCombo_1, $sText) ; Set second combo with the relevant list GUICtrlSetData($hCombo_2, $aLists_Combo_2[$iIndex]) ; Enable second combo GUICtrlSetState($hCombo_2, $GUI_ENABLE) EndIf WEnd I hope it is all clear. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
thienfu Posted June 17, 2010 Author Share Posted June 17, 2010 Nice example Melba23. thanks very much, i will try use that script on my script Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 17, 2010 Moderators Share Posted June 17, 2010 (edited) thienfu, Post again if you run into difficulties. M23 Edit: Wrong button too soon! Edited June 17, 2010 by Melba23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
thienfu Posted June 17, 2010 Author Share Posted June 17, 2010 Hello Melba23, i've try you script on my script, but why another script like checkbox script cannot work and also my button no show below my script expandcollapse popup#include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIComboBox.au3> #include "GUICtrlOnHover.au3" Const $conProgName = "Schedulle Tenancy" Const $conDbFile = "db.mdb" ; it has to be on script current Dir Const $conTable = "db" Const $conOK = 1, $conEdit =1, $conAdd =0 Global $objDBSystem, $dbDatatBase, $recRecordSet Global $cb1, $cb2, $cb3, $cb4, $cb5, $cb6, $cb7 Global $Label1, $Label2, $Label3, $Label4, $Label5, $Label6, $Label7 Global $istart if Setup() = $conOK Then Main () EndIf Func Setup () $objDBSystem = ObjCreate("DAO.DBEngine.36") if $conOK <> FileExists (@ScriptDir & "\" & $conDbFile) Then Msgbox (16,$conProgName,"Database File is not found " & @Lf & @ScriptDir & "\" & $conDbFile) ;Return 0 Exit endif $dbDatatBase = $objDBSystem.OpenDatabase (@ScriptDir & "\" & $conDbFile) $recRecordSet = $dbDatatBase.OpenRecordset ("Select * From " & $conTable) Return $conOK EndFunc Func Shtdown() ; Close data base $recRecordSet.Close $dbDatatBase.Close EndFunc Func Main() GUICreate("PT. KBI - Schedulle Tenancy", 1000, 700) ; will create a dialog box GUISetBkColor(0xFFFBF0) ; will change background color $hTab = GUICtrlCreateTab(5, 10, 990, 685) $hTab0 = GUICtrlCreateTabItem("Main") GUICtrlCreateGroup("Owner", 15, 35, 70, 80) $cb1 = GUICtrlCreateCheckbox("KBI", 25, 50) $cb2 = GUICtrlCreateCheckbox("Buyers", 25, 70) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUICtrlCreateGroup("Type Unit", 90, 35, 80, 80) $cb3 = GUICtrlCreateCheckbox("Apartment", 100, 50) $cb4 = GUICtrlCreateCheckbox("Shop", 100, 70) $cb5 = GUICtrlCreateCheckbox("Office", 100, 90) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUICtrlCreateGroup("Status", 175, 35, 80, 80) $cb6 = GUICtrlCreateCheckbox("Occupied", 185, 50) $cb7 = GUICtrlCreateCheckbox("Vacant", 185, 70) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUICtrlCreateGroup("Status", 15, 120, 420, 80) GUICtrlCreateLabel("KBI Unit :", 20, 140) GUICtrlCreateLabel("Buyers Unit :", 20, 160) GUICtrlCreateLabel("Apartment :", 160, 140) GUICtrlCreateLabel("Shop :", 160, 160) GUICtrlCreateLabel("Office :", 160, 180) GUICtrlCreateLabel("Occupied :", 300, 140) GUICtrlCreateLabel("Vacant :", 300, 160) $Label1 = GUICtrlCreateLabel("[ Unshow ]", 90, 140, 100, 20) GUICtrlSetColor(-1, 0x0000FF) $Label2 = GUICtrlCreateLabel("[ Unshow ]", 90, 160, 100, 20) GUICtrlSetColor(-1, 0x0000FF) $Label3 = GUICtrlCreateLabel("[ Unshow ]", 230, 140, 100, 20) GUICtrlSetColor(-1, 0x0000FF) $Label4 = GUICtrlCreateLabel("[ Unshow ]", 230, 160, 100, 20) GUICtrlSetColor(-1, 0x0000FF) $Label5 = GUICtrlCreateLabel("[ Unshow ]", 230, 180, 100, 20) GUICtrlSetColor(-1, 0x0000FF) $Label6 = GUICtrlCreateLabel("[ Unshow ]", 370, 140, 100, 20) GUICtrlSetColor(-1, 0x0000FF) $Label7 = GUICtrlCreateLabel("[ Unshow ]", 370, 160, 100, 20) GUICtrlSetColor(-1, 0x0000FF) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUICtrlCreateGroup("Data", 15, 235, 420, 410) $block = "Block I|Block II|Block III" Global $type[3] = ["|A|B|C|D", "|G|H|I|J", "|M|N|O|P"] GUICtrlCreateLabel("Block :", 30, 260) $selectblock = GUICtrlCreateCombo("", 70, 255, 90) GUICtrlSetData($selectblock, $block) GUICtrlSetBkColor($selectblock, 0x00FFFF) GUICtrlCreateLabel("Unit :", 180, 260) $selectunit = GUICtrlCreateCombo("", 215, 255, 90) GUICtrlSetState($selectunit, $GUI_DISABLE) GUICtrlSetBkColor($selectunit, 0x00FFFF) GUISetState() $sCurrComboText = "" While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch ; read first combo $sText = GUICtrlRead($selectblock) ; If text has changed AND the combo is closed If $sText <> $sCurrComboText And _GUICtrlComboBox_GetDroppedState($selectblock) = False Then ; Set new change flag $sCurrComboText = $sText ; Determine which element of the list was selected $iIndex = _GUICtrlComboBox_FindStringExact($selectblock, $sText) ; Set second combo with the relevant list GUICtrlSetData($selectunit, $type[$iIndex]) ; Enable second combo GUICtrlSetState($selectunit, $GUI_ENABLE) EndIf WEnd GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group $cmdPrint = GUICtrlCreateButton("&Print", 170, 205, 80, 31, 0) $cmdAdd = GUICtrlCreateButton("&Add", 20, 650, 80, 31, 0) $cmdEdit = GUICtrlCreateButton("&Edit", 120, 650, 80, 31, 0) $cmdDelete = GUICtrlCreateButton("&Delete", 220, 650, 80, 31, 0) $cmdSave = GUICtrlCreateButton("&Save", 320, 650, 80, 31, 0) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $cb1, $cb2, $cb3, $cb4, $cb5, $cb6, $cb7 checkbox($Msg) EndSwitch WEnd EndFunc Func Checkbox($iCtrlID) $sTxt = "[ Unshow ]" If BitAND(GUICtrlRead($iCtrlID), $GUI_CHECKED) Then $sTxt = "[ Show ]" Switch $iCtrlID Case $cb1 GUICtrlSetData($Label1, $sTxt) Case $cb2 GUICtrlSetData($Label2, $sTxt) Case $cb3 GUICtrlSetData($Label3, $sTxt) Case $cb4 GUICtrlSetData($Label4, $sTxt) Case $cb5 GUICtrlSetData($Label5, $sTxt) Case $cb6 GUICtrlSetData($Label6, $sTxt) Case $cb7 GUICtrlSetData($Label7, $sTxt) EndSwitch EndFunc ;==>Checkbox Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 17, 2010 Moderators Share Posted June 17, 2010 thienfu,You cannot just put a section of code that someone gives you and place into your existing script at a random point - you have to blend the two together.You need only one main While...WEnd loop in a script. By placing my code where you did, you effectively cut off the remainder of your original script - hence a good part of your script no longer worked. Here is a version of the script where the combo code has been correctly positioned:expandcollapse popup#include <GUIConstantsEx.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GUIComboBox.au3> #include "GUICtrlOnHover.au3" Const $conProgName = "Schedulle Tenancy" Const $conDbFile = "db.mdb" ; it has to be on script current Dir Const $conTable = "db" Const $conOK = 1, $conEdit = 1, $conAdd = 0 Global $objDBSystem, $dbDatatBase, $recRecordSet Global $cb1, $cb2, $cb3, $cb4, $cb5, $cb6, $cb7 Global $Label1, $Label2, $Label3, $Label4, $Label5, $Label6, $Label7 Global $istart Global $block = "Block I|Block II|Block III" Global $type[3] = ["|A|B|C|D", "|G|H|I|J", "|M|N|O|P"] If Setup() = $conOK Then Main() EndIf Func Setup() $objDBSystem = ObjCreate("DAO.DBEngine.36") If $conOK <> FileExists(@ScriptDir & "\" & $conDbFile) Then MsgBox(16, $conProgName, "Database File is not found " & @LF & @ScriptDir & "\" & $conDbFile) ;Return 0 Exit EndIf $dbDatatBase = $objDBSystem.OpenDatabase(@ScriptDir & "\" & $conDbFile) $recRecordSet = $dbDatatBase.OpenRecordset("Select * From " & $conTable) Return $conOK EndFunc ;==>Setup Func Shtdown() ; Close data base $recRecordSet.Close $dbDatatBase.Close EndFunc ;==>Shtdown Func Main() GUICreate("PT. KBI - Schedulle Tenancy", 1000, 700) ; will create a dialog box GUISetBkColor(0xFFFBF0) ; will change background color $hTab = GUICtrlCreateTab(5, 10, 990, 685) $hTab0 = GUICtrlCreateTabItem("Main") GUICtrlCreateGroup("Owner", 15, 35, 70, 80) $cb1 = GUICtrlCreateCheckbox("KBI", 25, 50) $cb2 = GUICtrlCreateCheckbox("Buyers", 25, 70) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUICtrlCreateGroup("Type Unit", 90, 35, 80, 80) $cb3 = GUICtrlCreateCheckbox("Apartment", 100, 50) $cb4 = GUICtrlCreateCheckbox("Shop", 100, 70) $cb5 = GUICtrlCreateCheckbox("Office", 100, 90) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUICtrlCreateGroup("Status", 175, 35, 80, 80) $cb6 = GUICtrlCreateCheckbox("Occupied", 185, 50) $cb7 = GUICtrlCreateCheckbox("Vacant", 185, 70) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUICtrlCreateGroup("Status", 15, 120, 420, 80) GUICtrlCreateLabel("KBI Unit :", 20, 140) GUICtrlCreateLabel("Buyers Unit :", 20, 160) GUICtrlCreateLabel("Apartment :", 160, 140) GUICtrlCreateLabel("Shop :", 160, 160) GUICtrlCreateLabel("Office :", 160, 180) GUICtrlCreateLabel("Occupied :", 300, 140) GUICtrlCreateLabel("Vacant :", 300, 160) $Label1 = GUICtrlCreateLabel("[ Unshow ]", 90, 140, 100, 20) GUICtrlSetColor(-1, 0x0000FF) $Label2 = GUICtrlCreateLabel("[ Unshow ]", 90, 160, 100, 20) GUICtrlSetColor(-1, 0x0000FF) $Label3 = GUICtrlCreateLabel("[ Unshow ]", 230, 140, 100, 20) GUICtrlSetColor(-1, 0x0000FF) $Label4 = GUICtrlCreateLabel("[ Unshow ]", 230, 160, 100, 20) GUICtrlSetColor(-1, 0x0000FF) $Label5 = GUICtrlCreateLabel("[ Unshow ]", 230, 180, 100, 20) GUICtrlSetColor(-1, 0x0000FF) $Label6 = GUICtrlCreateLabel("[ Unshow ]", 370, 140, 100, 20) GUICtrlSetColor(-1, 0x0000FF) $Label7 = GUICtrlCreateLabel("[ Unshow ]", 370, 160, 100, 20) GUICtrlSetColor(-1, 0x0000FF) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group GUICtrlCreateGroup("Data", 15, 235, 420, 410) GUICtrlCreateLabel("Block :", 30, 260) $selectblock = GUICtrlCreateCombo("", 70, 255, 90) GUICtrlSetData($selectblock, $block) GUICtrlSetBkColor($selectblock, 0x00FFFF) GUICtrlCreateLabel("Unit :", 180, 260) $selectunit = GUICtrlCreateCombo("", 215, 255, 90) GUICtrlSetState($selectunit, $GUI_DISABLE) GUICtrlSetBkColor($selectunit, 0x00FFFF) GUICtrlCreateGroup("", -99, -99, 1, 1) ;close group $cmdPrint = GUICtrlCreateButton("&Print", 170, 205, 80, 31, 0) $cmdAdd = GUICtrlCreateButton("&Add", 20, 650, 80, 31, 0) $cmdEdit = GUICtrlCreateButton("&Edit", 120, 650, 80, 31, 0) $cmdDelete = GUICtrlCreateButton("&Delete", 220, 650, 80, 31, 0) $cmdSave = GUICtrlCreateButton("&Save", 320, 650, 80, 31, 0) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) $sCurrComboText = "" While 1 $Msg = GUIGetMsg() Switch $Msg Case $GUI_EVENT_CLOSE Exit Case $cb1, $cb2, $cb3, $cb4, $cb5, $cb6, $cb7 checkbox($Msg) EndSwitch ; read first combo $sText = GUICtrlRead($selectblock) ; If text has changed AND the combo is closed If $sText <> $sCurrComboText And _GUICtrlComboBox_GetDroppedState($selectblock) = False Then ; Set new change flag $sCurrComboText = $sText ; Determine which element of the list was selected $iIndex = _GUICtrlComboBox_FindStringExact($selectblock, $sText) ; Set second combo with the relevant list GUICtrlSetData($selectunit, $type[$iIndex]) ; Enable second combo GUICtrlSetState($selectunit, $GUI_ENABLE) EndIf WEnd EndFunc ;==>Main Func Checkbox($iCtrlID) $sTxt = "[ Unshow ]" If BitAND(GUICtrlRead($iCtrlID), $GUI_CHECKED) Then $sTxt = "[ Show ]" Switch $iCtrlID Case $cb1 GUICtrlSetData($Label1, $sTxt) Case $cb2 GUICtrlSetData($Label2, $sTxt) Case $cb3 GUICtrlSetData($Label3, $sTxt) Case $cb4 GUICtrlSetData($Label4, $sTxt) Case $cb5 GUICtrlSetData($Label5, $sTxt) Case $cb6 GUICtrlSetData($Label6, $sTxt) Case $cb7 GUICtrlSetData($Label7, $sTxt) EndSwitch EndFunc ;==>CheckboxYou see how it goes? Create the GUI, create all the controls, show the GUI with GUISetState, run the While...WEnd loop to look for control actions.Is that all clear? Please ask if not, because it is a pretty fundamental point in coding with AutoIt. m23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
thienfu Posted June 17, 2010 Author Share Posted June 17, 2010 Thanks again Melba23 now script can work for all function and thanks for u advise, sory i still newbie and still learning for this autoit3 script So one GUI just can do one while function? i just now know about that Thanks again for u info and advise. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 17, 2010 Moderators Share Posted June 17, 2010 thienfu,sory i still newbieThere is no need to apologise - we all began at that same level. I am glad you understand the comments I made. M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
harishbehl Posted September 10, 2010 Share Posted September 10, 2010 Hi Melba23, I want to set some default value for the 1st combo box and the basis of this value, values should be shown in the 2nd combo box. I have set the default value for 1st combo box but not able to set selected default value in 2nd combo box. Can you please guide how can I do that? Thanks, Harish Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 11, 2010 Moderators Share Posted September 11, 2010 harishbehl, Welcome to the AutoIt forum. Just add another dimension to the array like this: #include <GUIConstantsEx.au3> #include <GUIComboBox.au3> Global $aArray[3][2] = [["G|H|I", "G"], ["L|M|N|", "N"], ["X|Y|Z", "Y"]] $hGUI = GUICreate("Test", 500, 500) $hCombo_1 = GUICtrlCreateCombo("", 10, 10, 200, 20) GUICtrlSetData(-1, "A|B|C", "B") $hCombo_2 = GUICtrlCreateCombo("", 260, 10, 200, 20) GUISetState() $sCurrText_1 = GUICtrlRead($hCombo_1) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch $sText = GUICtrlRead($hCombo_1) If $sText <> $sCurrText_1 And _GUICtrlComboBox_GetDroppedState($hCombo_1) = False Then $sCurrText_1 = $sText $iIndex = _GUICtrlComboBox_FindStringExact($hCombo_1, $sText) GUICtrlSetData($hCombo_2, $aArray[$iIndex][0], $aArray[$iIndex][1]) EndIf WEnd All clear? M23  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area  Link to comment Share on other sites More sharing options...
harishbehl Posted September 12, 2010 Share Posted September 12, 2010 Thanks M23!!! It's working fine now. I would appreciate that you are doing a good job!! 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