Hmmm, I see what you mean but I think that isn't a very correct way to use Types or think about using them. I don't see "size" as being in relation to anything - it's not really an entity within your program. Now if you had made an Image type and size was an extension of that, it would make sense to me - and that way you can pass in the reference to the image and store the results easily. As follows:
type ImageSize
Width as integer
Height as integer
endtype
type Image
ID as integer
Filename as string
Size as ImageSize
endtype
Dim Images(100) as Image
MyLoadImage("bob.bmp",1)
print str$(Images(1).Size.Width)
print str$(Images(1).Size.Height)
end
function MyLoadImage(filename$, imagenumber)
load bitmap filename$,32
Images(i).Size.Width = bitmap width(32)
Images(i).Size.Height = bitmap height(32)
endfunction
(Code un-tested, so probably won't compile but in theory it works just fine)
Can you see the different angle here? I'm not trying to preach and say "this is the right way!" but doesn't it make more sense to treat these things almost like objects? (DBPro isn't object orientated, but with types and extended types you can now simulate a lot of the OO way of handling things).
Anyway I still agree with you - being able to pass a type in and return one from a function is very useful - but I don't feel essential.
Cheers,
Rich
"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming