Re: line size of the listview

new topic     » goto parent     » topic index » view thread      » older message » newer message

Here a tested routine ...

constant vValidLVRect = {LVIR_BOUNDS, LVIR_ICON, LVIR_LABEL, LVIR_SELECTBOUNDS} 
global function LVGetItemSize(integer id, integer pItem, integer pWhich) 
 
	integer lRect 
	integer lTop 
	integer lBottom 
	integer lLeft 
	integer lRight 
	atom lResult 
 
	-- Reserve some RAM for the bounding rectangle values. 
	lRect = w32acquire_mem( 0, SIZEOF_RECT ) 
	 
	-- Indicate which rectangle is required to be fetched. 
	if not find(pWhich, vValidLVRect) then 
		pWhich = LVIR_BOUNDS 
	end if 
	w32store(lRect, rectLeft, pWhich) 
	 
	-- Tell Windows to fetch the data for the specific item requested. 
	lResult = sendMessage(id, LVM_GETITEMRECT, pItem - 1, lRect)  
	if lResult = 0 then 
		-- Failed. 
		w32release_mem(lRect) 
		return {} 
	end if 
	 
	-- Get box data 
	lTop = w32fetch(lRect, rectTop) 
	lBottom = w32fetch(lRect, rectBottom) 
	lLeft = w32fetch(lRect, rectLeft) 
	lRight = w32fetch(lRect, rectRight) 
	 
	-- Return RAM to opsys 
	w32release_mem(lRect) 
	 
	-- Return height, width, and box points 
	return {lBottom - lTop, lRight - lLeft, lLeft, lRight, lTop, lBottom} 
	 
end function 
sergelli said...

But what is the id of a row of ListView?

The manuals win32lib say the id is the return of a addLvItem (), but this is not true.

How do I find the id of a row of the ListView, to use in your code above?

You use it like this ...

sequence itemid 
sequence BoxData 
    -- get id of currently selected item. 
    itemid = getIndex(TheListView) 
    BoxData = LVGetItemSize(TheListView, itemid[1], 0) 
 
    if length(BoxData) != 0 then 
        -- Height is in BoxData[1] 
    end if 
new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu