BCX_LISTVIEW function

Purpose: BCX_LISTVIEW creates a listview control.


 Syntax:

 hCtl = BCX_LISTVIEW(Text$, _
                 hWndParent, _
                    hCtlID%, _
                      Xpos%, _
                      Ypos%, _
                     Width%, _
                    Height%  _
                [,WinStyle%] _
              [,ExWinStyle%] _
                 [,NumCols%])

 Parameters:

  • hCtl The return value is a handle to the new listview if the function succeeds. If the function fails, the return value is NULL.
  • Text$ Not used.
  • hWndParent Handle to the parent window of the listview being created.
  • hCtlID% Specifies the identifier of the listview being created. The identifier is an integer value used by the listview being created to notify its parent about events. The identifier must be unique for each listview created with the same parent window.
  • Xpos% Specifies the initial horizontal position of the listview being created. X% is the x-coordinate of the upper-left corner of the listview being created. relative to the upper-left corner of the parent window's client area.
  • Ypos% Specifies the initial vertical position of the listview being created. Y% is the initial y-coordinate of the upper-left corner of the listview being created relative to the upper-left corner of the parent window's client area.
  • Width% Specifies the width, in device units or, if the PIXELS optional parameter was specified in the GUI statement, in pixels , of the listview being created.
  • Height% Specifies the height, in device units or, if the PIXELS optional parameter was specified in the GUI statement, in pixels , of the listview being created.
  • WinStyle% [OPTIONAL] If the WinStyle% parameter is used, the default Window Style for a BCX_LISTVIEW control, WS_CHILD | WS_TABSTOP | WS_VISIBLE | 0x241 | WS_BORDER, is replaced with the value in WinStyle%. See your Win32 SDK or PSDK Reference help for more information about valid Window Styles.
  • ExWinStyle% [OPTIONAL] The default window Extended Window Style for a BCX_LISTVIEW control is WS_EX_CLIENTEDGE. See your Win32 SDK or PSDK Reference help for more information about valid Extended Window Styles.
  • NumCols% [OPTIONAL] specifies the number of columns to be used in the listview being created. If this parameter is not specified, the number of columns will default to 15.

Remarks: The default window Style for a BCX_LISTVIEW control also can be changed by using the MODSTYLE function.

Grid lines can not be removed from BCX_LISTVIEW using the MODSTYLE function so here is an example that shows how the grid lines can be removed.

 
 hList = BCX_LISTVIEW("", hWnd, IDC_LIST, 3, 16, 407, 189, List_Styles, ListEx_Styles, 0)
 CONST NOGRIDLINES = LVS_EX_FULLROWSELECT
 SendMessage(hList,LVM_SETEXTENDEDLISTVIEWSTYLE,0,NOGRIDLINES)

 

LVM_SETEXTENDEDLISTVIEWSTYLE allows you to manipulate the styles similar to BCX's ModStyle. Here is a little wrapper that might come in handy. This will add or remove styles without knowing the existing styles or changing the existing styles not intended.

 
 SUB ModStyleLVEX OPTIONAL(hWnd AS HWND, addstyle, remstyle=0)
   SendMessage(hWnd, LVM_SETEXTENDEDLISTVIEWSTYLE, addstyle|remstyle, addstyle)
 END SUB
 

Here is a test call for the above wrapper.

 
 ModStyleLVEX( hList, LVS_EX_FLATSB|LVS_EX_HEADERDRAGDROP, LVS_EX_GRIDLINES)
 

For an example of the BCX_LISTVIEW function see Demo.bas in the BCX\Gui_Demo\EZ_Gui folder.