Jump to content

Scrollbar in a list box


Recommended Posts

I have a listbox:

- I want to see a scrollbar when content doesn't fit in the current size

- AND the list items should not be sorted alphabetically.

I can't make it work.

I tried this:

$style2 = BitOr(0x00800000, 0x10000000)
$ItemList1 = GUISetControl("list", "ItemList", 160, 40, 120, 225, $style2)

From the help file:

List box styles                        Value

LBS_DISABLENOSCROLL      0x1000

LBS_USETABSTOPS                0x0080

Edited by SlimShady
Link to comment
Share on other sites

And what are those 2 styles?  You'll get a lot more help a lot faster when you use the style names, not their number equivalents.

I don't care much. I'm not in a hurry.

Anyways, I was tired and quickly made this topic.

I updated the first post.

Link to comment
Share on other sites

  • Developers

LBS_DISABLENOSCROLL currently disables the scrollbar but the helpfile description says it should always display the vertical scroll bar...

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

SlimShady, Did you actually try adding that style in?

JdeB, LBS_DISABLENOSCROLL shows a scrollbar at all times. If there is not enough stuff in the list, then it is disabled, otherwise (And provided WS_VSCROLL is set), then the scrollbar will be enabled.

Link to comment
Share on other sites

Should use the symbolic name... those styles aren't correct... There is a 4 bit difference between 0x00800000 and 0x0080:

0x00800000 = 8388608

0x0080 = 128 <--- The correct one.

#include <GuiConstants.au3>

GuiCreate("Blah", 300, 300)
$style2 = BitOr($LBS_DISABLENOSCROLL, $LBS_USETABSTOPS)
$style2 = BitOr($style2, $WS_VSCROLL)
$ItemList1 = GUISetControl("list", "ItemList", 160, 40, 120, 75, $style2)
GuiSetControlData($ItemList1, "Blah|cool|abcde|exdfs|sfksjdlf|sldfkslfj|flskdfgjsdl|slkdhj")
GUIWaitClose()
Edited by Valik
Link to comment
Share on other sites

  • Developers

understand what you are saying but my point was that if you use this script:

#include <GuiConstants.au3>
GuiCreate("Blah", 300, 300)
$ItemList1 = GUISetControl("list", "ItemList", 160, 40, 120, 75)
GuiSetControlDataGUIWaitClose()
it will show the vscrollbar only when the records don't fit the listbox and then when you look at the explanation in the helpfile:

LBS_DISABLENOSCROLL  0x1000 Shows a disabled vertical scroll bar for the list box when the box does not contain enough items to scroll. If you do not specify this style, the scroll bar is hidden when the list box does not contain enough items.

You would expect that when you add LBS_DISABLENOSCROLL, it would always show the vScrolllBar.....

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

What I tested:

action: Give the listbox no style.

result: listbox has a vertical scrollbar.

action: Give listbox the LBS_USETABSTOPS style, so sorting alphabetically is disabled.

result: no vertical scrollbar, LBS_USETABSTOPS works fine.

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