Sign in to follow this  
Followers 0
SlimShady

Scrollbar in a list box

10 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

You need WS_VSCROLL as well.

Share this post


Link to post
Share on other sites

I mean a scrollbar in a listbox. Or is it not possible?

Share this post


Link to post
Share on other sites

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


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

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

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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.

Share this post


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
Sign in to follow this  
Followers 0