- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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):
[fortran]
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))
[/fortran]
IVF14 sets LVItem%iItem to -1. It is 0 with IVF12.1. GetLastError or GetLastErrorQQ both return 0.
Any ideas?
Thanks in advance,
Markus
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
[fortran]
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
[/fortran]
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
[fortran]
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
[/fortran]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Paul!
When I explicit set LVItem%iItem=0, it works.
Markus
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page