[Gambas-user] Progressbar

Charlie karl.reinl at ...9...
Sat Jan 1 23:20:02 CET 2005


scatman schrieb:

>Am Freitag, 31. Dezember 2004 17:02 schrieb Charlie Reinl:
>
>Hi,
>
>  
>
>>Salut,
>>
>>without seeing the code , I would say
>>
>>try a WAIT  in the loop
>>
>>    
>>
>
>Here the Code (Wait don't Helps)
>
>PUBLIC hNew AS FStatus
>FStatus.Visible = TRUE
>____________________
>
>
><Schnip>
>
>(Main)
>
>##########################################################
>
>PUBLIC SUB ProgressBar_Timer(OPTIONAL Result$ AS String )
>
>DIM ckSize AS File
>DIM x AS Integer
>DIM z AS Integer
>DIM PTimer AS Float
>'DIM result AS String
>DIM VobSize[21] AS Float
>
>'nach vorhandenen VOBs gucken. Zur Berechnung von PTimer
>
>FOR x = 20 TO 0 STEP - 1
>    FOR z = 20 TO 0 STEP - 1
>    IF Exist(sPath &/lsDVD&/"VIDEO_TS/VTS_0" & x & "_" & z & ".VOB") THEN
>OPEN sPath&/lsDVD&/"VIDEO_TS/VTS_0" & x & "_" & z & ".VOB" FOR READ AS #ckSize
>    VobSize[x] = Lof(ckSize)
>    SummeGesammt = SummeGesammt + VobSize[x] / 1024 * 1000
>  END IF
> NEXT
>NEXT
>
>      PTimer = Round(SummeGesammt * 100 / FilmLaengeKb)
>
>      Result$ = Str(PTimer)
>
>'This one works in the Main 
>
>ProgressBar1.Value = Mid$(Result$, 1,1) & "." & Mid$(Result$, 3.1) & 
>Mid$(Result$,4,1)
>
>SummeGesammt = 0
>hNew = NEW FStatus (Result$)
>
>END
>
>################################################################
>
>'Gambas Class file
>'Form2 (FStatus)
>
>PUBLIC SUB _New (OPTIONAL result$ AS String )  
>
>' and this one dont work
>
>ProgressBar1.Value  = Mid$(Result$, 1,1) & "." & Mid$(Result$, 3.1) & 
>Mid$(Result$,4,1)
>
>'but i can Print the Values out in the DirektWindow
>
>PRINT "Value in FORM 2  = ", Mid$(Result$, 1,1) & "." & Mid$(Result$, 3.1) & 
>Mid$(Result$,4,1)
>
>END
>  
>
Salut,

to see it just add a ME.show before END of the _New in FStatus.

Your FStatus.Visible = TRUE does nothing, and replace not the Show, only 
says FStatus is visible.

BUT why the hell do you make that in _new ?
You create every time a new Form to show the result (hope you close then 
correctly after).

Better would be to open the Form once, then you use a Public Sub to 
update the Progressbar.

    public sub updPrgBar(result$ AS String )

         -------- here your code from FStatus _new

    end

and then you call it by FStatus.updPrgBar(Result$ ) from the first Form.

Amicalment
Charlie






More information about the User mailing list