Page 1 of 2
TIMEOUT
Posted: Thu Oct 06, 2016 8:48 am
by eckard
Hallo, good evening,
a friend, Michael Rudrich, helped me in programming a special software for my company.
As he died last year, I cannot ask him for a code-line, that I don't understand and that doesn't work.
TIMEOUT {1800, {||!DC_MsgBox(,,{"Timeout Erreicht! Fortsetzen"},"Timeout",,10,.t.,2)}}
The plan was, that the programm should close when the user is inactive for a specified time.
Then all databases should be closed and the programm should quit.
I cannot find a helpfile for my version of express (20264) to look how it works.
Is there someone who can help me or give me an information where I can find a helpfile for express?
Tankyou
Eckard Boettcher
Re: TIMEOUT
Posted: Thu Oct 06, 2016 9:59 am
by rdonnay
Eckard -
The information you posted is incomplete.
It appears that you have posted only a portion of a DCMSGBOX command that is in the code.
eXpress++ build 264 has a helpfile named EXPRESS.CHM.
It should be located in \exp20\doc.
Roger
Re: TIMEOUT
Posted: Fri Oct 07, 2016 7:30 am
by eckard
Hallo Roger,
I don't know how much code you need. Here is the code around the mentioned line:
UNTER_MENUES( GetList, @oMenuBar, .t., @oStatTop )
DCGETOPTIONS WINDOWHEIGHT 590 ;
WINDOWWIDTH 800 ;
MESSAGEINTO {|c|oMsgBox:setCaption(c)} ;
;//BITMAP 'BACK.BMP' ;
BITMAP 'MAINSCREEN.JPG' ;
RESIZE ;
RESIZEDEFAULT { bSetPos, bSetSize } ;
;//AUTORESIZE ;
RESTOREDEFAULTSBUTTON ;
EVAL {|o|SetTimerEvent(50,{||UpdateStats(GetList)}, ;
SetAppWindow(o))}
DCREAD GUI TITLE 'AXON Leasing' ;
PARENT @oDialog ;
OPTIONS GetOptions ;
SETAPPWINDOW ;
HANDLER _DlgHandler ;
EVAL {|o, oLog|Set_MainWindow(o), ;
Set_MessageBox(oMsgBox) ,;
oLog := Thread():New(),;
oLog:SetPriority(PRIORITY_BELOWNORMAL),;
oLog:Start('CheckLog')}
//TIMEOUT {1800, {||!DC_MsgBox(,,{"Timeout Erreicht! Fortsetzen"},"Timeout",,10,.t.,2)}}
DC_GetDestroy(Getlist)
DbCloseAll()
DbCommitAll()
I wish you a nice weekend
Eckard
Re: TIMEOUT
Posted: Fri Oct 07, 2016 8:04 am
by rdonnay
Ok, I see now that you are using the TIMEOUT clause of DCREAD GUI, not DCMSGBOX.
Your code looks correct.
The TIMEOUT clause should work as you requested.
I will write a sample program, based on your code, to make sure that it is working correctly.
Re: TIMEOUT
Posted: Fri Oct 07, 2016 8:24 am
by rdonnay
The below code is functioning correctly.
A message box will appear after 30 seconds of no mouse activity in the window.
Are you saying that your program is not working correctly?
Code: Select all
#INCLUDE "dcdialog.CH"
FUNCTION Main()
LOCAL GetList[0]
@ 0,0 DCSAY 'This is a TIMEOUT Test' SAYSIZE 0 FONT '16.Arial'
DCREAD GUI ;
FIT ;
TITLE 'TIMEOUT Testing' ;
ADDBUTTONS ;
TIMEOUT {30, {||!DC_MsgBox(,,{"Timeout Erreicht! Fortsetzen"},"Timeout",,10,.t.,2)}}
DC_GetDestroy(Getlist)
DbCloseAll()
DbCommitAll()
RETURN nil
* ------------
PROC appsys
Re: TIMEOUT
Posted: Fri Oct 07, 2016 8:36 am
by eckard
Thank you, I will test it at the weekend as I now have to leave.
Good evening
Re: TIMEOUT
Posted: Sun Oct 09, 2016 8:52 am
by eckard
Hallo Roger,
I inserted your codelines in my programm as you see below.
When I deactivate Michaels code between // 1 and // 2 and activate your code, it works.
The other way round, when I only activate Michaels code, nothing happens.
Something seems to collide there.
If you cannot find the problem in this way, my question is, whether you can help if you see the complete code.
I of course would pay for your help. Please send an invoice to:
AXON LEASING AG, Bretonischer Ring 15, D 85630 Grasbrunn - mail:
eboettcher@axon.de
So I loose a lot of time and no result is in sight.
Best regards
Eckard Böttcher
------------------------------
// 1 Michaels Code
DCREAD GUI TITLE 'AXON Leasing' ;
PARENT @oDialog ;
OPTIONS GetOptions ;
SETAPPWINDOW ;
HANDLER _DlgHandler ;
EVAL {|o, oLog|Set_MainWindow(o), ;
Set_MessageBox(oMsgBox) ,;
oLog := Thread():New(),;
oLog:SetPriority(PRIORITY_BELOWNORMAL),;
oLog:Start('CheckLog')};
TIMEOUT {10, {||!DC_MsgBox(,,{"Timeout Erreicht! Fortsetzen"},"Timeout",,10,.t.,2)}}
DC_GetDestroy(Getlist)
DbCloseAll()
DbCommitAll()
// 2
/* Rogers Code
@ 0,0 DCSAY 'This is a TIMEOUT Test' SAYSIZE 0 FONT '16.Arial'
DCREAD GUI TITLE 'TIMEOUT Testing' ;
TIMEOUT {10, {||!DC_MsgBox(,,{"Timeout Erreicht! Fortsetzen"},"Timeout",,10,.t.,2)}}
DC_GetDestroy(Getlist)
DbCloseAll()
DbCommitAll()
*/
Re: TIMEOUT
Posted: Mon Oct 10, 2016 7:59 am
by eckard
Hallo again,
I tested a little bit with Michaels code for the timeout.
I works without the last line in the EVAL-sequence for "CheckLog"
So it works:
--------------------------------
DCREAD GUI TITLE 'AXON Leasing' ;
TIMEOUT {5, {||!DC_MsgBox(,,{"Timeout Erreicht! Fortsetzen"},"Timeout",,10,.t.,2)}};
PARENT @oDialog ;
OPTIONS GetOptions ;
SETAPPWINDOW ;
HANDLER _DlgHandler ;
EVAL {|o, oLog|Set_MainWindow(o), ;
Set_MessageBox(oMsgBox) ,;
oLog := Thread():New(),;
oLog:SetPriority(PRIORITY_BELOWNORMAL)}//,;
// oLog:Start('CheckLog')}
-------------------------------------
Here you can see CheckLog():
--------------------------------------
Function CheckLog()
IF curDrive()="O" .OR. curDrive()="U"
IF valtype(oADS_Session) == "O"
IF oADS_Session:isConnected()
oADS_Session:SetDefault()
ENDIF
ENDIF
ENDIF
do while !lStopAllThreads
USER := GetStatic('USER')
DbCloseAll()
DbCommitAll()
DbUnlockAll()
IF NetUse("LOGIN", .F., 0)
go USER //str(USER) //&USERSTR
IF DbRLock()
LOG="j" // Grn
ELSE
LOG="n" // Rot
ENDIF
ENDIF
IF valtype(oDialog) = 'O'
//wtf Alias()
IF alltrim(LOG) == "j"
oDialog:SetTitle('AXON Leasing' + space(10) + "User: " + strzero(USER,2) + ' *** GELOCKT ***')
oLocked:SetColorBG(GRA_CLR_GREEN)
oLocked:SetColorFG(GRA_CLR_BLACK)
oLocked:SetCaption("Locked")
ELSE
oDialog:SetTitle('AXON Leasing' + space(10) + "User: " + strzero(USER,2))
oLocked:SetColorBG(GRA_CLR_RED)
oLocked:SetColorFG(GRA_CLR_RED)
oLocked:SetCaption("")
ENDIF
ENDIF
*DC_GetRefresh(oUserSay)
sleep(50)
enddo
DbCloseAll()
DbCommitAll()
DbUnlockAll()
sleep(10)
IF NetUse("LOGIN", .F., 0)
go USER //str(USER) //&USERSTR
DbUnlock()
DbCommit()
ENDIF
return (NIL)
------------------------------------
Best regards
Eckard
Re: TIMEOUT
Posted: Mon Oct 10, 2016 8:20 am
by rdonnay
Eckard -
Are you saying that everything is ok now?
Roger
Re: TIMEOUT
Posted: Mon Oct 10, 2016 1:17 pm
by eckard
No, sorry, please excuse my English,
it only works when I deactivate the last line with the function CheckLog(), you can see where "//" is before the line.
I don't know why this function blocks the TimeOut.
Therefore I gave you also the code of this function, that I need to see whether someone is allready locked in or not.
Good night
Eckard