[Gambas-user] WAIT ... is it an (un) necessary evil for my app?

Daniel Campos dcamposf at ...626...
Tue May 26 20:42:01 CEST 2009


Don't wait, remove this part of the code:

 IF $hproc.value > 0 then
   RETURN $hproc.Value
 ELSE
  RETURN 0
END IF

Then create an event handler for the "kill" event which is raised once the
program is finished



2009/5/26 M0E Lnx <m0e.lnx at ...626...>

> So, the next version of my vinstall-ng app is really shaping up
> nicely, but I'm running into a weird dilemma here.
>
> This is a linux installer, so there is a lot of decompression going on
> in the background as packages are being installed using via the gambas
> EXEC method.
>
> Here is the problem I'm having though. I have string arrays of package
> names to install one at a time.
> I have a sub that reads these arrays and processes each package at a time
> I have a function that simply installs the package and checks to make
> sure the process didn't return an error. Allow me to demonstrate
>
> PUBLIC  INSTALL_FROM_ARRAY(sList as string[])
> DIM sPkg as string
> DIM i, iRet as Integer
>
> FOR i = 0 to sList.Max
> IF  INSTALL_THIS_PACKAGE(trim(sList[i])) > 0 then RETURN
> pbprog.value = i / sList.count
> NEXT
>
> END
>
> PUBLIC FUNCTION INSTALL_THIS_PACKAGE(sPkgPath as String) as Integer
> dim $hproc as Process
>
> $hproc = EXEC ["/sbin/installpkg","-q","-R", ClsGlobal.sTargetPath,
> sPkgPath] WAIT
>  IF $hproc.value > 0 then
>    RETURN $hproc.Value
>  ELSE
>   RETURN 0
> END IF
>
> END
>
> My problem is that the progressbar does not update as every package
> installs.
> I need to add a wait of at least 0.25 before each package gets
> installed to give the progressbar time to update.
> The background processes do run without the wait instance, but the GUI
> seems stuck. On the other hand, if I want the progressbar, I have to
> sacrifice performance.
>
> Can anyone think of a way around this?
> Using gambas2.2.12 app uses gb.gtk
> Any help is welcome.
>
> Thanks
>
>
> ------------------------------------------------------------------------------
> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
> is a gathering of tech-side developers & brand creativity professionals.
> Meet
> the minds behind Google Creative Lab, Visual Complexity, Processing, &
> iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
> Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list