Announcement

Collapse
No announcement yet.

LISTBOX scroll backwards automatically

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

  • LISTBOX scroll backwards automatically

    How do you add items to a listbox so the most current items come out on top?
    The world is full of apathy, but who cares?

  • #2
    From the SDK, never used it though.

    Code:
    LB_INSERTSTRING	Inserts a string at a given index in a list box.
    Code:
    LB_INSERTSTRING  
    wParam = (WPARAM) index;          // item index  
    lParam = (LPARAM) (LPCTSTR) lpsz; // address of string to insert
    Rod
    In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

    Comment


    • #3
      You'll find an example of it in your post #10 in this thread:
      http://www.powerbasic.com/support/pb...B_INSERTSTRING
      Rod
      In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

      Comment


      • #4
        'LISTBOX ADD hWnd, %IDC_LISTBOX1, Buffer 'normal
        CONTROL SEND hWnd, %IDC_LISTBOX1, %LB_INSERTSTRING, 0, STRPTR(buffer) 'backward
        CONTROL REDRAW hWnd, %IDC_LISTBOX1

        Thanks! That did it.
        The world is full of apathy, but who cares?

        Comment


        • #5
          Very cool

          Code:
          SUB LogEvent (hwnd AS LONG, BYVAL Buffer AS STRING)
              'Scroll backwards, leaving 2-heading lines at the top
              STATIC counter AS LONG
              DIM s AS STRING
              INCR counter
              MID$(buffer,94) = FORMAT$(counter)
              CONTROL SEND hWnd, %IDC_LISTBOX1, %LB_INSERTSTRING, 2, STRPTR(buffer)  'backward
              CONTROL REDRAW hWnd, %IDC_LISTBOX1
          END SUB
          The world is full of apathy, but who cares?

          Comment

          Working...
          X