Thread on FWH
Posted: Mon Feb 16, 2009 1:11 pm
Hello Mr.Antonio,
In this topic:
http://forums.fivetechsupport.com/viewt ... =3&t=10439
I read is not possible use mult-thread in FWH, but you ask for what
need this...
Please, see the code below:
I need start another thread because a SQL query make a current thread busy
and the timer of the progress bar dont work...
In this case, I will call a timer from second thread...
Any sugestion ?
regards
In this topic:
http://forums.fivetechsupport.com/viewt ... =3&t=10439
I read is not possible use mult-thread in FWH, but you ask for what
need this...
Please, see the code below:
Code: Select all
//------------------------------------------------------------------------------
Function Test()
MsgProgres('Executing SQL query...','Wait, please...',{|| Query() },.F.)
SELECT TEMP
GO TOP
BROWSE()
return
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
FUNCTION Query()
cSqlComand = "SELECT ID,Name,City,Country,Phone FROM tbCustomers ORDER BY Name"
USE 'tbCustomers' AS cSqlComand ALIAS 'TEMP' VIA 'MySQL'
RETURN
//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
FUNCTION MsgProgres(cCaption,cTitle,bAction)
LOCAL oDlg
LOCAL nWidth:=0
PRIVATE nContx:=0, oTimerx, oProgress
DEFINE DIALOG oDLG FROM 01,01 TO 09,41 TITLE cTitle STYLE DS_MODALFRAME
oProgress = TProgress():New(02,01,oDlg,0,,,.F.,.F.,140,10)
nWidth=oDLG:nRight-oDLG:nLeft
oDlg:bStart = {|| Eval(bAction,oDlg),;
oTimerx:End() ,;
oDlg:End() ,;
SysRefresh() }
oDlg:bPainted = {|hdc| oDlg:Say(01,02,xPadr(cCaption,nWidth)), SysRefresh() }
ACTIVATE DIALOG oDlg CENTER ON INIT (xInic(oDlg),oTimerx:Activate(),SysRefresh())
RETURN
//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
FUNCTION xInic(oDlg)
DEFINE TIMER oTimerx OF oDlg INTERVAL 1 ACTION (oProgress:SetPos(++nContx),;
nContx:=IF(nContx>150,0,nContx),;
SysRefresh())
RETURN
//---------------------------------------------------------------------------------
and the timer of the progress bar dont work...
In this case, I will call a timer from second thread...
Any sugestion ?
regards