Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Percentage/Progress Bar
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
vertozia




PostPosted: Thu Jan 11, 2007 1:40 pm   Post subject: Percentage/Progress Bar

Hey there, i am making a progress bar for my main menu for my sumarative project. Here is the code that i have, notice that in the second code, the progress bar shows, and the nubers grow when the whole bar finishes.

Quote:
setscreen ("graphics")
setscreen ("offscreenonly")

colorback (black)
cls

color (white)

for h : 1..maxx by 1

for j : 1 .. 100 by 1
for i : 1..9 by 1
delay(5)
View.Update
cls
Draw.FillBox (1,1,h,60,white)
View.Update

delay(5)
put j,".",i

end for
end for
end for




Quote:


setscreen ("graphics")
setscreen ("offscreenonly")

colorback (black)
cls

color (white)
for j : 1 .. 100 by 1
for i : 1 .. 9 by 1
for h : 1 .. maxx by 1


delay (5)
View.Update
cls
Draw.FillBox (1, 1, h, 60, white)
View.Update

delay (5)
put j, ".", i

end for
end for
end for


thanks in advance
Sponsor
Sponsor
Sponsor
sponsor
Miketron




PostPosted: Thu Jan 11, 2007 2:19 pm   Post subject: RE:Percentage/Progress Bar

I have made a simpler loader. You can change the delay to make it go slower, change the count to make it shorter/end earlier, and you can make the count go up different, for example whenever something is loaded, etc.

code:

setscreen ("graphics")
setscreen ("offscreenonly")

colorback (black)
cls

var count : int

count := 1

loop
    if count = 700 then
        exit
    end if
    delay (5)
    View.Update
    cls
    Draw.FillBox (1, 1, count, 60, white)
    View.Update
    count := count + 1
end loop


Cervantes says: Please use code tags
vertozia




PostPosted: Thu Jan 11, 2007 8:55 pm   Post subject: Re: Percentage/Progress Bar

i understnd what you did, but that wasnt quite my problem, the problem is that when the progree bar works, the percentage displayed doesent move, then when you switch the lines of code arround, the text moves, but the bar doesent. See for yourself, even when using your code, only one displays, either the text, or the bar.

have a look,

code:
setscreen ("graphics")
setscreen ("offscreenonly")

var count : int:= 1

colorback (black)
cls
color (white)

for j : 1 .. 100 by 1
for i : 1..9 by 1


cls
delay(5)
put j,".",i

end for
end for


loop
    if count = 700 then
        exit
    end if
    delay (5)
    View.Update
    cls
    Draw.FillBox (1, 1, count, 60, white)
    View.Update
    count := count + 1
end loop



but when you put this piece of code in the end, only the bar is displayed, why is that?

code:
color (white)

for j : 1 .. 100 by 1
for i : 1..9 by 1


cls
delay(5)
put j,".",i

end for
end for

I am only assuming that either the one on the bottom or top is the dominant process or that the problem is with the timing of the process exectution.
Miketron




PostPosted: Thu Jan 11, 2007 10:50 pm   Post subject: Re: Percentage/Progress Bar

code:

setscreen ("graphics")

var count : int := 1
var count2 : int := 0
var count3 : int := 0

colorback (black)
cls
color (white)

process numbers

    for j : 1 .. 100 by 1
        for i : 1 .. 9 by 1

            locate (1, 1)
            put "" : 30
            locate (1, 1)
            put j, ".", i
            delay (10)

        end for
    end for

end numbers


process progbar

    loop
        if count = 700 then
            exit
        end if
        delay (14)
        Draw.FillBox (1, 1, count, 60, white)
        count := count + 1
    end loop

end progbar

fork progbar
fork numbers


Both were not running at the same time, Turing goes from top to bottem, "forking" is to make 2 processes run at the same time. Hope this helped.
Clayton




PostPosted: Thu Jan 11, 2007 10:55 pm   Post subject: Re: Percentage/Progress Bar

gaaaaahh! Don't use processes!!! You have no way of knowing if that loading bar is going to finish at the same time as your actual loading is. Instead, integrate the drawing of the bar in the loop that you are loading in.
lord




PostPosted: Thu Jan 11, 2007 11:03 pm   Post subject: Re: Percentage/Progress Bar

lol loris..................................u .................. Laughing Exclamation
nvm the top part it not to all only to one.....
anyways u dont need fork!!!!!! or a process....
make the bar first then make a percentage thing so it fit with in the bars time limit
all u need is 1 for loop
vertozia




PostPosted: Thu Jan 11, 2007 11:52 pm   Post subject: Re: Percentage/Progress Bar

thanks for the help, although the code given works, why not use it? and lord, "the guy" who knows my name, is this sid? when i put it within the loop under the same FOR variable, it only displays one process. Thanks to every1, i donated some bits to you Smile
Clayton




PostPosted: Thu Jan 11, 2007 11:58 pm   Post subject: Re: Percentage/Progress Bar

Throwing an egg off of a cliff to crack it open works, are you going to use that? The point is, just because something works doesn't necessarily mean you should use it.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: