Announcement

Collapse
No announcement yet.

WS_HSCROLL in listbox ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • WS_HSCROLL in listbox ?

    How can one add horizontal scrollbars to a listbox control ?

    The obvious WS_HSCROLL approach failed me.

    Any ideas ?

    Thanks !

    Oliver Copp
    [email protected] Systems Germany

    ------------------

  • #2
    Oliver --
    Listbox is able to locate elements by rows.
    For example, elements 1-10 in column 1, 11-20 in column 2.
    Useful, for example, to show a list of files.
    In this case - LBS_MULTICOLUMN style, LB_SETCOLUMNWIDTH message.

    But I think, that you talk about something like in Excel.
    If so, it's necessary to send %LB_SETHORIZONTALEXTENT message.
    Code:
       #Compile Exe
       #Register None
       #Dim All
       #Include "win32api.inc"
       %ID_LISTBOX = 101
    
       Function PbMain
          Dim hDlg As Long, i As Long
          Dialog New 0, "Test", , , 150, 120, %WS_SYSMENU Or %WS_CAPTION Or %WS_MINIMIZEBOX To hDlg
          Control Add ListBox, hDlg, %ID_ListBox, , 10, 10,  130,  100, _
             %WS_TABSTOP Or %WS_HSCROLL Or %WS_VSCROLL, %WS_EX_CLIENTEDGE      
          For i = 1 To 1000
            ListBox Add hDlg, %ID_LISTBOX, Format$(i, "0000") + _
               "         Peite pivo. Ono wkusno i na tswet krasiwo       12567890"
          Next
          Control Send hdlg, %ID_ListBox, %LB_SETHORIZONTALEXTENT, 350, 0
          Dialog Show Modal hDlg
       End Function

    ------------------


    [This message has been edited by Semen Matusovski (edited July 05, 2000).]

    Comment


    • #3
      Thank you very much for the information.

      Actually, the problem I'm having is that some data lines are longer than the listbox that displays them.

      Hence it would be of great advantage to offer horizontal scrollbars so the user can read the lines to their end.

      Thanks !

      Oliver

      ------------------

      Comment

      Working...
      X