Jump to content

Show time remaining to expire


buguito

Recommended Posts

  • 3 weeks later...
I was able to accomplish the mission using some variables
 

MainForm - Script:

Function CheckIdleTime () {
     _idleSecondsCounter ++;
     Var oPanel = document.getElementById ("SecondsUntilExpire");
     If (oPanel)
         OPanel.innerHTML = (IDLE_TIMEOUT - _idleSecondsCounter) + "";


     AjaxRequest (MainForm.form, _idleSecondsCounter);
    
     If (_idleSecondsCounter> = IDLE_TIMEOUT) {
         AjaxRequest (MainForm.form, '_idle_timeout', []);
     }
}
function RetornaTempoRestante(pSegRestante: String): String;
const
  cSegParaExpirar: Integer = 30; //
var
  iSegOciosos ,
  iSegRestante: Integer;
begin
  try
    iSegOciosos  := StrToInt(pSegRestante);

    iSegRestante := (cSegParaExpirar - iSegOciosos);

    Result       := SegundosToTime(iSegRestante);
  except
    Result := '';
  end;
end;

procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string;
  Params: TUniStrings);
begin
  if IsNumeric(EventName) then
    UniLabel1.Caption := 'Tempo restante para expirar: ' + RetornaTempoRestante(EventName);

  if EventName = '_idle_timeout' then
    ShowMessage('Expirou');
end;
Link to comment
Share on other sites

  • 10 months later...

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...