Jump to content

What do these ListBox styles mean?

Recommended Posts

I'm trying to implement ListBoxes in my GUI, and am reading the API reference for _GUICtrlListBox_Create parameters. I do not understand these particular styles:

  • $LBS_EXTENDEDSEL - Allows multiple items to be selected
  • $LBS_HASSTRINGS - Specifies that a list box contains items consisting of strings
  • $LBS_MULTIPLESEL - Turns string selection on or off each time the user clicks a string
  • $LBS_NODATA - Specifies a no-data list box

First question: For $LBS_NODATA, does it mean that the listbox CAN be empty, or it can ONLY be empty?

Second question: What is the purpose of $LBS_HASSTRINGS ? Aren't all listbox values strings? Why is it necessary to specify this style option? What's the implications of checking and unchecking it?

Third question: What's the difference between $LBS_EXTENDEDSEL and $LBS_MULTIPLESEL when it comes to allowing multiple listbox items to be selected?

Link to post
Share on other sites
  • Moderators


The Google force was evidently not with you! Looking on MSDN gives the following more detailed explanations:


LBS_EXTENDEDSEL The user can select multiple items using the SHIFT key and the mouse or special key combinations.

LBS_MULTIPLESEL String selection is toggled each time the user clicks or double-clicks the string. Any number of strings can be selected

So it seems that the first style requires an additional key/s to be pressed to select multiple items whereas the second style will select multiple items simply by using the mouse.


LBS_HASSTRINGS Specifies an owner-draw list box that contains items consisting of strings. The list box maintains the memory and pointers for the strings so the application can use the GetText member function to retrieve the text for a particular item.

LBS_NODATA Specifies a no-data list box. Specify this style when the count of items in the list box will exceed one thousand. A no-data list box must also have the LBS_OWNERDRAWFIXED style, but must not have the LBS_SORT or LBS_HASSTRINGS style.

A no-data list box resembles an owner-drawn list box except that it contains no string or bitmap data for an item. Commands to add, insert, or delete an item always ignore any given item data; requests to find a string within the list box always fail. The system sends the WM_DRAWITEM message to the owner window when an item must be drawn. The itemID member of the DRAWITEMSTRUCT structure passed with the WM_DRAWITEM message specifies the line number of the item to be drawn. A no-data list box does not send a WM_DELETEITEM message.

These styles refer to owner-drawn listboxes, which are far more complicated then the standard controls usually used in AutoIt - so in my view they can safely be ignored by us normal users.



Edited by Melba23
Wrong button too soon

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:


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 post
Share on other sites

@Melba23 Thanks! I Google'd these styles but all I got is the online AutoIT reference and posts from this forum which don't elaborate on what these do. I haven't seen a single link related to msdn. After all the stuff I've been doing I'm starting to believe they need to be clearer on what is defined by AutoIT and what is actually defined by Windows itself...


These styles refer to owner-drawn listboxes, which are far more complicated then the standard controls usually used in AutoIt - so in my view they can safely be ignored by us normal users.

So I can use $LBS_MULTIPLESEL without specifying $LBS_HASSTRINGS ? I got confused by some other thread in this forum, that the tool must go hand in hand to work.

Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...