Jump to content

How to add a horizontal scroll the listbox?


Go to solution Solved by Andreik,

Recommended Posts

How to add a horizontal scroll the listbox?

I have tried $WS_HSCROLL, and I have tried using _GUICtrlListView_SetColumnWidth to set the listbox column width to be larger than the listbox itself as one post suggested.

None of it is working.

expand popup
#Include <SQLite.au3>
#include <GuiListBox.au3>
#include <GuiListView.au3>
#include <Date.au3>
#include <File.au3>
#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ScrollBarConstants.au3>
#Include <Math.au3>
#Include <Inet.au3>

#Region CreateGUI
    ;create gui
    Global $hGUI = GUICreate("Applanix Automation", 400, 350, 210, 0)
    GUISetOnEvent($GUI_EVENT_CLOSE, EndCode)

    Global $btnBrowse = GUICtrlCreateButton("Start", 10, 2, 76, 20)
    Global $lblBrowse = GUICtrlCreateLabel("Project Directory", 100, 5, 286, 16)
    Global $Label_5 = GUICtrlCreateLabel("APPLANIX", 10, 30, 76, 20)
    Global $Label_1 = GUICtrlCreateLabel("TIME SYNC", 10, 55, 76, 20)
    Global $Label_2 = GUICtrlCreateLabel("INJ TC", 10, 80, 76, 20)
    Global $Label_3 = GUICtrlCreateLabel("INJ PP", 10, 105, 76, 20)
    Global $Label_4 = GUICtrlCreateLabel("DR", 10, 130, 76, 20)
    Global $lblApplxStatus = GUICtrlCreateLabel("n/x", 100, 30, 56, 20)
    Global $lblTSStatus = GUICtrlCreateLabel("n/x", 100, 55, 56, 20)
    Global $lblITCStatus = GUICtrlCreateLabel("n/x", 100, 80, 56, 20)
    Global $lblIPPStatus = GUICtrlCreateLabel("n/x", 100, 105, 56, 20)
    Global $lblDRStatus = GUICtrlCreateLabel("n/x", 100, 130, 56, 20)
    Global $lstLog = GUICtrlCreateList(" ", 30, 155, 346, 176, $listBoxStyle)
    GUISetState(@SW_SHOWNORMAL)

    for $i = 0 to 50
        GUICtrlSetData($lstLog,_NowTime(5) & " " &  50 - $i & " testttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt")
    Next

    _GUICtrlListView_SetColumnWidth($lstLog,0,500)
#EndRegion ;CreateGUI


While 1

wend

image.png.57cb6bb7f61592f75ca5a88516da9de2.png

Link to comment
Share on other sites

  • Solution
#Include <SQLite.au3>
#include <GuiListBox.au3>
#include <GuiListView.au3>
#include <Date.au3>
#include <File.au3>
#include <Array.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ScrollBarConstants.au3>
#Include <Math.au3>
#Include <Inet.au3>

#Region CreateGUI
    ;create gui
    Global $hGUI = GUICreate("Applanix Automation", 400, 350, 210, 0)
;~     GUISetOnEvent($GUI_EVENT_CLOSE, EndCode)

    Global $btnBrowse = GUICtrlCreateButton("Start", 10, 2, 76, 20)
    Global $lblBrowse = GUICtrlCreateLabel("Project Directory", 100, 5, 286, 16)
    Global $Label_5 = GUICtrlCreateLabel("APPLANIX", 10, 30, 76, 20)
    Global $Label_1 = GUICtrlCreateLabel("TIME SYNC", 10, 55, 76, 20)
    Global $Label_2 = GUICtrlCreateLabel("INJ TC", 10, 80, 76, 20)
    Global $Label_3 = GUICtrlCreateLabel("INJ PP", 10, 105, 76, 20)
    Global $Label_4 = GUICtrlCreateLabel("DR", 10, 130, 76, 20)
    Global $lblApplxStatus = GUICtrlCreateLabel("n/x", 100, 30, 56, 20)
    Global $lblTSStatus = GUICtrlCreateLabel("n/x", 100, 55, 56, 20)
    Global $lblITCStatus = GUICtrlCreateLabel("n/x", 100, 80, 56, 20)
    Global $lblIPPStatus = GUICtrlCreateLabel("n/x", 100, 105, 56, 20)
    Global $lblDRStatus = GUICtrlCreateLabel("n/x", 100, 130, 56, 20)
    Global $lstLog = GUICtrlCreateList(" ", 30, 155, 346, 176, BitOR($WS_HSCROLL, $WS_VSCROLL))     ; <<<--- You need WS_HSCROLL style
    GUICtrlSetLimit($lstLog, 1000)                                                                  ; <<<--- set the limit of horizontal scrolling
    GUISetState(@SW_SHOWNORMAL)

    for $i = 0 to 50
        GUICtrlSetData($lstLog,_NowTime(5) & " " &  50 - $i & " testttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt")
    Next

;~     _GUICtrlListView_SetColumnWidth($lstLog,0,500)
#EndRegion ;CreateGUI
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

 

Edited by Andreik

When the words fail... music speaks.

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

×
×
  • Create New...