mwashington Posted April 2, 2013 Posted April 2, 2013 I have a button, and a text component. I would like the text component to display "Total Time: 00:00" initially, and once the Start button is pressed, the time starts counting. I have a Channel called AccumTime which is setup as a test channel and counts incrementing by 1 sec. All I need to know is the syntax for Scripting the Start Button to Start the Count
AzeoTech Posted April 2, 2013 Posted April 2, 2013 Use a variable value component. Set the caption to: Total Time and set the Expression to: formatTime(AccumTime[0])
mwashington Posted April 2, 2013 Author Posted April 2, 2013 OK, so now that I have the format correct, how about the second part. The start button, how do I make it start counting
AzeoTech Posted April 2, 2013 Posted April 2, 2013 I don't know how you are generating AccumTime so I can't say. You need to reset that to 0 in the Quick Sequence Action of the button.
mwashington Posted April 2, 2013 Author Posted April 2, 2013 pic1.jpg at the beginning of this post has the Channel AccumTime and it's parameters...
AzeoTech Posted April 2, 2013 Posted April 2, 2013 All that's doing is generating a sin wave. I'm guessing you just get numbers from -1 to 1. Do you want to log this count, or just see it?
mwashington Posted April 2, 2013 Author Posted April 2, 2013 No, actually I would like the Button to start a quick sequence that tells "component.varTotalTime.strCaption" to increment by 1 (counting indefinitely) When 60 seconds is made Total Time 01:00 is displayed, etc... By the way, Thank You for your assistance.
mwashington Posted April 2, 2013 Author Posted April 2, 2013 I figured how to get SYSTIME() to display in the variable component (Do I really have to programmatically tell DF to specify what I want displayed... Say 00:00, at first and then 00:01, and 00:02...etc... dependant on the current time.) That's really the only way I can see it working, unless there's another function out there
AzeoTech Posted April 2, 2013 Posted April 2, 2013 No, that is backwards. If you want to display time since a button was pressed do this: 1) in the button's Action, select Quick Sequence, and put: global startTime = systime() 2) create a variable value control like I first said. For the expression put: FormatTime(systime() - startTime) That's it. You don't need, or want a sequence.
mwashington Posted April 2, 2013 Author Posted April 2, 2013 I don't really need the time since the button was pressed, I need the increment of pressing the button, Press Start Button and the variable text component starts counting relative to nothing more than the Start Button being pressed... irregardless of how much time has elapsed since the button was pressed
AzeoTech Posted April 3, 2013 Posted April 3, 2013 You mean you want it to increment every time the Start button is pressed? Basically giving you the # of times the button was pressed? I'm really not clear what you are trying to count.
BeeHay Posted April 8, 2013 Posted April 8, 2013 Maybe he is looking for something like this? (lmk if you can not open the .ctl document, I will "re-compile" on my other machine!) HTH Time.ctl
BeeHay Posted April 8, 2013 Posted April 8, 2013 Here is another compiled version! Hope this helps! Time_5.87a.ctl
Recommended Posts
Archived
This topic is now archived and is closed to further replies.