[Gambas-user] Databases, please help me!

Benoît Minisini gambas at ...1...
Sun Feb 7 19:09:19 CET 2010


> I'm slightly going angry.
> 
> This excerpt shows the part of code which aims to give each file in the
> TreeView its thumbnail image:
> 
> querry = "SELECT FPath,FName,FSubs FROM " & CD
> valasz = DBconX.Exec(querry)
> FOR EACH valasz
> fle.Add(valasz!"FName")

Don't use quote there. It is:

	valasz!FName

Or

	valasz["FName"]

> pth.Add(valasz!"FPath")
> subs.Add(valasz!"FSubs")
> tipus = valasz!"FSubs"
> SELECT tipus
> CASE 0 ' here the story starts
> 
>   amo = Split(valasz!"FName", ".")
>   exty = Upper$(amo[amo.Count - 1])
>     SELECT exty
>        CASE "PDF"
>           mokka = "pdf.png"
>        CASE "JPG"
> 
>           IF showthumbs.Value = TRUE THEN
>             mokka = GetThumb(valasz!"FName", CD)' Send the filename and the
> volumename
>           ELSE
>            mokka = "jpg.png"
>           ENDIF
>        CASE "TTF"
>           mokka = "ttf.png"
>        CASE "XCF"
>           mokka = "xcf.png"
>        CASE "PNG"
>           mokka = "png.png"
>        CASE "SWF"
>           mokka = "swf.png"
>        CASE "K3B"
>           mokka = "k3b.png"
>        CASE "FLV"
>           mokka = "swf.png"
>        CASE "MP3"
>           mokka = "mp3.png"
>        CASE "BIN"
>           mokka = "run.png"
>        CASE "SH"
>           mokka = "sh.png"
>        CASE "PY"
>           mokka = "sh.png"
>        CASE "PS"
>           mokka = "ps.png"
>        CASE "XML"
>           mokka = "xml.png"
>        CASE "OTF"
>           mokka = "otf.png"
>        CASE "WMF"
>           mokka = "wmf.png"
>        CASE "SLA"
>           mokka = "sla.png"
>        CASE "MP4"
>           mokka = "mp4.png"
>        CASE "RUN"
>           mokka = "run.png"
>        CASE "PPT"
>           mokka = "ppt.png"
>        CASE "PPS"
>           mokka = "pps.png"
>        CASE "TXT"
>           mokka = "txt.png"
>        CASE "SRT"
>           mokka = "txt.png"
>        CASE "SUB"
>           mokka = "txt.png"
>        CASE "DOC"
>           mokka = "doc.png"
>        CASE "XLS"
>           mokka = "xls.png"
>        CASE "ISO"
>           mokka = "iso.png"
>        CASE "WAV"
>           mokka = "wav.png"
>        CASE "WMA"
>           mokka = "wma.png"
>        CASE "OGG"
>           mokka = "ogg.png"
>        CASE "AVI"
>           mokka = "avi.png"
>        CASE "MPEG"
>           mokka = "mpg.png"
>        CASE "ODT"
>           mokka = "odt.png"
>        CASE "ODS"
>           mokka = "ods.png"
>        CASE "ODP"
>           mokka = "odp.png"
>        CASE "ODG"
>           mokka = "odg.png"
>        CASE "MPG"
>           mokka = "mpg.png"
>        CASE "DEB"
>           mokka = "deb.png"
>        CASE "RPM"
>           mokka = "rpm.png"
>        CASE "HTM"
>           mokka = "htm.png"
>        CASE "HTML"
>           mokka = "htm.png"
>        CASE "GIF"
>           mokka = "gif.png"
>         CASE "SVG"
>           mokka = "svg.png"
>         CASE "BMP"
>           mokka = "bmp.png"
>         CASE "EXE"
>           mokka = "exe.png"
>         CASE "RTF"
>           mokka = "rtf.png"
>         CASE ELSE
>           mokka = "pot.png"
>     END SELECT
> 
> CASE 1
> mokka = "fold.png"
> CASE 3
> mokka = "arch.png"
> END SELECT
> imager.Add(mokka)
> NEXT
> 
> 
> FOR i = 0 TO imager.Count - 1
> IF (subs[i] = 1 AND pth[i] = "/") THEN
>     fView.Add(pth[i] & fle[i], fle[i], Picture.Load(imager[i]), pth[i])
> ENDIF
> IF (subs[i] = 1 AND pth[i] <> "/") THEN
>     fView.Add(pth[i] & "/" & fle[i], fle[i], Picture.Load(imager[i]),
> pth[i])
> ENDIF
> IF (subs[i] = 0 OR subs[i] = 3) THEN
>    fView.Add(pth[i] & "/" & fle[i], fle[i], Picture.Load(imager[i]),
>  pth[i]) ENDIF
> NEXT
> 
> I did everything: I've separated the filename, filepath and filetype and
> file/folder identificator into different arrays. Still EVERY element with .
> jpg extension gets the same thumbnail, which is the last image loaded at
> all. How on earth is possible to manage this dinamically? Gambas is so
> unlogical! Every imager[i] is different, what's wrong for God's sake?!

I've never seen that behaviour... Can you provide the full source code? Which 
system language do you use?

-- 
Benoît Minisini




More information about the User mailing list