QuickWin ListControl in report view won´t fill in IVF14

QuickWin ListControl in report view won´t fill in IVF14

Ritratto di onkelhotte

Hi there,

I´m testing the new compiler and found an unconvinient thing: My ListControl won´t fill any more, it does when I switch the compiler back to 12.1 (and do a rebuild of course).

Here is the code (dlg and IDC_LISTBOX are declared globally):

logical(kind=4) l
integer(kind=4) listHwnd, i
type (T_LV_ITEM) LVItem
character*10 tempString
listHwnd=getDlgItem(dlg%hwnd,IDC_LISTBOX)
LVItem%mask=LVIF_TEXT
LVItem%state=0
LVItem%statemask=0
LVItem%cchTextMax=0
l=sendMessage(listHwnd,LVM_DELETEALLITEMS,0,0)
LVItem%iSubItem=0
write(tempstring,'(2A)') 'Ca',char(0)
LVItem%pszText=LOC(tempstring)
LVItem%iItem=sendMessage(listHwnd,LVM_INSERTITEM,0,LOC(LVItem))

IVF14 sets LVItem%iItem to -1. It is 0 with IVF12.1. GetLastError or GetLastErrorQQ both return 0.

Any ideas?

Thanks in advance,
Markus 

3 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione
Ritratto di Paul Curtis
Best Reply

Your code looks fairly similar to mine, but I have not encountered any problems (WinAPI or anything else) in updating to IVF14.  Your code will only insert an item as the first entry in the list, whereas the standard method is to query the starting item count and then place the added item at the end of the list.  Also, handles should be specified as INTEGER(HANDLE) rather than I*4.

INTEGER FUNCTION ListViewAddItem (hwnd, controlId, name)
    IMPLICIT NONE
    INTEGER(HANDLE), INTENT(IN)    :: hwnd
    INTEGER, INTENT(IN)            :: controlId
    CHARACTER(LEN=*), INTENT(IN)   :: name
    INTEGER                        :: rval
    INTEGER                        :: nItems
    TYPE(T_LV_ITEM)                :: item
    CHARACTER(LEN=200)             :: buffer
    
    buffer = name
    CALL NullTerminateString (buffer)
    nItems        = ListViewGetNumItems (hwnd, controlId)
    item%mask     = LVIF_TEXT
    item%iItem    = nItems
    item%iSubitem = 0
    item%pszText  = LOC(buffer)
    
    rval = SendControlMessage(hwnd, controlId, LVM_INSERTITEM, 0, LOC(item))
    
    IF(rval /= -1) THEN
        ListViewAddItem = rval + 1
    ELSE
        CALL ControlError("ListViewAddItem", controlId, "LVM_INSERTITEM")
        ListViewAddItem = -1
    END IF
END FUNCTION ListViewAddItem

Ritratto di onkelhotte

Thanks Paul!

When I explicit set LVItem%iItem=0, it works.

Markus

Accedere per lasciare un commento.