Terenz Posted June 5, 2016 Share Posted June 5, 2016 (edited) A strange question, how to set the name of the combobox? #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form = GUICreate("Form1", 346, 197, -1, -1) $Combo1 = GUICtrlCreateCombo("Combo1", 56, 24, 145, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $WS_VSCROLL)) GUICtrlSetData(-1, "Combo2|Combo3") $Combo2 = GUICtrlCreateCombo("", 56, 54, 145, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL, $WS_VSCROLL)) GUICtrlSetData(-1, "Combo1|Combo2|Combo3") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd GUICtrlSetData has a different behaviors respect other control, for Combobox populating the items but leave the control empty. Isn't strange? I have see there are function for set the selection item but why we can set the Combo "name" parameter? Or i'm miss something? Edited June 5, 2016 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
MichaelHB Posted June 5, 2016 Share Posted June 5, 2016 From the helpfile (GUICtrlSetData): Parameters controlID The control identifier (controlID) as returned by a GUICtrlCreate...() function, or -1 for the last created control. data Combo, List, ListView, ListViewItem: An Opt("GUIDataSeparatorChar",...) separated list of items. Progress: The percentage. Slider: The value. Button, Checkbox, Combo, Edit, Group, Input, Label, List, Menu, MenuItem, Radio, TabItem, TreeViewItem: Replaces the text. Date : The date or time depending the style of the control and the regional settings. Dummy: The value. default [optional]Combo, List: The default value. Edit, Input: If non-empty (""), the string is inserted at the current insertion point (caret). Link to comment Share on other sites More sharing options...
Terenz Posted June 5, 2016 Author Share Posted June 5, 2016 I don't have understand, what i need to make for the third parameter? The index of the combo not work Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
MichaelHB Posted June 5, 2016 Share Posted June 5, 2016 Terenz, The value. In your example try: GUICtrlSetData(-1, "Combo1|Combo2|Combo3", "Combo2") Got it? Link to comment Share on other sites More sharing options...
Terenz Posted June 5, 2016 Author Share Posted June 5, 2016 Oh, totally miss that. Well the index was better but is ok also in that way. Thanks Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
AutoBert Posted June 5, 2016 Share Posted June 5, 2016 (edited) 9 minutes ago, Terenz said: Well the index was better seems hard for you to look in helpfile: Quote _GUICtrlComboBoxEx_SetCurSel Select a string in the list of a ComboBox #include <GuiComboBoxEx.au3> _GUICtrlComboBoxEx_SetCurSel ( $hWnd [, $iIndex = -1] ) Parameters $hWnd Handle to the control $iIndex [optional] Specifies the 0-based index of the string to select Return Value Success: True. Failure: False. Remarks If $iIndex is –1, any current selection in the list is removed and the edit control is cleared. If $iIndex is greater than the number of items in the list or if $iIndex is –1, the return value is -1 and the selection is cleared. Edited June 5, 2016 by AutoBert Link to comment Share on other sites More sharing options...
Terenz Posted June 5, 2016 Author Share Posted June 5, 2016 (edited) I have already know that UDF\function --> "I have see there are function for set the selection item" seems hard for you read the OP...Thanks anyway. Edited June 5, 2016 by Terenz Nothing is so strong as gentleness. Nothing is so gentle as real strength Link to comment Share on other sites More sharing options...
AutoBert Posted June 5, 2016 Share Posted June 5, 2016 3 minutes ago, Terenz said: I have already know that UDF\function --> "I have see there are function for set the selection item" seems hard for you read the OP...Thanks anyway. I read it, but as you can see in my quoted snipet it can be found. So: 9 minutes ago, AutoBert said: seems hard for you to look in helpfile and next time not only for 5 seconds, may be you can found such easy things too. You use GuiCtrlSetData and wondering about behavoir with your used control, why not read carefully helpfile or testing example to GUICtrlCreateCombo? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 5, 2016 Moderators Share Posted June 5, 2016 Hi, Keep it civil please. Unfortunately, it seems that the same names keep cropping up when I have to say that - perhaps those members should think about changing their behaviour a bit.... 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...
Terenz Posted June 5, 2016 Author Share Posted June 5, 2016 Melba fortunately for me this thread has finished its task and never replies to childish lecturing attempt and i'm thanks for every contribution , maybe because I'm an older man now lol. I wish you a good evening or whatever is your time zone. Nothing is so strong as gentleness. Nothing is so gentle as real strength 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