Page 1 of 1

Get lock up problem

Posted: Wed Sep 20, 2006 4:10 pm
by Jeff Barnes
Hi Everybody,

I have a strange problem and I can not figure out what is happening...

In my app I have a dialog that displays info that I read in from a serial port. At a set time (5 seconds after data collection starts) I pop up a window asking for some user input.

For some reason, if the user tries to click OK as soon as the window opens the program locks up and the window will not close.

Any Ideas? (code below)

Thanks,

Jeff

Function GetBORG(nRecordNum)
LOCAL nBorg1:=0, nBorg2:=0, oBORG, oSayBorg, cBorgTitle

if ! empty( oBtn1Stop )
oBtn1Stop:Disable()
endif

if nRun = 1
cBorgTitle := "Start Rest"
elseif nRun = 2
cBorgTitle := "DeSat-Room Air test"
elseif nRun = 3 .and. lFirstRun
cBorgTitle := "Start O2 Test"
lStartO2 := .t.
lFirstRun := .f.
else
cBorgTitle := "Same time as DeSat in Room Air"
endif
Define Window oBORG Title "Enter BORG ("+cBorgTitle+")" from 10,10 to 20,55 NOSYSMENU
@ 2,6.5 say oSayBorg PROMPT "Dyspnea " of oBorg COLOR RGB(0,0,0),RGB(255,255,255)
@ 3.5,5 Get oGet var nBORG1 of oBORG SIZE 40,20 PICTURE "99.9"
@ 5,7.5 BUTTON oBtnBorgOK PROMPT "OK" SIZE 100,20 of oBORG ACTION (UpdateBORG(nRecordNum, nBORG1),oBORG:End())
oBtnBorgOK:Disable()
oBORG:Center()
Activate window oBORG
SysWait(.01)
SetWindowPos(oBORG:hWnd, -1,0,0,0,0,3)
Return Nil


Function UpdateBORG(nRecordNum, mData1 )
Use OxData Shared NEW Alias "BORG"
dbgoto( nRecordNum )
do while ! rlock()
enddo
BORG->BaseDys := mData1
BORG->WalkMark := .t.
if nRun = 1
mSatRest := VAL(SubStr(BORG->Data,6,3))
mDysRest := mData1
elseif nRun = 2
mSatEndAir := VAL(SubStr(BORG->Data,6,3))
lManualDeSat:=.t.
mDysAir := mData1
Borg->TextMark := "*"
BORG->O2 := .t.
else //nRun=3
if lStartO2
mSatO2 := VAL(SubStr(BORG->Data,6,3))
mDysO2 := mData1
lStartO2 := .f.
BORG->Stopped := .t.
else
mFatRest:= mData1
endif
endif
use
if ! empty( oBtn1Stop )
oBtn1Stop:Enable()
endif
Return Nil

Re: Get lock up problem

Posted: Wed Sep 20, 2006 4:52 pm
by Maurilio Viana
Jeff,

Try any like do a SysRefresh() before activate dialog or SysWait(nSeconds) and SysRefresh()...

define dialog .......
(...)

SysWait(2) // wait 2 seconds
SysRefresh()

activate dialog....

What I think is "let a time" to your program when it let last window and will display the new...

Regards,
Maurilio

Re: Get lock up problem

Posted: Wed Sep 20, 2006 6:22 pm
by Enrico Maria Giordano
SysWait() is nothing more than a loop of SysRefresh().

EMG

Re: Get lock up problem

Posted: Wed Sep 20, 2006 7:00 pm
by Maurilio Viana
Enrico,

I thought SysWait( ) was a FW version of Windows Sleep API function...
I'm confused :(

Regards!
Maurilio

Re: Get lock up problem

Posted: Wed Sep 20, 2006 8:26 pm
by Enrico Maria Giordano
No, it isn't.

EMG

Posted: Thu Sep 21, 2006 8:03 am
by Badara Thiam
Hi EveryBody,

I use always StopUntil() instead SysWait(), who take all the cpu time...!

Best regards,