Nativepath x Absolutepath

Hello
I’m doing maintenance on an older project that is still with AbsolutePath when I step nativePath the image is not found, below is what I did:

when I drag a file it is placed in a listbox with this code:

[code] do
if obj.FolderItemAvailable then
ListBox1.addrow obj.folderitem.name
listbox1.cell(listbox1.lastIndex,2)=obj.folderitem.NativePath

end

loop until not obj.NextItem[/code]

loads the file normally in the listbox, then I give double click in the cell, the image is loaded into a canvas with this code:

[code] Dim i, last as Integer
Dim f as FolderItem
Dim p, pic as Picture
Dim factor As Double
Dim imagepath as string
Dim maxWidth, maxHeight As Integer

maxWidth = Canvas1.Width
maxHeight = Canvas1.Height

Listbox1.ListIndex=0

imagepath=Window1.listbox1.cell(Window1.Listbox1.listindex,2) '<< path.

f=GetFolderItem(imagepath)

If f <> Nil then
If f.exists then
p=f.openaspicture
factor = Min( maxWidth / p.Width, maxHeight / p.Height )
factor = Min( factor, 1 ) // (don’t scale it up if it’s too small!)
factor= factor * 1
pic = NewPicture( p.Width * factor, p.Height * factor, 32 )
pic.graphics.DrawPicture p, 0,0,pic.width,pic.height, 0,0,p.width,p.height
Canvas1.Backdrop=pic

End if

End if[/code]

when I put in NativePath the image is not found, already in AbsolutePath everything goes as expected, could someone tell me what I’m doing wrong?

I appreciate any help, thank you!

This should work if you replace the line with this:

f = GetFolderItem( imagepath, FolderItem.PathTypeNative )

But there is a better way to do this. If you need to display the path in the Listbox, do that, but also store the original FolderItem in the row’s RowTag. You won’t need to parse it again later at all that way.

[quote=276038:@Kem Tekinay]This should work if you replace the line with this:

f = GetFolderItem( imagepath, FolderItem.PathTypeNative )

But there is a better way to do this. If you need to display the path in the Listbox, do that, but also store the original FolderItem in the row’s RowTag. You won’t need to parse it again later at all that way.[/quote]

Kem Tekinay, thank you for your help, it worked perfectly!

How to switch to RowTag I never did, I will study the issue to better understand how to do this, again thank you very much your help!