Hi Salvador!
re-created the browser by following your last OSR demo and here is the result
- Browser cannot be closed, it is crashing whenever i try to close it. It gives not responding error
- I cannot type anything by using my own keyboard, it crashes the soon i try to type something
OSR demo works as it is but i need to add some other things to make it work as required.
I am hoping you could tell what am i doing wrong or,
1) Perhaps you could tell me how can i terminate the OSR demo by using VK_ESCAPE with out crashing?
2) I am using a timer to calculate x minutes and reload the default url if user is idle for those x minutes
These 2 options are the things i need first to be able to terminate it because the border style of my browser form is set to bsNone and there is nothing to click for closing it.
I am using the following for reloading the browser if user is idle for 3 minutes,
First the idle time code,
Code: Select all
{ - <<< - [ user idle time events for reloading... ] - >>> - }
procedure TfrmMain.timerIdleTimeTimer(Sender: TObject);
var
vIdleTime: Cardinal;
vHours: Cardinal;
vMinutes: Cardinal;
vSeconds: Cardinal;
begin
{ calculate the idle time. It's in milliseconds }
vIdleTime := GetTickCount - FStartIdle;
{ get how many hour has the user been idle }
vHours := vIdleTime div (60 * 60 * 1000);
if vHours > 0 then
vIdleTime := vIdleTime - (vHours * 60 * 60 * 1000);
{ get the minutes part of the time the user been idle }
vMinutes := vIdleTime div (60 * 1000);
if vMinutes > 0 then
vIdleTime := vIdleTime - (vMinutes * 60 * 1000);
{ get the seconds part of the time the user been idle }
vSeconds := vIdleTime div 1000;
{ Show the duration of time user has been idle }
frmRequired.labelIdleTime.Caption := Format('%.2d:%.2d:%.2d',
[vHours, vMinutes, vSeconds]);
end;
and than the following timers for reloading the browser when user is idle,
Code: Select all
{ - <<< - [ refresh the web page if idle for 3 minutes... ] - >>> - }
procedure TfrmMain.timerRefreshTimer(Sender: TObject);
begin
if frmRequired.labelIdleTime.Caption = '00:03:00' then
begin
{ clear history and cache }
chromiumMain.CustomHeaderName := 'Cache-Control';
chromiumMain.CustomHeaderValue := 'no-cache';
{ reload browser }
chromiumMain.LoadURL(frmRequired.leditUserInterface.text);
{ close if on-screen keyboard is active }
if frmRequired.checkboxKeyboardStatus.Checked then
CloseOnScreenKeyboard;
end;
end;
{ - <<< - [ send refresh request... ] - >>> - }
procedure TfrmMain.timerSendRefreshTimer(Sender: TObject);
begin
if frmRequired.labelIdleTime.Caption = '00:03:05' then
timerIdleTime.Enabled := False;
end;
The URL is a user interface which is used by people and i need to make sure it goes to the main page when no one is using it and has been left at some stage.
If i can make these 2 work in OSR browser,
everything will be just fine.
Many thanks in advance