[Gambas-user] Storing picture data in a collection

Christopher Brian Jack brian at ...1334...
Mon Feb 27 06:19:15 CET 2006


On Sun, 26 Feb 2006, GuruLounge - MailLists wrote:

> I'm trying to reference images stored on a form so I can map those
> images elsewhere.
>
> I've an "iconform" with a number of pictureboxes representing icons I
> want to use in my project.
>
> When I do a directory list I want to map icons from that iconform to
> each item in the columnview directory depending on each directory
> entry's file type.
>
> I've been doing this using a collection with references to individual
> icons on disk, e.g.
>
> FileImages.Add["file-archive.png","archive"]
> then referencing it using
>
> picture[FileImages[filetype]]
>
> This works but I'd rather store the icons in the project and reference
> them without having to pack a bunch of icon files in the final
> distributable.  So I've used pictureboxes on a seperate hidden form but
> I've not figured how how to reference them - preferably with a hash or
> collection of sorts.
>
> Any ideas how I can do this?

I think you theoretically could use the OOP functionality and make a class
that inherits from Form (ie: INHERITS Form) but having the IDE recognize
it might be an issue since unless the IDE recognizes your derived
object(s) it won't get included with the compiled project.

This is most likely a question for the gambas gurus that know more about
what is going on under the hood.

If you are really desperate you could use SHELL based access and use tar,
optionally with the -z (gzip), or -j/-y (bzip2) modes.  This would still
require a single file to go along with your project but one tarball is
neat, tidy and optionally compressable.  And there won't be the en masse
barrage of files using up unnecessary inodes.  One entertaining thought
that comes to mind is mmap'ing the tarball but to be efficient the tarball
would need to be left raw (uncompressed).

.=================================================.
|  Christopher BRIAN Jack aka "Gau of the Veldt"  |
+================================================='
| brian _AT_ brians-anime _DOT_ com
`=================================================-
Hi Spambots, my email address is sputnik at ...1334...




More information about the User mailing list