win32lib ver .57 Modification & bug fix

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

hi,
i was trying to use this function getLVSelected text() and it kept on 
crashing, it kept on telling me "subscript 0
 is out of bounds reading from a sequence of length 6" so i decided to 
check win32lib out and found out this
---*************************************************************************************************

----code from win32lib ver 57
global function getLVItemText(integer id,integer item,integer subitem)
sequence text
text=""
if item>0 and item<=length(lvitem_data)
and subitem>=0 and subitem<=length(lvitem_data[item][2])
and id=lvitem_owner[item]
then
text=peek_string(lvitem_data[item][2][subitem][1])
end if
return text
end function
-----------------------------------
global function getLVSelectedText(integer id)
sequence text
text=getLVSelected(id)
for i=1 to length(text)do
text[i]=getLVItemText(id,text[i],0)---//This was the cause of error. The 
subitem  Zero
end for
return text
end function
--**************END OF CODE FROM WIN32LIB

after seeing the cause of error i replaced getLVSelectedText(integer id) 
and getLVItemText()
with this that worked just fine.!!!

--MOD: Jordah Ferguson 7/4/2002
global function getLVItemText(integer id,integer item,integer subitem)
sequence text,out_put
out_put = {}
text=""
if item>0 and item<=length(lvitem_data)
and subitem>=0 and subitem<=length(lvitem_data[item][2])
and id=lvitem_owner[item]
then
for i = 1 to subitem by 1 do
text=peek_string(lvitem_data[item][2][i][1])
out_put = out_put&{text}
end for
end if
return out_put
end function
--END MOD JOrdah Ferguson 7/4/2002

--MOD: Jordah Ferguson 7/4/2002
global function getLVSelectedText(integer id)
sequence text
text=getLVSelected(id)
for i=1 to length(text)do
ext[i]=getLVItemText(id,text[i],length(lvitem_data[text[i]][2]))--//area 
of correction
end for
return text
end function
--END MOD JOrdah Ferguson 7/4/2002

Well the above modifications return to me, the proper results when i 
call getLVSelectedText(). It maybe my
system and not win32lib but my bets is that this was a bug in win32lib 
cause 
text[i]=getLVItemText(id,text[i],0) --is a bit too logical

Please any one out there inform me if this is correct or it is just an 
illusion.

Jordah Ferguson

BEWARE!
the above routines change the results of some functions such as 
getLVAllText(). I have posed them to correct
a bug thats all. 

--Processed and saved using: Cirrus Mail ver 0.2a

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

Search



Quick Links

User menu

Not signed in.

Misc Menu