[Gambas-user] How to run some job in background separately with UI

Fabien Bodard gambas.fr at ...626...
Thu Dec 23 21:49:40 CET 2010


yes you can


load the directory

in two way

the icon view and a string array


add a global index as private


this is


private iFileIndex as integer
private aFiles as New String[]


Public sub Form_Open()
dim sImage as string
Dim sPath as String = user.home &/ "Images"

For each sImage in dir(sPath, "*.jpg", gb.file)

  IconVew.add(sPath &/ sImage, sImage)
    if not exist(file.dir(sFile) &/ "thumbnail" &/ file.name(sFile))
then aFiles.add(sPath &/ sImage)

next
iFileIndex = 0
Timer1.Delay = 100
Timer1.Start

end

Public sub Timer1_Timer()
Dim sFile as String = aFile[iFileIndex]


    make the thumbnail and then

    IconView1[sFile].Picture = Picture[file.dir(sFile) &/ "thumbnail"
&/ file.name(sFile)]
    Inc iFileIndex
   if iFileIndex > aFile.Max then
       iFileIndex = 0
       Timer1.Stop
   endif

end























s> with an Icon view (like Nautilus or other files manager).
> Current, I do:
> - Get image files list of the folder. (1)
> - For each image, check if it had thumbnail, load thumbnail to Icon view. If
> not, load original image, create and save thumbnail, display into icon view.
> (2).
> Even I made cache with thumbnail, the program is freezed for a time with a
> folder including many files.
> Can I do like Nautilus doing: display all files with a default icon, user
> still can scroll, select ... while the program loads and displays the
> thumbnails (it means that can I run (2) in background) ?
>
> An additional request, do you have a sample about run-time resizable control
> (like we draw, resize controls to design form with Gambas IDE). I try to
> make a rectangle selection tool (like one of GIMP) to select an area of
> image, but I still have not any idea.
>
> Thank you, Merry Christmas and Happy new year :)
> ------------------------------------------------------------------------------
> Learn how Oracle Real Application Clusters (RAC) One Node allows customers
> to consolidate database storage, standardize their database environment, and,
> should the need arise, upgrade to a full multi-node Oracle RAC database
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



-- 
Fabien Bodard




More information about the User mailing list