Jump to content

$LBS_STANDARD wrong value ?


Recommended Posts

Hi everybody :)
In the help file (topic GUI Control Styles) we notice that $LBS_STANDARD is given a value of 0xA00003, which seems correct and corresponds to MSDN webpage. It's the BitOr of 4 styles, which are :

LBS_NOTIFY (0x0001), LBS_SORT (0x0002), WS_VSCROLL (0x00200000), WS_BORDER (0x00800000)

But in the include file ListBoxConstants.au3, we see :

Global Const $LBS_STANDARD = 0x00000003 ; Standard list box style

Which means that, for example, a vertical scrollbar won't appear in the help file example (topic _GUICtrlListBox_GetSel) after you change this line...

; $idListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL)) ; original line

...with that line :

$idListBox = GUICtrlCreateList("", 2, 2, 300, 100, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL)) ; missing vertical scrollbar => some lines are now hidden

In fact, $LBS_STANDARD should have the same value as $GUI_SS_DEFAULT_LIST, which is declared like this in ListBoxConstants.au3 :

Global Const $GUI_SS_DEFAULT_LIST = 0x00a00003 ; BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY)

Should a trac ticket be opened for this or not ?

Link to comment
Share on other sites

You can open a trac ticket as compared to winuser.h the value is not correct.

I wouldn't know how we created all the windows xxxx constants manual labour or generated based on SDK headerfiles. For that we need one of the developers.

but it would help  probably in prioritizing if you have a real world example of whats functionally going wrong under which circumstances. The example you give you miss the scrollbar when there are more items but you can still reach them with your keyboard up/down keys

workaround: 

BitOR($LBS_NOTIFY, $LBS_SORT , $WS_VSCROLL , $WS_BORDER (0x00800000)

Example you refer to 

   ; $idListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
    $idListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR(BitOR($LBS_NOTIFY, $LBS_SORT , $WS_VSCROLL , $WS_BORDER ), $LBS_EXTENDEDSEL))

Full example copied below

#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiListBox.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $idListBox

    ; Create GUI
    GUICreate("List Box Get Sel", 400, 296)
   ; $idListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
   ; $idListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
    $idListBox = GUICtrlCreateList("", 2, 2, 396, 296, BitOR(BitOR($LBS_NOTIFY, $LBS_SORT , $WS_VSCROLL , $WS_BORDER ), $LBS_EXTENDEDSEL))

    GUISetState(@SW_SHOW)

    ; Add strings
    _GUICtrlListBox_BeginUpdate($idListBox)
    For $iI = 1 To 9
        _GUICtrlListBox_AddString($idListBox, StringFormat("%03d : Random string", Random(1, 100, 1)))
    Next
    _GUICtrlListBox_EndUpdate($idListBox)

    ; Select a few items
    _GUICtrlListBox_SetSel($idListBox, 3)
    _GUICtrlListBox_SetSel($idListBox, 4)
    _GUICtrlListBox_SetSel($idListBox, 5)

    ; Show the item selection state
    MsgBox($MB_SYSTEMMODAL, "Information", "Item 5 Selected: " & _GUICtrlListBox_GetSel($idListBox, 4))

    ; Loop until the user exits.
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
    GUIDelete()
EndFunc   ;==>Example

consolewrite(hex(BitOR($LBS_NOTIFY, $LBS_SORT , $WS_VSCROLL , $WS_BORDER )))

 

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