water Posted November 20, 2016 Share Posted November 20, 2016 I'm not sure I fully understand. You want to have one combo to select the language from You want to have a second combo to select a product from This product combo should list the products in the language the user has selected before? meoit 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
meoit Posted November 20, 2016 Author Share Posted November 20, 2016 OK, @water . I will explain... > ComBo 1: this is Combo to change all languages of GUI (as before we do). > ComBo 2: example, it called the Product Combo. With the first index (the first value) of the ComBo 2, I set data is "Please select a product". The string "Please select a product" is also a part of language strings (as Array). After ComBo 1 change value (as change language for GUI) then the first index (the first value) of the ComBo 2 also change with new language string. Link to comment Share on other sites More sharing options...
water Posted November 20, 2016 Share Posted November 20, 2016 Another (hopefully final) question: When do you set the values for combo 2 so the user can select from ? Means: The default value for combo 2 would be the language dependant text ("Please select a product", "โปรดเลือกสินค้า" etc.). When the user then selects combo 2 a list of products should be displayed. Where do you get this list from (a txt file, an ERP ...) and when should the combo be filled with this values? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
meoit Posted November 20, 2016 Author Share Posted November 20, 2016 (edited) 1 hour ago, water said: Means: The default value for combo 2 would be the language dependant text ("Please select a product", "โปรดเลือกสินค้า" etc.). Sorry for my bad English. Yes, right. I need change language for the first value of ComboBox 2. Always. The values can get from: Global $aGUI1[$iGUI_Elements], $aGUILanguage1[$iGUI_Elements][2] = [["Window title", "Fenstertitel"], ["LabelCombo", "Text Combo"], ["Please select a product (default lang)", "Please select a product (Switched lang)"], ["Label", "Text"], ["Button", "Schaltknopf"]] Edited November 20, 2016 by meoit Link to comment Share on other sites More sharing options...
water Posted November 20, 2016 Share Posted November 20, 2016 Shouldn't be too hard. Where do the other values for the combo box 2 come from? I ask because you can not just change a single entry (in this case the first one) of a combo. When you set a value that exists in this value is selcted as the default value. Else the new value overwrites the existing combo. So if we want to change the first entry then we need to set the whole combo to the new first line plus all "products" the user can select. meoit 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
meoit Posted November 20, 2016 Author Share Posted November 20, 2016 The first index of Combo 2 is only a guide text, it is not value to use and not a product to users choice. Link to comment Share on other sites More sharing options...
water Posted November 23, 2016 Share Posted November 23, 2016 I suggest something like this: expandcollapse popup#include <Constants.au3> #include <GUIConstants.au3> #include <StringConstants.au3> Opt('MustDeclareVars', 1) Global $iGUI_Elements = 5, $iCurrentLanguage = 0, $iCurrentGUI = 1 Global $iLanguages = 3, $sLanguages = "English|Thailand|Indonesia", $sSelectedLanguage Global $aGUI1[$iGUI_Elements], $aGUILanguage1[$iGUI_Elements][$iLanguages] = [["English title 1", "Thai title 1", "Indonisian title 1"], ["English Combo 1", "Thai Combo 1", "Indonisian Combo 1"], ["Please select a product (English)", "Please select a product (Thai)", "Please select a product (Indonisian)"], ["|English Product 1|English Product 2", "|Thai Product 1|Thai Product 2", "|Indonisian Product 1|Indonisian Product 2"], ["English Button 1", "Thai Button 1", "Indonisian Button 1"]] Global $aGUI2[$iGUI_Elements], $aGUILanguage2[$iGUI_Elements][$iLanguages] = [["English title 2", "Thai title 2", "Indonisian title 2"], ["English Combo 2", "Thai Combo 2", "Indonisian Combo 2"], ["English label 2", "Thai Label 2", "Indonisian Label 2"], ["English Button 2", "Thai Button 2", "Indonisian Button 2"]] Global $idCombo, $aLanguages = StringSplit($sLanguages, "|", $STR_NOCOUNT) $aGUI1[0] = GUICreate($aGUILanguage1[0][$iCurrentLanguage], 315, 170, -1, -1) ; GUI title $aGUI1[1] = GUICtrlCreateLabel($aGUILanguage1[1][$iCurrentLanguage], 10, 10, 93, -1) ; Label $idCombo = GUICtrlCreateCombo("", 105, 10, 195, -1, 0x0003) ; Combo GUICtrlSetData(-1, $sLanguages, $aLanguages[0]) $aGUI1[2] = GUICtrlCreateLabel($aGUILanguage1[2][$iCurrentLanguage], 105, 40, 195, -1) ; Label $aGUI1[3] = GUICtrlCreateCombo("", 105, 57, 195, -1, 0x0003) ; Combo2 GUICtrlSetData(-1, $aGUILanguage1[3][$iCurrentLanguage]) $aGUI1[4] = GUICtrlCreateButton($aGUILanguage1[4][$iCurrentLanguage], 10, 130, 290, -1) ; Button GUISetState(@SW_SHOW) While 1 Local $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idCombo $sSelectedLanguage = GUICtrlRead($idCombo) For $i = 0 To UBound($aLanguages) - 1 If $sSelectedLanguage = $aLanguages[$i] Then If $i <> $iCurrentLanguage Then $iCurrentLanguage = $i _SwitchLanguage($aGUI1, $aGUILanguage1) ExitLoop EndIf EndIf Next EndSwitch WEnd Func _SwitchLanguage(ByRef $aGUI, ByRef $aGUILanguage) Local $iRC = WinSetTitle($aGUI[0], "", $aGUILanguage[0][$iCurrentLanguage]) For $i = 1 To UBound($aGUI) - 1 GUICtrlSetData($aGUI[$i], $aGUILanguage[$i][$iCurrentLanguage]) Next EndFunc ;==>_SwitchLanguage meoit 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
meoit Posted November 23, 2016 Author Share Posted November 23, 2016 Thanks to @water ! Nearly exactly what I wished for. Can you put the String of Label (which located above ComboBox2) into ComboBox2 (inside, at the first index) ?. Link to comment Share on other sites More sharing options...
water Posted November 23, 2016 Share Posted November 23, 2016 Sure. Simply replace "|English Product 1|English Product 2" with "|Please select a product (English)|English Product 1|English Product 2". The only problem is that you somehow need to ignore the first selection because it is not a valid selection you want to process. So the code I suggest is a bit simpler. meoit 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
meoit Posted November 23, 2016 Author Share Posted November 23, 2016 Thanks to @water . That's right. I was prepared to ignore it. It is only for showup a guide text, and invalid value for use. Now I will try again new your code. And I will feedback later. Link to comment Share on other sites More sharing options...
water Posted November 23, 2016 Share Posted November 23, 2016 If I find some spare time I will add some documentation to my code for easier use and later reference My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki 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