Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Here is an implementation of a combobox feature for NiGui (Windows only).
Comboboxes can have several styles:
CBS_SIMPLE
,CBS_DROPDOWN
, orCBS_DROPDOWNLIST
so I included a way to pass the desired type when creating the combobox. Possible values are:simple
(default),dropdown
,dropdownlist
. Leaving this unspecified will default toCBS_SIMPLE
Creating a combobox:
var combobox = newComboBox(@["Choice 1", "Choice 2"], "dropdown")
var combobox2 = newComboBox()
(will create empty combobox)I've created a few methods as well for combobox interactions:
getOptionCount()
: returns number of options currently available in dropdownaddOption(<string>)
: adds a new option to bottom of dropdowndeleteOption(<int>)
: deletes option from list at index specifiedselectOption(<int>)
: selects option at indexfindOptionIndex(<string>)
: searches list of options, returns index or -1 (not found)getSelectedIndex()
: returns the index of the selected option (-1 if none selected)getSelectedValue()
: returns the value of the selected option ("" if none selected)The
natualHeight
probably needs work. I am not sure how to best size theCBS_SIMPLE
combobox. ThegetTextLineHeight()
appears to be different for the selected value box and each of the dropdown items.Again, I am new to Nim and have never done any Win32 development until last week so I am not sure if everything is done properly but this should hopefully help you roll out this in a future release.