Jump to content

Combobox set name?


Recommended Posts

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 by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

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

 

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 by AutoBert
Link to comment
Share on other sites

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 by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

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

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...