Jump to content

change option script main form


Wilton Ergon

Recommended Posts

I have a script in the main form, and I need to change it at runtime, because the value of a variable is defined by a parameter, I tried to make this change in the create of the main form, but there was no effect

 

procedure TFrmPrincipal.UniFormCreate(Sender: TObject);
var tempoTimeOut:integer;
begin
 tempoTimeOut := i'm getparameter.....
 if tempoTimeOut>0 then
    self.script.Text :=StringReplace(script.Text,'var IDLE_TIMEOUT = 1800;','var IDLE_TIMEOUT = '+inttostr(tempoTimeOut*60)+';',[rfIgnoreCase,rfReplaceAll]);

 

my script... in form create, change var IDLE_TIMEOUT

var IDLE_TIMEOUT = 1800;
var _idleSecondsCounter = 0;
document.onclick = function() {
    _idleSecondsCounter = 0;
};
document.onmousemove = function() {
    _idleSecondsCounter = 0;
};
document.onkeypress = function() {
    _idleSecondsCounter = 0;
};
window.setInterval(CheckIdleTime, 1000);

function CheckIdleTime() {
    _idleSecondsCounter++;
    var oPanel = document.getElementById("SecondsUntilExpire");
    if (oPanel)
        oPanel.innerHTML = (IDLE_TIMEOUT - _idleSecondsCounter) + "";
    if (_idleSecondsCounter >= IDLE_TIMEOUT) {
        ajaxRequest(FrmPrincipal.form, '_idle_timeout', []);
    }
}
 

 

the objective, and that it is possible to configure the application timeout time

 

 

 

 

Link to comment
Share on other sites

29 minutes ago, Wilton Ergon said:

found the problem, elsewhere on the system, this script was removed, when the system was accessed by support, it was not necessary to adjust the variables as you suggested.

I recommended not replacing the script at all, just changing the variables that I specified and changing the values only for those variables.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...