RB : Loading pictures

Member
Posts: 92
Joined: 2002.04
Post: #1
I have a list box which loads the names of all the files in a folder with this code. The following bit works ok, its the bit after were I click on a cell its supposed to load the file in to a canvas, but doesn't.

sub open()
dim f as folderitem
dim i as integer

// set the column title
TileList.Heading(0) = "File Tiles"

// load all the names of the files
// in the tiles folder
f = new folderItem("Tiles")
for i = 1 to f.Count
if f.Item(i).Directory = false then
me.AddRow f.Item(i).name
end if
next
end sub

The below code is supposed to open the file in the Tiles folder, but it doesn't work. If I un-comment the first f= and comment out the 2nd f= line and make it have a dialog asking the user were it is the file will open ok. If I use the 2nd f= line it reports that the file can't be found. Using the de-bugger it shows zero size. I'm lost any help would rock.
Huh


function cellclick(row as integer, column as integer, x as integer, y as integer) as boolean
dim f as folderItem
dim path as string

path = "Tiles:" + me.Cell(row,column)

f = getopenfolderitem("image/x-pict")
//f = getfolderItem(path)
Msgbox "the files path is "+f.absolutePath
if f.exists then
TileAppearance.backdrop = f.openAsPicture
else
MsgBox "The file "+f.absolutePath+" doesnít exist!"
end if
end function
Quote this message in a reply
Member
Posts: 92
Joined: 2002.04
Post: #2
gee I hate that :envy: I spend all night trying to get this to work. I post this question and then a few hours later I find the solution. For those interested here is the changed code.

dim f as folderItem
dim path as string

f = getfolderItem("Tiles").child(me.Cell(row,column))
if f.exists then
TileAppearance.backdrop = f.openAsPicture
else
MsgBox "The file "+f.absolutePath+" doesnít exist!"
end if
Quote this message in a reply
Member
Posts: 509
Joined: 2002.05
Post: #3
I know how you feel, i have spent hours looking for something, then I give up, and a day later its laying right beside my keyboard or some place I am at a few hours a day.
Quote this message in a reply
Post Reply