Announcement

Collapse

Forum Guidelines

This forum is for finished source code that is working properly. If you have questions about this or any other source code, please post it in one of the Discussion Forums, not here.
See more
See less

Listview with checkboxes - Moving of checked items and custom drawing

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

  • Listview with checkboxes - Moving of checked items and custom drawing

    ' Hi Fellows,
    '
    ' This version allows you to move checked items to another listview.
    ' Semen Matusovski is thanked for his inspiration. In addition this
    ' version uses custom drawing, i.e. you can specify text and background
    ' color and also text font for items and subitems. To keep it simple only
    ' build-in standard colors and stock fonts are being used. This listview
    ' works fine for small amounts of data. If you have large amounts of data
    ' with many columns and rows, performance may slow down and you may exceed the
    ' capacity of listview. In such cases the virtual listview is still to be
    ' preferred. If you figure out how checkboxes could be implemented in
    ' the virtual listview with fonts and colors I would still like to know
    ' about it.
    '
    ' Best wishes,
    '
    ' Erik Christensen, Copenhagen, Denmark ----- e.chr@email.dk
    '
    ' P.S. Be sure to have the latest version of the COMMCTRL.INC file.
    Code:
    #COMPILE EXE
    #REGISTER NONE
    #DIM ALL
    '
     %NOANIMATE    = 1
     %NOBUTTON     = 1
     %NOCOMBO      = 1
     %NODRAGLIST   = 1
     %NOHEADER     = 1
     %NOIMAGELIST  = 1
     %NOLIST       = 1
     '%NOLISTVIEW   = 1
     %NOSTATUSBAR  = 1
     %NOTABCONTROL = 1
     %NOTOOLBAR    = 1
     %NOTOOLTIPS   = 1
     %NOTRACKBAR   = 1
     %NOTREEVIEW   = 1
     %NOUPDOWN     = 1
    '
    #INCLUDE "win32api.inc"
    #INCLUDE "commctrl.inc"
    '
    %FORM1_LISTVIEW           = 100
    %FORM1_LISTVIEW2          = 101
    %FORM1_EXIT               = 102
    %FORM1_GETCHECKEDITEMS    = 105
    '
    DECLARE SUB ShowDialog_Form1(BYVAL hParent&)
    DECLARE CALLBACK FUNCTION Form1_DLGPROC
    DECLARE CALLBACK FUNCTION CBF_FORM1_EXIT()
    DECLARE CALLBACK FUNCTION CBF_FORM1_GETCHECKEDITEMS()
    '
    GLOBAL hForm1&
    GLOBAL hListView AS LONG
    GLOBAL hListView2 AS LONG
    '
    FUNCTION PBMAIN
        LOCAL Count&
        LOCAL CC1 AS INIT_COMMON_CONTROLSEX
        CC1.dwSize=SIZEOF(CC1)
        CC1.dwICC=%ICC_WIN95_CLASSES
        InitCommonControlsEX CC1
        ShowDialog_Form1 0
        DO
            DIALOG DOEVENTS TO Count&
        LOOP UNTIL Count&=0
    END FUNCTION
    '
    SUB ShowDialog_Form1(BYVAL hParent&)
        LOCAL Style&, ExStyle&
        LOCAL lStyle AS LONG, lStyle1 AS LONG, lStyle2 AS LONG
        LOCAL i AS LONG, j AS LONG, zText AS ASCIIZ * 100
        LOCAL lvc AS LV_COLUMN
        LOCAL lvi AS LV_ITEM
        Style& = %WS_POPUP OR %DS_MODALFRAME OR %WS_CAPTION OR %WS_MINIMIZEBOX OR %WS_SYSMENU OR %DS_CENTER
        ExStyle& = 0
        DIALOG NEW hParent&, "ListView With Checkboxes - Moving of checked items and custom drawing", 0, 0,  376,  224, Style&, ExStyle& TO hForm1&
        '
        CONTROL ADD "SysListView32", hForm1&,  %FORM1_LISTVIEW,"", 8, 8, 360, 118, _
            %WS_CHILD OR %WS_VISIBLE OR %WS_BORDER OR %WS_TABSTOP OR %LVS_REPORT , _
            %WS_EX_CLIENTEDGE
        CONTROL HANDLE hForm1&,%FORM1_LISTVIEW TO hListView
        lStyle = SendMessage(hListView,%LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
        lStyle1 = lStyle OR %LVS_EX_GRIDLINES OR %LVS_EX_FULLROWSELECT OR %LVS_EX_CHECKBOXES
        CALL SendMessage(hListView, %LVM_SETEXTENDEDLISTVIEWSTYLE,0,BYVAL lStyle1)
        '
        CONTROL ADD "SysListView32", hForm1&, %FORM1_LISTVIEW2,"", 8, 130, 360, 67, _
            %WS_CHILD OR %WS_VISIBLE OR %WS_BORDER OR %WS_TABSTOP OR %LVS_REPORT , _
            %WS_EX_CLIENTEDGE
        CONTROL HANDLE hForm1&,%FORM1_LISTVIEW2 TO hListView2
        lStyle = SendMessage(hListView2,%LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
        lStyle2 = lStyle OR %LVS_EX_GRIDLINES OR %LVS_EX_FULLROWSELECT
        CALL SendMessage(hListView2, %LVM_SETEXTENDEDLISTVIEWSTYLE,0,BYVAL lStyle2)
        '
        %NumRows=100
        %NumCols=10
        '
        ' Define columns
        lvc.mask = %LVCF_FMT OR %LVCF_WIDTH OR %LVCF_TEXT OR %LVCF_SUBITEM
        lvc.fmt = %LVCFMT_LEFT
        lvc.cx = 190
        lvc.cchTextMax = SIZEOF(zText)
        lvc.pszText = VARPTR(zText)
        FOR i = 1 TO %NumCols
            zText = "Column" + STR$(i)
            SendMessage hListView, %LVM_INSERTCOLUMN, i, VARPTR(lvc)
            SendMessage hListView2, %LVM_INSERTCOLUMN, i, VARPTR(lvc)
        NEXT
        '
        ' Fill listview with data
        lvi.mask = %LVIF_TEXT
        lvi.pszText = VARPTR(zText)
        FOR i = 1 TO %NumRows
            lvi.iItem = i - 1
            FOR j = 1 TO %NumCols
                zText = "row"+STR$(i)+" column"+STR$(j)
                lvi.iSubItem = j - 1
                IF j = 1 THEN ListView_InsertItem hListView, lvi ELSE ListView_SetItem hListView, lvi
            NEXT
        NEXT
        ' Check items 3 and 7 (subtract 1 since listview use base zero as the starting value)
        ListView_SetCheckState hListView , 2, 1
        ListView_SetCheckState hListView , 6, 1
        '
        CONTROL ADD "Button", hForm1&,  %FORM1_EXIT,  "E&xit", 328, 204, 40, 12, _
            %WS_CHILD OR %WS_VISIBLE OR %BS_PUSHBUTTON OR %WS_TABSTOP CALL CBF_FORM1_EXIT
        CONTROL ADD "Button", hForm1&,  %FORM1_GETCHECKEDITEMS,  "&Get Checked Items Into Lower Listview", 110, 204, 162, 12, _
            %WS_CHILD OR %WS_VISIBLE OR %BS_PUSHBUTTON OR %WS_TABSTOP CALL CBF_FORM1_GETCHECKEDITEMS
        DIALOG SHOW MODELESS hForm1&, CALL Form1_DLGPROC
    END SUB
    '
    CALLBACK FUNCTION Form1_DLGPROC
        LOCAL nmlv AS NMLISTVIEW PTR
        LOCAL pnm AS NMLVCUSTOMDRAW PTR
        SELECT CASE CBMSG
            CASE %WM_NOTIFY
                nmlv = CBLPARAM
                IF @nmlv.hdr.hWndFrom = hListView THEN ' Notify for ListView
                    SELECT CASE @nmlv.hdr.code
                        CASE %NM_CUSTOMDRAW
                            pnm = CBLPARAM
                            SELECT CASE @pnm.nmcd.dwDrawStage
                                CASE %CDDS_PREPAINT
                                    ' The following statement ensures that the relevant
                                    ' messages are coming back to Windows, so Windows
                                    ' can respond appropriately. This method may be useful
                                    ' in many other situations where the DDT engine may
                                    ' swallow the information.
                                    ' The following statement makes Windows happy:
                                    SetWindowLong hForm1&,%DWL_MSGRESULT,%CDRF_NOTIFYITEMDRAW
                                    ' This statement makes the DDT engine happy:
                                    FUNCTION = 1: EXIT FUNCTION
                                CASE %CDDS_ITEMPREPAINT
                                    SetWindowLong hForm1&,%DWL_MSGRESULT,%CDRF_NOTIFYSUBITEMDRAW
                                    FUNCTION = 1: EXIT FUNCTION
                                CASE %CDDS_SUBITEM OR %CDDS_ITEMPREPAINT
                                    IF (@pnm.nmcd.dwItemSpec MOD 2) THEN
                                        SelectObject @pnm.nmcd.hdc, GetStockObject(%SYSTEM_FONT)
                                        @pnm.clrTextBk = %Cyan
                                        @pnm.clrText = %Magenta
                                    ELSE
                                        SelectObject @pnm.nmcd.hdc, GetStockObject(%SYSTEM_FIXED_FONT)
                                        @pnm.clrTextBk = %Green
                                        @pnm.clrText = %Blue
                                    END IF
                                    SetWindowLong hForm1&,%DWL_MSGRESULT,(%CDRF_NEWFONT)' OR %CDRF_NOTIFYSUBITEMDRAW)
                                    FUNCTION = 1: EXIT FUNCTION
                            END SELECT
                    END SELECT
                END IF
                ' Notify for ListView2
                IF @nmlv.hdr.hWndFrom = hListView2 THEN
                    SELECT CASE @nmlv.hdr.code
                        CASE %NM_CUSTOMDRAW
                            pnm = CBLPARAM
                            SELECT CASE @pnm.nmcd.dwDrawStage
                                CASE %CDDS_PREPAINT
                                    SetWindowLong hForm1&,%DWL_MSGRESULT,%CDRF_NOTIFYITEMDRAW
                                    FUNCTION = 1: EXIT FUNCTION
                                CASE %CDDS_ITEMPREPAINT
                                    SetWindowLong hForm1&,%DWL_MSGRESULT,%CDRF_NOTIFYSUBITEMDRAW
                                    FUNCTION = 1: EXIT FUNCTION
                                CASE %CDDS_SUBITEM OR %CDDS_ITEMPREPAINT
                                    IF ((@pnm.iSubItem + @pnm.nmcd.dwItemSpec) MOD 2) THEN
                                        SelectObject @pnm.nmcd.hdc, GetStockObject(%ANSI_VAR_FONT)
                                        @pnm.clrTextBk = %Blue
                                        @pnm.clrText = %White
                                    ELSE
                                        SelectObject @pnm.nmcd.hdc, GetStockObject(%ANSI_FIXED_FONT)
                                        @pnm.clrTextBk = %Red
                                        @pnm.clrText = %White
                                    END IF
                                    SetWindowLong hForm1&,%DWL_MSGRESULT,(%CDRF_NEWFONT)' OR %CDRF_NOTIFYSUBITEMDRAW)
                                    FUNCTION = 1: EXIT FUNCTION
                            END SELECT
                    END SELECT
                END IF
            CASE ELSE
        END SELECT
    END FUNCTION
    
    '
    CALLBACK FUNCTION CBF_FORM1_EXIT
        DIALOG END hForm1&
    END FUNCTION
    '
    CALLBACK FUNCTION CBF_FORM1_GETCHECKEDITEMS
        LOCAL j AS LONG, i AS LONG,k AS LONG
        LOCAL lvi AS LV_ITEM
        LOCAL zText AS ASCIIZ * 100
        lvi.mask = %LVIF_TEXT
        lvi.pszText = VARPTR(zText)
        ' Reset ListView2
        i=ListView_DeleteAllItems(hListView2)
        k=-1
        FOR i=0 TO %NumRows-1
            IF ListView_GetCheckState (hListView, i) THEN ' Item checked
                ' Then put content into ListView2
                INCR k ' Counter for ListView2
                FOR j = 0 TO %NumCols-1
                    lvi.iItem = i    ' Item number for ListView
                    lvi.iSubItem = j ' Subitem number common for ListView and ListView2
                    ' Get text from ListView
                    CALL ListView_GetItemText (hListView,i,j,zText,SIZEOF(zText))
                    lvi.iItem = k    ' Item number for ListView2
                    IF j = 0 THEN ListView_InsertItem hListView2, lvi ELSE ListView_SetItem hListView2, lvi
                NEXT
            END IF
        NEXT
    END FUNCTION

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

  • #2
    ' Listview with checkboxes. Moving of checked items and custom drawing.
    '
    ' Version 2.
    '
    ' This version also allows you to specify a font for the column headers.
    ' To do that you need to find the handle of the header control build
    ' into the listview control. The technique for finding this handle
    ' involves enumeration of the controls using EnumChildWindows(). The
    ' code used is a slightly modified version of such code provided to the
    ' Forum by Borje Hagsten who I thank for his inspiration.
    '
    ' Best wishes,
    '
    ' Erik Christensen, Copenhagen, Denmark ----- e.chr@email.dk
    '
    ' P.S. Be sure to have the latest version of the COMMCTRL.INC file.
    Code:
    #COMPILE EXE
    #REGISTER NONE
    #DIM ALL
    '
     %NOANIMATE    = 1
     %NOBUTTON     = 1
     %NOCOMBO      = 1
     %NODRAGLIST   = 1
     %NOHEADER     = 1
     %NOIMAGELIST  = 1
     %NOLIST       = 1
     '%NOLISTVIEW   = 1
     %NOSTATUSBAR  = 1
     %NOTABCONTROL = 1
     %NOTOOLBAR    = 1
     %NOTOOLTIPS   = 1
     %NOTRACKBAR   = 1
     %NOTREEVIEW   = 1
     %NOUPDOWN     = 1
    '
    #INCLUDE "win32api.inc"
    #INCLUDE "commctrl.inc"
    '
    %FORM1_LISTVIEW           = 100
    %FORM1_LISTVIEW2          = 101
    %FORM1_EXIT               = 102
    %FORM1_GETCHECKEDITEMS    = 105
    '
    DECLARE SUB ShowDialog_Form1(BYVAL hParent&)
    DECLARE CALLBACK FUNCTION Form1_DLGPROC
    DECLARE CALLBACK FUNCTION CBF_FORM1_EXIT()
    DECLARE CALLBACK FUNCTION CBF_FORM1_GETCHECKEDITEMS()
    '
    GLOBAL hForm1&
    GLOBAL hListView AS LONG
    GLOBAL hListView2 AS LONG
    '
    FUNCTION PBMAIN
        LOCAL Count&
        LOCAL CC1 AS INIT_COMMON_CONTROLSEX
        CC1.dwSize=SIZEOF(CC1)
        CC1.dwICC=%ICC_WIN95_CLASSES
        InitCommonControlsEX CC1
        ShowDialog_Form1 0
        DO
            DIALOG DOEVENTS TO Count&
        LOOP UNTIL Count&=0
    END FUNCTION
    '
    SUB ShowDialog_Form1(BYVAL hParent&)
        LOCAL Style&, ExStyle&
        LOCAL lStyle AS LONG, lStyle1 AS LONG, lStyle2 AS LONG
        LOCAL i AS LONG, j AS LONG, zText AS ASCIIZ * 100
        LOCAL lvc AS LV_COLUMN
        LOCAL lvi AS LV_ITEM
        Style& = %WS_POPUP OR %DS_MODALFRAME OR %WS_CAPTION OR %WS_MINIMIZEBOX OR %WS_SYSMENU OR %DS_CENTER
        ExStyle& = 0
        DIALOG NEW hParent&, "ListView With Checkboxes - Moving of checked items and custom drawing", 0, 0,  376,  224, Style&, ExStyle& TO hForm1&
        '
        CONTROL ADD "SysListView32", hForm1&,  %FORM1_LISTVIEW,"", 8, 8, 360, 120, _
            %WS_CHILD OR %WS_VISIBLE OR %WS_BORDER OR %WS_TABSTOP OR %LVS_REPORT , _
            %WS_EX_CLIENTEDGE
        CONTROL HANDLE hForm1&,%FORM1_LISTVIEW TO hListView
        lStyle = SendMessage(hListView,%LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
        lStyle1 = lStyle OR %LVS_EX_GRIDLINES OR %LVS_EX_FULLROWSELECT OR %LVS_EX_CHECKBOXES
        CALL SendMessage(hListView, %LVM_SETEXTENDEDLISTVIEWSTYLE,0,BYVAL lStyle1)
        '
        CONTROL ADD "SysListView32", hForm1&, %FORM1_LISTVIEW2,"", 8, 130, 360, 67, _
            %WS_CHILD OR %WS_VISIBLE OR %WS_BORDER OR %WS_TABSTOP OR %LVS_REPORT , _
            %WS_EX_CLIENTEDGE
        CONTROL HANDLE hForm1&,%FORM1_LISTVIEW2 TO hListView2
        lStyle = SendMessage(hListView2,%LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0)
        lStyle2 = lStyle OR %LVS_EX_GRIDLINES OR %LVS_EX_FULLROWSELECT
        CALL SendMessage(hListView2, %LVM_SETEXTENDEDLISTVIEWSTYLE,0,BYVAL lStyle2)
        '
        %NumRows=100
        %NumCols=10
        '
        ' Define columns
        lvc.mask = %LVCF_FMT OR %LVCF_WIDTH OR %LVCF_TEXT OR %LVCF_SUBITEM
        lvc.fmt = %LVCFMT_LEFT
        lvc.cx = 190
        lvc.cchTextMax = SIZEOF(zText)
        lvc.pszText = VARPTR(zText)
        FOR i = 1 TO %NumCols
            zText = "Column" + STR$(i)
            SendMessage hListView, %LVM_INSERTCOLUMN, i, VARPTR(lvc)
            SendMessage hListView2, %LVM_INSERTCOLUMN, i, VARPTR(lvc)
        NEXT
        '
        ' Use this to find the handles of the build in header controls.
        ' The handles are used to set the header fonts (see the EnumChildsProc function).
        EnumChildWindows hListView, CODEPTR(EnumChildsProc), 0
        EnumChildWindows hListView2, CODEPTR(EnumChildsProc), 0
        '
        ' Fill listview with data
        lvi.mask = %LVIF_TEXT
        lvi.pszText = VARPTR(zText)
        FOR i = 1 TO %NumRows
            lvi.iItem = i - 1
            FOR j = 1 TO %NumCols
                zText = "row"+STR$(i)+" column"+STR$(j)
                lvi.iSubItem = j - 1
                IF j = 1 THEN ListView_InsertItem hListView, lvi ELSE ListView_SetItem hListView, lvi
            NEXT
        NEXT
        ' Check items 3 and 7 (subtract 1 since listview use base zero as the starting value)
        ListView_SetCheckState hListView , 2, 1
        ListView_SetCheckState hListView , 6, 1
        '
        CONTROL ADD "Button", hForm1&,  %FORM1_EXIT,  "E&xit", 328, 204, 40, 12, _
            %WS_CHILD OR %WS_VISIBLE OR %BS_PUSHBUTTON OR %WS_TABSTOP CALL CBF_FORM1_EXIT
        CONTROL ADD "Button", hForm1&,  %FORM1_GETCHECKEDITEMS,  "&Get Checked Items Into Lower Listview", 110, 204, 162, 12, _
            %WS_CHILD OR %WS_VISIBLE OR %BS_PUSHBUTTON OR %WS_TABSTOP CALL CBF_FORM1_GETCHECKEDITEMS
        DIALOG SHOW MODELESS hForm1&, CALL Form1_DLGPROC
    END SUB
    '
    FUNCTION EnumChildsProc(BYVAL hWnd AS LONG, BYVAL lParam AS LONG) AS LONG
        ' This is a slightly modified version of a function provided by Borje Hagsten
        DIM clName AS ASCIIZ * 100
        STATIC i&
        GetClassName hWnd, clName, SIZEOF(clName) ' Get class name of control
        clName = UCASE$(clName)
        IF clName = "SYSHEADER32" THEN ' Column header control identified
            INCR i&
            ' Set column header font according to your choice.
            ' hWnd holds now the handle of the header control.
            IF i&=1 THEN ' Send this font to the ListView column header.
                SendMessage hWnd,%WM_SETFONT,GetStockObject(%SYSTEM_FIXED_FONT),MAKLNG(%TRUE,0)
            ELSE ' i=2     Send this font to the ListView2 column header.
                SendMessage hWnd,%WM_SETFONT,GetStockObject(%ANSI_FIXED_FONT),MAKLNG(%TRUE,0)
            END IF
        END IF
        FUNCTION = 1
    END FUNCTION
    '
    CALLBACK FUNCTION Form1_DLGPROC
        LOCAL nmlv AS NMLISTVIEW PTR
        LOCAL pnm AS NMLVCUSTOMDRAW PTR
        SELECT CASE CBMSG
            CASE %WM_NOTIFY
                nmlv = CBLPARAM
                IF @nmlv.hdr.hWndFrom = hListView THEN ' Notify for ListView
                    SELECT CASE @nmlv.hdr.code
                        CASE %NM_CUSTOMDRAW
                            pnm = CBLPARAM
                            SELECT CASE @pnm.nmcd.dwDrawStage
                                CASE %CDDS_PREPAINT
                                    ' The following statement ensures that the relevant
                                    ' messages are coming back to Windows, so Windows
                                    ' can respond appropriately. This method may be useful
                                    ' in many other situations where the DDT engine may
                                    ' swallow the information.
                                    ' The following statement makes Windows happy:
                                    SetWindowLong hForm1&,%DWL_MSGRESULT,%CDRF_NOTIFYITEMDRAW
                                    ' This statement makes the DDT engine happy:
                                    FUNCTION = 1: EXIT FUNCTION
                                CASE %CDDS_ITEMPREPAINT
                                    SetWindowLong hForm1&,%DWL_MSGRESULT,%CDRF_NOTIFYSUBITEMDRAW
                                    FUNCTION = 1: EXIT FUNCTION
                                CASE %CDDS_SUBITEM OR %CDDS_ITEMPREPAINT
                                    IF (@pnm.nmcd.dwItemSpec MOD 2) THEN
                                        SelectObject @pnm.nmcd.hdc, GetStockObject(%SYSTEM_FONT)
                                        @pnm.clrTextBk = %Cyan
                                        @pnm.clrText = %Magenta
                                    ELSE
                                        SelectObject @pnm.nmcd.hdc, GetStockObject(%SYSTEM_FIXED_FONT)
                                        @pnm.clrTextBk = %Green
                                        @pnm.clrText = %Blue
                                    END IF
                                    SetWindowLong hForm1&,%DWL_MSGRESULT,(%CDRF_NEWFONT)' OR %CDRF_NOTIFYSUBITEMDRAW)
                                    FUNCTION = 1: EXIT FUNCTION
                            END SELECT
                    END SELECT
                END IF
                ' Notify for ListView2
                IF @nmlv.hdr.hWndFrom = hListView2 THEN
                    SELECT CASE @nmlv.hdr.code
                        CASE %NM_CUSTOMDRAW
                            pnm = CBLPARAM
                            SELECT CASE @pnm.nmcd.dwDrawStage
                                CASE %CDDS_PREPAINT
                                    SetWindowLong hForm1&,%DWL_MSGRESULT,%CDRF_NOTIFYITEMDRAW
                                    FUNCTION = 1: EXIT FUNCTION
                                CASE %CDDS_ITEMPREPAINT
                                    SetWindowLong hForm1&,%DWL_MSGRESULT,%CDRF_NOTIFYSUBITEMDRAW
                                    FUNCTION = 1: EXIT FUNCTION
                                CASE %CDDS_SUBITEM OR %CDDS_ITEMPREPAINT
                                    IF ((@pnm.iSubItem + @pnm.nmcd.dwItemSpec) MOD 2) THEN
                                        SelectObject @pnm.nmcd.hdc, GetStockObject(%ANSI_VAR_FONT)
                                        @pnm.clrTextBk = %White
                                        @pnm.clrText = %Blue
                                    ELSE
                                        SelectObject @pnm.nmcd.hdc, GetStockObject(%ANSI_FIXED_FONT)
                                        @pnm.clrTextBk = %Yellow
                                        @pnm.clrText = %Black
                                    END IF
                                    SetWindowLong hForm1&,%DWL_MSGRESULT,(%CDRF_NEWFONT)' OR %CDRF_NOTIFYSUBITEMDRAW)
                                    FUNCTION = 1: EXIT FUNCTION
                            END SELECT
                    END SELECT
                END IF
            CASE ELSE
        END SELECT
    END FUNCTION
    
    '
    CALLBACK FUNCTION CBF_FORM1_EXIT
        DIALOG END hForm1&
    END FUNCTION
    '
    CALLBACK FUNCTION CBF_FORM1_GETCHECKEDITEMS
        LOCAL j AS LONG, i AS LONG,k AS LONG
        LOCAL lvi AS LV_ITEM
        LOCAL zText AS ASCIIZ * 100
        lvi.mask = %LVIF_TEXT
        lvi.pszText = VARPTR(zText)
        ' Reset ListView2
        i=ListView_DeleteAllItems(hListView2)
        k=-1
        FOR i=0 TO %NumRows-1
            IF ListView_GetCheckState (hListView, i) THEN ' Item checked
                ' Then put content into ListView2
                INCR k ' Counter for ListView2
                FOR j = 0 TO %NumCols-1
                    lvi.iItem = i    ' Item number for ListView
                    lvi.iSubItem = j ' Subitem number common for ListView and ListView2
                    ' Get text from ListView
                    CALL ListView_GetItemText (hListView,i,j,zText,SIZEOF(zText))
                    lvi.iItem = k    ' Item number for ListView2
                    IF j = 0 THEN ListView_InsertItem hListView2, lvi ELSE ListView_SetItem hListView2, lvi
                NEXT
            END IF
        NEXT
    END FUNCTION
    ------------------


    [This message has been edited by Erik Christensen (edited December 09, 2001).]

    Comment

    Working...
    X