Announcement

Collapse
No announcement yet.

Listview Edit Column Title problem

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

  • Listview Edit Column Title problem

    This small, compileable (PBWIn 8.04) example almost allows the editing of a listview column title, but is not allowing the text in the edit control which overlies the column heading to be replaced. Any ideas welcomed.


    Code:
    ' supposed to allow editing of a listview column title, but doesn't - why?
    ' Chris Holbrook 27 June 2008
    '
    #COMPILE EXE
    #DIM ALL
    #INCLUDE "WIN32API.INC"
    #INCLUDE "COMMCTRL.INC"
    %IDD_DIALOG1         =  101
    %IDC_LV              = 1001
    %IDC_EDITLVSUBITEM   = 1002
    
    '-------------------------------------------------------------------------------------
    FUNCTION SampleListView(BYVAL hDlg AS DWORD, BYVAL lID AS LONG, BYVAL lColCnt AS LONG, BYVAL lRowCnt AS LONG) AS LONG
        LOCAL lCol   AS LONG
        LOCAL lRow   AS LONG
        LOCAL hCtl   AS DWORD
        LOCAL tLVC   AS LV_COLUMN
        LOCAL tLVI   AS LV_ITEM
        LOCAL szBuf  AS ASCIIZ * 32
        LOCAL lStyle AS LONG
    
        CONTROL HANDLE hDlg, lID TO hCtl
    
        lStyle = ListView_GetExtendedListViewStyle(hCtl)
        ListView_SetExtendedListViewStyle hCtl, lStyle OR %LVS_EX_FULLROWSELECT OR %LVS_EX_GRIDLINES
    
        ' Load column headers.
        tLVC.mask    = %LVCF_FMT OR %LVCF_TEXT OR %LVCF_SUBITEM
        tLVC.fmt     = %LVCFMT_LEFT
        tLVC.pszText = VARPTR(szBuf)
        FOR lCol = 0 TO lColCnt - 1
            szBuf       = USING$("Column #", lCol)
            tLVC.iOrder = lCol
            ListView_InsertColumn hCtl, lCol, tLVC
        NEXT lCol
    
        ' Load sample data.
        FOR lRow = 0 TO lRowCnt - 1
            tLVI.stateMask = %LVIS_FOCUSED
            tLVI.pszText   = VARPTR(szBuf)
            tLVI.iItem     = lRow
            FOR lCol = 0 TO lColCnt - 1
                szBuf         = USING$("Column # Row #", lCol, lRow)
                tLVI.iSubItem = lCol
                tLVI.lParam   = lRow
                IF lCol = 0 THEN
                    tLVI.mask = %LVIF_TEXT OR %LVIF_PARAM OR %LVIF_STATE
                    ListView_InsertItem hCtl, tLVI
                ELSE
                    tLVI.mask = %LVIF_TEXT
                    ListView_SetItem hCtl, tLVI
                END IF
            NEXT lCol
        NEXT lRow
    
        ' Auto size columns.
        FOR lCol = 0 TO lColCnt - 2
            ListView_SetColumnWidth hCtl, lCol, %LVSCW_AUTOSIZE
        NEXT lCol
        ListView_SetColumnWidth hCtl, lColCnt - 1, %LVSCW_AUTOSIZE_USEHEADER
    END FUNCTION
    
    '------------------------------------------------------------------------------
     FUNCTION LV_EditProc(BYVAL hCtl AS LONG, _
                        BYVAL Msg AS LONG, _
                        BYVAL wParam AS LONG, _
                        BYVAL lParam AS LONG) EXPORT AS LONG
    
        LOCAL tLVC                          AS LV_COLUMN
        LOCAL l                             AS LONG
        STATIC lvrow, lvcol                 AS INTEGER
        STATIC hLVwnd                       AS DWORD
        STATIC dwOrigEditProc               AS DWORD
        STATIC sz                        AS ASCIIZ * 255
    
        IF hCtl = 0 THEN           ' initial messages from parent
            dwOrigEditProc = wparam
            lvrow = HIWRD(lparam)
            lvcol = LOWRD(lparam)
            FUNCTION = 1
            EXIT FUNCTION
        END IF
    
        SELECT CASE Msg
    
          CASE %WM_KEYUP
               SELECT CASE wParam
                    CASE %VK_RETURN
                        sendmessage ( hCtl, %WM_GETTEXT, SIZEOF(sz), BYVAL VARPTR(sz))
                        getprop getparent(hCtl), "LVWND" TO hLVWnd
                        l = ListView_GetExtendedListViewStyle(hCtl)
                        ListView_SetExtendedListViewStyle (hCtl, l OR %LVS_EX_GRIDLINES OR %LVS_EX_FULLROWSELECT)
                        tLVC.mask    = %LVCF_FMT OR %LVCF_TEXT OR %LVCF_SUBITEM OR %LVCF_WIDTH
                        tLVC.fmt     = %LVCFMT_LEFT
                        tLVC.pszText = VARPTR(sz)
                        tLVC.iOrder  = LVCol
                        l = ListView_setColumn(hCtl, LVCol , tLVC)
               END SELECT
        END SELECT
    
        FUNCTION=CallWindowProc(dwOrigEditProc ,hCtl,Msg,wParam,lParam)
    
    END FUNCTION
    '------------------------------------------------------------------------------
    FUNCTION GetLVColumn(hLV AS DWORD, Column AS LONG) AS STRING
        LOCAL tLVC              AS LV_COLUMN
        LOCAL sz                AS ASCIZ * 128
    
        tLVC.mask = %LVCF_TEXT
        tLVC.pszText = VARPTR(sz)
        tLVC.cchTextmax = SIZEOF(sz)
        listview_getColumn ( hLV, Column, BYVAL VARPTR(tLVC))
        FUNCTION = sz
    END FUNCTION
    
    '------------------------------------------------------------------------------
    FUNCTION LVEditColumnName(hDlg AS LONG, _
                            hLV AS LONG, _
                            Column AS LONG) AS LONG ',  _
                            'sColumnPermissions AS STRING) AS LONG
    
        LOCAL i AS LONG, NumColumns AS LONG, Offset AS LONG
        LOCAL r, rLV                    AS rect
        LOCAL LVC AS LV_COLUMN , dwStyle AS LONG, hInstance AS LONG
        LOCAL LVI AS LV_ITEM, iClientRect AS rect , siSize AS apiSIZE
        STATIC hListEdit                AS DWORD
        STATIC dwOrigEditProc           AS DWORD
        LOCAL cx, cy, x, y, w, h AS LONG
    
        dwStyle = dwStyle OR %WS_BORDER OR %WS_CHILD OR %WS_VISIBLE OR %ES_AUTOHSCROLL
    
        ' if the edit control exists, delete it
        IF iswindow(hListEdit) THEN
           CALL DestroyWindow(hListEdit)
        END IF
    
        CALL ListView_GetSubItemRect (hLV, 0, Column, %LVIR_LABEL, BYVAL VARPTR(r))
        DIALOG PIXELS hdlg,r.nleft, r.ntop TO UNITS x, y
        DIALOG PIXELS hdlg, r.nright - r.nleft, r.nbottom -r.ntop TO UNITS w, h
        CONTROL GET LOC hdlg, getdlgCtrlId(hLV) TO cx, cy
        enablewindow ( hLV, %false) 'disable the underlying LV window
        CONTROL ADD "EDIT", hDlg, %IDC_EDITLVSUBITEM, GetLVColumn(hLV, Column), _
                              cx + x + 1, cy + y - 10, w, h, _
                              dwstyle
        hListEdit = getdlgItem(hdlg,%IDC_EDITLVSUBITEM)
        dwOrigEditProc = SetWindowLong(hListEdit,%GWL_WNDPROC,CODEPTR(LV_EditProc ))
        ' call the subclassed control directly
        ' to tell it what it's original WndProc is
        ' and what the item & subitem are ... saves using a GLOBAL value!
        setprop hDlg, "LVWND", hLV
        LV_EditProc ( 0, 0, dwOrigEditProc, MAK (DWORD, Column, -1))
        enablewindow ( hLV, %true)
        CONTROL SET FOCUS hDlg, %IDC_EDITLVSUBITEM
        CALL SendMessage(hListEdit, %EM_SETSEL, 0 ,-1)
    END FUNCTION
     
    '----------------------------------------------------------------------
    CALLBACK FUNCTION ShowDIALOG1Proc()
        LOCAL lnotifyctl        AS LONG
        LOCAL hLV               AS LONG
        LOCAL tLVC              AS LV_COLUMN
        LOCAL pNMLV             AS NM_LISTVIEW PTR
        LOCAL sztext            AS ASCIZ * 128
        LOCAL l                 AS LONG
        
        SELECT CASE AS LONG CBMSG
            CASE %WM_INITDIALOG
    
            CASE %WM_NOTIFY
                lNotifyCtl = LOWRD(CBWPARAM )
                SELECT CASE lNotifyCtl
                    CASE %IDC_LV
                        pNMLV = CBLPARAM
                        hLV = @pNMLV.hdr.hwndfrom
                        SELECT CASE @pNMLV.hdr.Code
                            CASE %LVN_COLUMNCLICK
                                pNMLV = CBLPARAM
                                sztext = GetLVColumn(hLV, @pNMLV.isubitem)
                                'szText = inputbox$ ( "new column name to replace " + sztext, "Enter a value")
                                LVeditColumnName ( CBHNDL, hLV, @pNMLV.isubitem)
                                l = ListView_GetExtendedListViewStyle(hLV)
                                ListView_SetExtendedListViewStyle (hLV, l OR %LVS_EX_GRIDLINES OR %LVS_EX_FULLROWSELECT)
                                tLVC.iSubItem = @pNMLV.isubitem
                                tLVC.mask    = %LVCF_TEXT OR %LVCF_SUBITEM
                                tLVC.pszText = VARPTR(sztext)
                                tLVC.iOrder = @pNMLV.isubitem
                                l = ListView_setColumn(hLV, @pNMLV.isubitem , tLVC)
                        END SELECT
    
                END SELECT
    
        END SELECT
    END FUNCTION
    '------------------------------------------------------------------------------
    FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
        LOCAL lRslt AS LONG
        LOCAL hDlg  AS DWORD
    
        DIALOG NEW hParent, "Listview Column title edit problem", 136, 153, 201, 121, %WS_POPUP OR %WS_BORDER OR %WS_DLGFRAME OR _
            %WS_SYSMENU OR %WS_CLIPSIBLINGS OR %WS_VISIBLE OR %DS_MODALFRAME OR %DS_3DLOOK OR %DS_NOFAILCREATE OR %DS_SETFONT, _
            %WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR, TO hDlg
        CONTROL ADD "SysListView32", hDlg, %IDC_LV, "SysListView32_1", 10, 10, 180, 90, %WS_CHILD OR %WS_VISIBLE OR _
            %WS_TABSTOP OR %LVS_REPORT OR %LVS_SHOWSELALWAYS, %WS_EX_LEFT OR %WS_EX_CLIENTEDGE OR %WS_EX_RIGHTSCROLLBAR
        SampleListView hDlg, %IDC_LV, 3, 30
    
        DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt
    
        FUNCTION = lRslt
    END FUNCTION
    
    '==========================================================================
    FUNCTION PBMAIN()
        InitCommonControls()
    
        ShowDIALOG1 %HWND_DESKTOP
    END FUNCTION

  • #2
    problem? what problem?

    This works!
    Code:
    ' EDIT a listview column title.
    ' click on the title, enter new name, press return when done.
    ' Chris Holbrook 27 June 2008
    '
    #COMPILE EXE
    #DIM ALL
    #INCLUDE "WIN32API.INC"
    #INCLUDE "COMMCTRL.INC"
    %IDD_DIALOG1         =  101
    %IDC_LV              = 1001
    %IDC_EDITLVSUBITEM   = 1002
    
    '-------------------------------------------------------------------------------------
    FUNCTION SampleListView(BYVAL hDlg AS DWORD, BYVAL lID AS LONG, BYVAL lColCnt AS LONG, BYVAL lRowCnt AS LONG) AS LONG
        LOCAL lCol   AS LONG
        LOCAL lRow   AS LONG
        LOCAL hCtl   AS DWORD
        LOCAL tLVC   AS LV_COLUMN
        LOCAL tLVI   AS LV_ITEM
        LOCAL szBuf  AS ASCIIZ * 32
        LOCAL lStyle AS LONG
    
        CONTROL HANDLE hDlg, lID TO hCtl
    
        lStyle = ListView_GetExtendedListViewStyle(hCtl)
        ListView_SetExtendedListViewStyle hCtl, lStyle OR %LVS_EX_FULLROWSELECT OR %LVS_EX_GRIDLINES
    
        ' Load column headers.
        tLVC.mask    = %LVCF_FMT OR %LVCF_TEXT OR %LVCF_SUBITEM
        tLVC.fmt     = %LVCFMT_LEFT
        tLVC.pszText = VARPTR(szBuf)
        FOR lCol = 0 TO lColCnt - 1
            szBuf       = USING$("Column #", lCol)
            tLVC.iOrder = lCol
            ListView_InsertColumn hCtl, lCol, tLVC
        NEXT lCol
    
        ' Load sample data.
        FOR lRow = 0 TO lRowCnt - 1
            tLVI.stateMask = %LVIS_FOCUSED
            tLVI.pszText   = VARPTR(szBuf)
            tLVI.iItem     = lRow
            FOR lCol = 0 TO lColCnt - 1
                szBuf         = USING$("Column # Row #", lCol, lRow)
                tLVI.iSubItem = lCol
                tLVI.lParam   = lRow
                IF lCol = 0 THEN
                    tLVI.mask = %LVIF_TEXT OR %LVIF_PARAM OR %LVIF_STATE
                    ListView_InsertItem hCtl, tLVI
                ELSE
                    tLVI.mask = %LVIF_TEXT
                    ListView_SetItem hCtl, tLVI
                END IF
            NEXT lCol
        NEXT lRow
    
        ' Auto size columns.
        FOR lCol = 0 TO lColCnt - 2
            ListView_SetColumnWidth hCtl, lCol, %LVSCW_AUTOSIZE
        NEXT lCol
        ListView_SetColumnWidth hCtl, lColCnt - 1, %LVSCW_AUTOSIZE_USEHEADER
    END FUNCTION
    
    '------------------------------------------------------------------------------
     FUNCTION LV_EditProc(BYVAL hCtl AS LONG, _
                        BYVAL Msg AS LONG, _
                        BYVAL wParam AS LONG, _
                        BYVAL lParam AS LONG) EXPORT AS LONG
    
        LOCAL tLVC                          AS LV_COLUMN
        LOCAL l                             AS LONG
        STATIC lvrow, lvcol                 AS INTEGER
        STATIC hLVwnd                       AS DWORD
        STATIC dwOrigEditProc               AS DWORD
        STATIC sz                           AS ASCIIZ * 255
    
        IF hCtl = 0 THEN           ' initial messages from parent
            dwOrigEditProc = wparam
            lvrow = HIWRD(lparam)
            lvcol = LOWRD(lparam)
            FUNCTION = 1
            EXIT FUNCTION
        END IF
    
        SELECT CASE Msg
    
          CASE %WM_KEYUP
               SELECT CASE wParam
                    CASE %VK_RETURN
                        sendmessage ( hCtl, %WM_GETTEXT, SIZEOF(sz), BYVAL VARPTR(sz))
                        getprop getparent(hCtl), "LVWND" TO hLVWnd
                        enablewindow hLVWnd, %TRUE
                        l = ListView_GetExtendedListViewStyle(hCtl)
                        ListView_SetExtendedListViewStyle (hCtl, l OR %LVS_EX_GRIDLINES OR %LVS_EX_FULLROWSELECT)
                        tLVC.mask    = %LVCF_FMT OR %LVCF_TEXT OR %LVCF_SUBITEM
                        tLVC.fmt     = %LVCFMT_LEFT
                        tLVC.pszText = VARPTR(sz)
                        tLVC.iOrder  = LVCol
                        l = ListView_setColumn(hLVWnd, LVCol , BYVAL VARPTR(tLVC))
                        destroywindow hctl
               END SELECT
        END SELECT
    
        FUNCTION=CallWindowProc(dwOrigEditProc ,hCtl,Msg,wParam,lParam)
    
    END FUNCTION
    '------------------------------------------------------------------------------
    FUNCTION GetLVColumn(hLV AS DWORD, Column AS LONG) AS STRING
        LOCAL tLVC              AS LV_COLUMN
        LOCAL sz                AS ASCIZ * 128
    
        tLVC.mask = %LVCF_TEXT
        tLVC.pszText = VARPTR(sz)
        tLVC.cchTextmax = SIZEOF(sz)
        listview_getColumn ( hLV, Column, BYVAL VARPTR(tLVC))
        FUNCTION = sz
    END FUNCTION
    
    '------------------------------------------------------------------------------
    FUNCTION LVEditColumnName(hDlg AS LONG, _
                            hLV AS LONG, _
                            Column AS LONG) AS LONG ',  _
                            'sColumnPermissions AS STRING) AS LONG
    
        LOCAL i AS LONG, NumColumns AS LONG, Offset AS LONG
        LOCAL r, rLV                    AS rect
        LOCAL LVC AS LV_COLUMN , dwStyle AS LONG, hInstance AS LONG
        LOCAL LVI AS LV_ITEM, iClientRect AS rect , siSize AS apiSIZE
        STATIC hListEdit                AS DWORD
        STATIC dwOrigEditProc           AS DWORD
        LOCAL cx, cy, x, y, w, h AS LONG
    
        dwStyle = dwStyle OR %WS_BORDER OR %WS_CHILD OR %WS_VISIBLE OR %ES_AUTOHSCROLL
    
        ' if the edit control exists, delete it
        IF iswindow(hListEdit) THEN
           CALL DestroyWindow(hListEdit)
        END IF
    
        CALL ListView_GetSubItemRect (hLV, 0, Column, %LVIR_LABEL, BYVAL VARPTR(r))
        DIALOG PIXELS hdlg,r.nleft, r.ntop TO UNITS x, y
        DIALOG PIXELS hdlg, r.nright - r.nleft, r.nbottom -r.ntop TO UNITS w, h
        CONTROL GET LOC hdlg, getdlgCtrlId(hLV) TO cx, cy
        enablewindow ( hLV, %false) 'disable the underlying LV window
        CONTROL ADD "EDIT", hDlg, %IDC_EDITLVSUBITEM, GetLVColumn(hLV, Column), _
                              cx + x + 1, cy + y - 10, w, h, _
                              dwstyle
        hListEdit = getdlgItem(hdlg,%IDC_EDITLVSUBITEM)
        dwOrigEditProc = SetWindowLong(hListEdit,%GWL_WNDPROC,CODEPTR(LV_EditProc ))
        ' call the subclassed control directly
        ' to tell it what it's original WndProc is
        ' and what the item & subitem are ... saves using a GLOBAL value!
        setprop hDlg, "LVWND", hLV
        LV_EditProc ( 0, 0, dwOrigEditProc, MAK (DWORD, Column, -1))
        CONTROL SET FOCUS hDlg, %IDC_EDITLVSUBITEM
        CALL SendMessage(hListEdit, %EM_SETSEL, 0 ,-1)
    END FUNCTION
    
    '----------------------------------------------------------------------
    CALLBACK FUNCTION ShowDIALOG1Proc()
        LOCAL lnotifyctl        AS LONG
        LOCAL hLV               AS LONG
        LOCAL tLVC              AS LV_COLUMN
        LOCAL pNMLV             AS NM_LISTVIEW PTR
        LOCAL sztext            AS ASCIZ * 128
        LOCAL l                 AS LONG
    
        SELECT CASE AS LONG CBMSG
            CASE %WM_INITDIALOG
    
            CASE %WM_NOTIFY
                lNotifyCtl = LOWRD(CBWPARAM )
                SELECT CASE lNotifyCtl
                    CASE %IDC_LV
                        pNMLV = CBLPARAM
                        hLV = @pNMLV.hdr.hwndfrom
                        SELECT CASE @pNMLV.hdr.Code
                            CASE %LVN_COLUMNCLICK
                                pNMLV = CBLPARAM
                                sztext = GetLVColumn(hLV, @pNMLV.isubitem)
                                'szText = inputbox$ ( "new column name to replace " + sztext, "Enter a value")
                                LVeditColumnName ( CBHNDL, hLV, @pNMLV.isubitem)
                                l = ListView_GetExtendedListViewStyle(hLV)
                                ListView_SetExtendedListViewStyle (hLV, l OR %LVS_EX_GRIDLINES OR %LVS_EX_FULLROWSELECT)
                                tLVC.iSubItem = @pNMLV.isubitem
                                tLVC.mask    = %LVCF_TEXT OR %LVCF_SUBITEM
                                tLVC.pszText = VARPTR(sztext)
                                tLVC.iOrder = @pNMLV.isubitem
                                l = ListView_setColumn(hLV, @pNMLV.isubitem , tLVC)
                        END SELECT
    
                END SELECT
    
        END SELECT
    END FUNCTION
    '------------------------------------------------------------------------------
    FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
        LOCAL lRslt AS LONG
        LOCAL hDlg  AS DWORD
    
        DIALOG NEW hParent, "Listview Column title edit problem", 136, 153, 201, 121, %WS_POPUP OR %WS_BORDER OR %WS_DLGFRAME OR _
            %WS_SYSMENU OR %WS_CLIPSIBLINGS OR %WS_VISIBLE OR %DS_MODALFRAME OR %DS_3DLOOK OR %DS_NOFAILCREATE OR %DS_SETFONT, _
            %WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR, TO hDlg
        CONTROL ADD "SysListView32", hDlg, %IDC_LV, "SysListView32_1", 10, 10, 180, 90, %WS_CHILD OR %WS_VISIBLE OR _
            %WS_TABSTOP OR %LVS_REPORT OR %LVS_SHOWSELALWAYS, %WS_EX_LEFT OR %WS_EX_CLIENTEDGE OR %WS_EX_RIGHTSCROLLBAR
        SampleListView hDlg, %IDC_LV, 3, 30
    
        DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt
    
        FUNCTION = lRslt
    END FUNCTION
    
    '==========================================================================
    FUNCTION PBMAIN()
        InitCommonControls()
    
        ShowDIALOG1 %HWND_DESKTOP
    END FUNCTION

    Comment


    • #3
      Code:
      CASE %WM_NOTIFY
                  lNotifyCtl = LOWRD(CBWPARAM )
                  SELECT CASE lNotifyCtl
                      CASE %IDC_LV
      As has been pointed out many times, LOWRD(wParam) is not the supported value to use for the control identifier when working with the Microsoft Common Controls which send the WM_NOTIFY notification message:
      idCtrl
      Identifier of the common control sending the message. This identifier is not guaranteed to be unique. An application should use the hwndFrom or idFrom member of the NMHDR structure (passed as the lParam parameter) to identify the control.
      No, I don't understand the part about "unique" but when the doc says "use <X>" I use "<X>."

      MCM
      Michael Mattias
      Tal Systems (retired)
      Port Washington WI USA
      [email protected]
      http://www.talsystems.com

      Comment


      • #4
        Originally posted by Michael Mattias View Post
        As has been pointed out many times, LOWRD(wParam) is not the supported value to use for the control identifier when working with the Microsoft Common Controls which send the WM_NOTIFY notification message
        Gosh, did I do that?
        Just in case some lurking newcomer to these matters gets the wrong end of the stick, I will point out that that particluar failing has no bearing on the problem or its solution.
        Last edited by Chris Holbrook; 28 Jun 2008, 09:39 AM. Reason: guilt

        Comment


        • #5
          BTW, what was the problem?

          I really can't justify looking through both pieces of code for differences, although I did look thru the second for comments . (Alas, said search was fruitless).

          As far as posting the supported method.... I think it was just this week someone posted that they had a problem with something. The bug was spotted immediately by at least two members...at which point the original poster noted he had never checked that code... because it was something he had 'cut and pasted' from here.

          My personal favorite here is the snippet...
          Code:
            
              IF CBTLCMSG= %BN_CLICKED or CBCTLMSG= 1 THEN 
          ...
          CBCTLMSG never equals 1 in 32-bit Windows.. although this was a possibility in 16-bit Windows... except there never was a 'DDT for Win/16'.

          This code started somewhere and got copied enough that now it's everywhere.
          Michael Mattias
          Tal Systems (retired)
          Port Washington WI USA
          [email protected]
          http://www.talsystems.com

          Comment


          • #6
            Originally posted by Michael Mattias View Post
            BTW, what was the problem?
            The solution was to disable the underlying control (I had mapped an edit window on top of the column title). Then it worked fine.

            Originally posted by Michael Mattias View Post
            My personal favorite here is the snippet...
            Code:
              
                IF CBTLCMSG= %BN_CLICKED or CBCTLMSG= 1 THEN 
            ...
            Yes, I noticed your comments on that line of code before. You'll see a lot of it, because that is what PB Forms generates every time you create a form with a button control in it. I think it's harmless.

            Comment


            • #7
              bug fix

              Just a little tweek for good karma.

              When the listbox contents are scrolled so that the 0'th row is out of sight, listview_getsubitemrect gives its coordinates as if the listviewrow 0 were still in view, so the Y coordinates relative to the listview control become negative. the above example then looks silly, because the edit control for the column title becomes displaced, perhaps to the point of becoming invisible.

              Replacing 0 in the listview_getsubitemrect call with listview_gettopindex(hLV) makes everything wonderful again.

              Comment

              Working...
              X