The time has come...

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Bruce
    Indigo Rose Customer
    • Jun 2001
    • 2134

    The time has come...

    I have a raido button that is up on page show and this code:

    myCounter = 60;
    Page.StartTimer(1000);

    On Timer:

    myCounter = myCounter - 1;
    if (myCounter ==0) then
    Page.StopTimer();

    if butt_result then
    else
    myCounter=61;
    Paragraph.SetVisible("SEC Paragraph", false);
    Paragraph.SetVisible("Time Left Paragraph", false);
    end


    Page.Jump("contact");
    end

    when clicked the timer will not stop, its jacked up here somewhere.
  • holtgrewe
    Indigo Rose Customer
    • Jul 2002
    • 779

    #2
    Bruce,
    ... just an idea...

    Place a Dialog.Message("anything", "anything") between the (If ... then ... else) to see if the butt_result (true) is ever recognized.

    hth

    Comment

    • Bruce
      Indigo Rose Customer
      • Jun 2001
      • 2134

      #3
      I'm closer! Just cant get it to start back up when clicked again:


      myCounter = myCounter - 1;
      if (myCounter ==0) then
      Page.StopTimer();
      --Put any code you want here, like Page.Jump or anything else
      Page.Jump("contact");
      end



      Paragraph.SetText("SEC Paragraph", myCounter);
      butt_result = Button.GetState("time_Button");

      if butt_result == 1 then
      Paragraph.SetVisible("SEC Paragraph", true);
      Paragraph.SetVisible("Time Left Paragraph", true);
      myCounter = myCounter - 1;
      Paragraph.SetText("SEC Paragraph", myCounter);
      --result = Dialog.Message("Notice", "DOWN.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);

      elseif
      butt_result == 0 then
      Paragraph.SetVisible("SEC Paragraph", false);
      Paragraph.SetVisible("Time Left Paragraph", false);
      Page.StopTimer();
      --result = Dialog.Message("Notice", "UP.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
      end

      Comment

      • RizlaUK
        Indigo Rose Customer
        • May 2006
        • 5552

        #4
        stab in the dark here, but where are you trying to start the timer from, the button or the timer, cos you cant start the timer from within the timer

        also, are you resetting "myCounter", if it is still at 0 then the timer will start and stop stright away
        Embrace change in your life, you never know, it could all work out for the best

        Comment

        • Bruce
          Indigo Rose Customer
          • Jun 2001
          • 2134

          #5
          Originally posted by RizlaUK View Post
          stab in the dark here, but where are you trying to start the timer from, the button or the timer, cos you cant start the timer from within the timer

          also, are you resetting "myCounter", if it is still at 0 then the timer will start and stop stright away
          ahhhhhhh no? LOL

          From the timer and I think so...
          Last edited by Bruce; 02-06-2007, 02:44 PM.

          Comment

          • Bruce
            Indigo Rose Customer
            • Jun 2001
            • 2134

            #6
            Originally posted by RizlaUK View Post
            stab in the dark here, but where are you trying to start the timer from, the button or the timer, cos you cant start the timer from within the timer

            also, are you resetting "myCounter", if it is still at 0 then the timer will start and stop stright away
            How would you reset it?

            Comment

            • RizlaUK
              Indigo Rose Customer
              • May 2006
              • 5552

              #7
              well, it all depends,

              how many times do you want to call the counter, is it a one off thing

              you could:

              put in page show,
              CounterOn = true-will enable the counter
              myCounter = 60;
              Page.StartTimer(1000);

              if CounterOn then
              myCounter = myCounter - 1;
              if (myCounter ==0) then
              CounterOn = false--disable the counter
              myCounter = 60--reset the counter

              Page.StopTimer();
              --Put any code you want here, like Page.Jump or anything else
              Page.Jump("contact");
              end
              end
              then if you want to use the counter again, just add this to whatever calls the counter

              CounterOn = true
              Page.StartTimer(1000);

              EDIT:, if you are trying to start the timer from within the timer event after is has been stoped then nothing will happen

              what is it you are trying to do, i'll help ya come up with something
              Last edited by RizlaUK; 02-06-2007, 03:23 PM.
              Embrace change in your life, you never know, it could all work out for the best

              Comment

              • Bruce
                Indigo Rose Customer
                • Jun 2001
                • 2134

                #8
                Originally posted by RizlaUK View Post
                well, it all depends,

                how many times do you want to call the counter, is it a one off thing

                you could:

                put in page show,
                CounterOn = true-will enable the counter
                myCounter = 60;
                Page.StartTimer(1000);

                if CounterOn then
                myCounter = myCounter - 1;
                if (myCounter ==0) then
                CounterOn = false--disable the counter
                myCounter = 60--reset the counter

                Page.StopTimer();
                --Put any code you want here, like Page.Jump or anything else
                Page.Jump("contact");
                end
                end
                then if you want to use the counter again, just add this to whatever calls the counter

                CounterOn = true
                Page.StartTimer(1000);

                EDIT:, if you are trying to start the timer from within the timer event after is has been stoped then nothing will happen

                what is it you are trying to do, i'll help ya come up with something
                Thank you, well... I have a timer event that counts down that allows the end user one minute to do what they need to do on their password protector. I also have a raido button that allows them to stop the program from using the timer if they want. When pressed, it should stop the timer. When pressed again should start the count down once again starting from 60.

                Comment

                • RizlaUK
                  Indigo Rose Customer
                  • May 2006
                  • 5552

                  #9
                  ok, i got ya,

                  put this in your timer

                  PHP Code:
                  TimerState Button.GetState("btnTimer");
                  if 
                  TimerState == BTN_UP then
                      myCounter 
                  myCounter 1;
                      if (
                  myCounter ==0then
                      myCounter 
                  60--reset the counter
                      
                  --Put any code you want herelike Page.Jump or anything else
                      
                  Page.Jump("contact");
                      
                  end
                  else
                  myCounter 60--reset the counter
                  end 
                  there is no need to stop the timer, if the button is checked the timer will stop counting and reset to 60, and when unchecked it will count down from 60 again

                  EDIT:

                  no need to reset the timer as it gets set when you enter the page, try this

                  PHP Code:
                  TimerState Button.GetState("btnTimer");
                  if 
                  TimerState == BTN_UP then
                      myCounter 
                  myCounter 1;
                      if (
                  myCounter ==0then
                      
                  --Put any code you want herelike Page.Jump or anything else
                      
                  Page.Jump("contact");
                      
                  end
                  else
                  myCounter 60--reset the counter
                  end 
                  Last edited by RizlaUK; 02-06-2007, 04:19 PM.
                  Embrace change in your life, you never know, it could all work out for the best

                  Comment

                  • Bruce
                    Indigo Rose Customer
                    • Jun 2001
                    • 2134

                    #10
                    Works great! Thank you. :yes

                    Comment

                    • RizlaUK
                      Indigo Rose Customer
                      • May 2006
                      • 5552

                      #11
                      No Problem, Glad To Help
                      Embrace change in your life, you never know, it could all work out for the best

                      Comment

                      Working...
                      X