KaMe
04-11-2004, 10:37 PM
Ok, here is an example script that i made just to show what i'm talking about.
global porcentagem = 0
global plbl = "0%"
rollout progress_roll "Progress"
(
progressbar pb height:30 width:274 color:(color 0 255 0)
label lbl "0%"
on Progress_roll open do
(
pb.value = porcentagem
lbl.text = plbl
)
)
rollout create_roll "Create Boxes"
(
button btn "Create Boxes" height:50
spinner spn "Number" width:100 type:#integer range:[0,100000,0]
on btn pressed do
(
for y=1.0 to spn.value do
(
global porcentagem = ((y/spn.value)*100)
porc = porcentagem as integer
global plbl = porc as string + "%"
destroydialog progress_roll
createdialog progress_roll 300 60
newbox = Box()
)
destroydialog progress_roll
)
)
myflo = newRolloutFloater "Create Boxes" 200 120
addrollout create_roll myflo
What i was trying to do is, when you click on a button, it opens a new Dialog with a progress bar, when the progress gets to 100% the dialog will automatcly close.
The script above works, but it is 2x slower then the same script without the new dialog. (It keeps closing and opening the dialog to update it).
I would like to know if there is an better way of doing this?
global porcentagem = 0
global plbl = "0%"
rollout progress_roll "Progress"
(
progressbar pb height:30 width:274 color:(color 0 255 0)
label lbl "0%"
on Progress_roll open do
(
pb.value = porcentagem
lbl.text = plbl
)
)
rollout create_roll "Create Boxes"
(
button btn "Create Boxes" height:50
spinner spn "Number" width:100 type:#integer range:[0,100000,0]
on btn pressed do
(
for y=1.0 to spn.value do
(
global porcentagem = ((y/spn.value)*100)
porc = porcentagem as integer
global plbl = porc as string + "%"
destroydialog progress_roll
createdialog progress_roll 300 60
newbox = Box()
)
destroydialog progress_roll
)
)
myflo = newRolloutFloater "Create Boxes" 200 120
addrollout create_roll myflo
What i was trying to do is, when you click on a button, it opens a new Dialog with a progress bar, when the progress gets to 100% the dialog will automatcly close.
The script above works, but it is 2x slower then the same script without the new dialog. (It keeps closing and opening the dialog to update it).
I would like to know if there is an better way of doing this?
