Source language: Translate to:

ProgressBar.Value ?

General questions about NeoAppBuilder - our rapid application development tool for building HTML5, web and mobile apps.

Moderator: Neosoft Support

ProgressBar.Value ?

Postby bingo » Sat Jan 24, 2015 2:49 am

Hello,

Trying to understand how to use AppBuilder, I made a simple project : a ProgressBar and a button with a loop to change the ProgressBar.Value

In the code of the Button, I have put this :

Code: Select all
SetVar [pValue] 0

If [pValue] == 0
   Loop 0 99 [pValue]
        SetAttribute #ProgressBar1 "value" "pValue"
   EndLoop
Else

EndIf


But while expecting to have my ProgressBar increase each time I press the Button, it does it only once (even if I reset the pValue to 0 after each button's click.

Any idea about what I am missing (not understanding) ? Thanks
User avatar
bingo
 
Posts: 28
Joined: Fri Mar 05, 2010 11:29 am
Location: France

Re: ProgressBar.Value ?

Postby PaulTomo » Sat Jan 24, 2015 5:53 am

Gave this a try and I get the same results.

If you add an extra button and set the value to 0 by clicking that first it will then run the progress bar again but I don't think it actually does what you are expecting it to.

It appears to me that the Loop is taking priority as it is run, then once it has, the progress bar just fills as if you clicked the button with the value set to its max.
If you just add this to the button, you get the exact same result on screen as the code runs that you see with the Loop example.
Code: Select all
SetVar [pValue] 100



I tried it with a 1 second Delay added in just after the variable is set back to "0" to see if I could stop the loop from running to quick on the second button press and hopefully giving the "pValue" more of a chance to set it's self back to "0"

Code: Select all
SetVar [pValue] 0
Delay 1000
If [pValue] == 0
   Loop 0 99 [pValue]
        SetAttribute #ProgressBar1 "value" "pValue"
   EndLoop
Else
EndIf


Unfortunately this through up an error of it's own and the code then failed to run, looks like the Delay function has it's own bug!
ReferenceError. "delay" is Undefined

Another couple of things here it seems for the team to take a look at.
User avatar
PaulTomo
 
Posts: 62
Joined: Tue Apr 28, 2009 1:15 am
Location: UK

Re: ProgressBar.Value ?

Postby djmarkes » Sat Jan 24, 2015 6:10 am

Try:

Code: Select all
SetVar [pValue] 0
Delay 1000
If [pValue] == 0
   Loop 0 99 [pValue]
        SetVar [ValueProgress] "[pValue]"
   EndLoop
Else
EndIf


And paste the [ValueProgress] variable in the value of the property value.
Diseño gráfico y Web profesional
http://www.jm-style.net
User avatar
djmarkes
 
Posts: 191
Joined: Thu May 26, 2011 5:08 pm

Re: ProgressBar.Value ?

Postby Gaev » Sat Jan 24, 2015 7:44 am

Bingo, PaulTomo:

Yes, the Delay command does not appear to work ... but I don't know if it would solve your dilema.

There is nothing wrong with your code per se ... but the Progress Bar object is being rendered ONLY at the end of the event routine ... so if you do this ...
Code: Select all
SetVar [progressValue] 0
Loop 0 5 [progressValue]
   SetVar [ProgressBar1Value] "[progressValue]"
   jsAlert "[progressValue] ... [ProgressBar1Value]"
EndLoop

... you can see that the rendering takes place at the end of the loop ... so, when it is already at 5 (100 in your case) ... and at the end of the second/subsequent clicks of the button, you want it to be 'the same value', you do not see the progress.

I created a separate button with code ...
Code: Select all
SetVar [ProgressBar1Value] 0

... and if you click the 2 buttons alternatively, you can see that the code works as expected.

So, the question (for Dave) is ... how does one cause a Refresh (rendering) of the Object during an event routine ? ... I think the Delay command won't do it ... may have to start a Timer (javascript: setInterval() or setTimeout() ) ... and have the updates to the [ProgressBar1Value] variable done in each Timer event.
User avatar
Gaev
 
Posts: 3735
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: ProgressBar.Value ?

Postby Neosoft Support » Mon Jan 26, 2015 11:52 am

I think we'll probably need some type of dedicated refresh action to force the browser to update the display. Setting a variable in JavaScript doesn't automatically trigger a screen refresh and we probably wouldn't want it to because it would be very slow.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5603
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA


Return to General NeoAppBuilder Discussion

Who is online

Users browsing this forum: No registered users and 0 guests