Get lock up problem

Post Reply
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Get lock up problem

Post 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
User avatar
Maurilio Viana
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil
Contact:

Re: Get lock up problem

Post 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
User avatar
Maurilio Viana
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil
Contact:

Re: Get lock up problem

Post by Maurilio Viana »

Enrico,

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

Regards!
Maurilio
User avatar
Badara Thiam
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France
Contact:

Post by Badara Thiam »

Hi EveryBody,

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

Best regards,
Badara Thiam
http://www.icim.fr
Post Reply