Jump to content

_GUICtrlListBox_SetTabStops on non LBS_USETABSTOPS style


Recommended Posts

I'd like to add tab Stops to a previously created listbox. Maybe use a GUICtrlSendMsg() or _SendMessage() but I don't know. Help 

#include <GUIConstantsEx.au3>
#include <GuiListBox.au3>
#include <WinAPI.au3>


Func Example()
    Local $aTabs[4] = [3, 100, 200, 300], $idListBox

    ; Create GUI
    GUICreate("List Box Set Tab Stops", 400, 296)
    $idListBox = GUICtrlCreateList("", 2, 2, 396, 296) ;, BitOR($LBS_STANDARD, $LBS_USETABSTOPS))

    Local $Style = _WinAPI_GetWindowLong(GUICtrlGetHandle($idListBox), $GWL_STYLE) ;Capture Existing Style
;~  Local $ExStyle = _WinAPI_GetWindowLong(GUICtrlGetHandle($idListBox), $GWL_EXSTYLE) ;Capture Existing ExStyle
    ConsoleWrite("- before   $Style = 0x" & Hex($Style) & @CRLF)
;~  ConsoleWrite("- before $ExStyle = 0x" & Hex($ExStyle) & @CRLF)
    GUICtrlSetStyle($idListBox, BitOR($Style, $LBS_USETABSTOPS)) ; change the Style
    $Style = _WinAPI_GetWindowLong(GUICtrlGetHandle($idListBox), $GWL_STYLE)
;~  $ExStyle = _WinAPI_GetWindowLong(GUICtrlGetHandle($idListBox), $GWL_EXSTYLE)
    ConsoleWrite("- after    $Style = 0x" & Hex($Style) & @CRLF) ; updated style but is not reflected in it's behaviour
;~  ConsoleWrite("- after  $ExStyle = 0x" & Hex($ExStyle) & @CRLF)

    ; Set tab stops
    _GUICtrlListBox_SetTabStops($idListBox, $aTabs)

    ; Add tabbed string
    _GUICtrlListBox_AddString($idListBox, "Column 1" & @TAB & "Column 2" & @TAB & "Column 3")

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


Edited by argumentum
better example

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.

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

  • Create New...