Jump to content

ComboBox and array question...


Recommended Posts

Hi to all, i've a new question to do...

I'm playing with KODA but i dont have find this option/style for combobox...i want to do an combobox like that :

Posted Image

I want to display the "scroll bar" line in the combo...how you can see on this picture.

Now i'have another question...is possible to have a color item in the combo box?...and is possible to set height of the combo?

Now another question on an array, for example i've this array :

Global $Country[10] = ['Africa',' Algeria',' Angola',' Burkina Faso',' Burundi',' Cameroon',' Cape Verde',' Congo']

Is possible to break the array line like that:

Global $Country[10] &= ['Africa','Algeria','Angola','Burkina Faso','Burundi'] ;I want break the line
Global $Country[10] &= ['Cameroon','Cape Verde','Congo'] ;I want to continue the array contenent in another line

But it dont work...how i can do that?

Hi!

Edited by StungStang
Link to comment
Share on other sites

  • Moderators

StungStang,

Just add the $WS_VSCROLL style to the combo to get a scrolbar. :P

But you will need to limit the size of the combo - if you do not then the number of elements can reach quite large values before the scrollbar appears. You do this by sending the scroll bar a $CB_SETMINVISIBLE message - although it actually sets the maximum number of visible elements! :)

And you use the _ character to extend lines.

Here are all 3 of these in a simple script:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ComboConstants.au3>

Global $aCountry[8] = ['Africa','Algeria','Angola','Burkina Faso','Burundi', _
                    'Cameroon','Cape Verde','Congo'] ; Use _ to extend lines

$sData = ""
For $i = 0 To 7
    $sData &= $aCountry[$i] & "|"
Next

$hGUI = GUICreate("Test", 500, 500)

$hCombo = GUICtrlCreateCombo("", 10, 10, 100, 20, BitOR($CBS_DROPDOWNLIST,$WS_VSCROLL)) ; Add scroll bar

GUICtrlSendMsg($hCombo, $CB_SETMINVISIBLE, 5, 0) ; Limit max number of items to show

GUICtrlSetData($hCombo, $sData)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch

WEnd

All clear? :)

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

  • Moderators

StungStang,

Colour is not as easy as that - take a look here for some ideas. :)

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

If you need to display colors, I propose to use ComboBoxEx and then use Icons to display the color and not modify the textcolor.

Edit: See the example for _GUICtrlComboBoxEx_SetItemImage.

Edited by ProgAndy

*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Link to comment
Share on other sites

  • Moderators

StungStang,

I do not believe that is possible. You will need to either reload your combo without the item you do not want to select (my preferred solution) or deal with the item once it has been selected. :)

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

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...