Get lock up problem

Get lock up problem

Postby Jeff Barnes » Wed Sep 20, 2006 4:10 pm

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
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Get lock up problem

Postby Maurilio Viana » Wed Sep 20, 2006 4:52 pm

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

Re: Get lock up problem

Postby Enrico Maria Giordano » Wed Sep 20, 2006 6:22 pm

SysWait() is nothing more than a loop of SysRefresh().

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Get lock up problem

Postby Maurilio Viana » Wed Sep 20, 2006 7:00 pm

Enrico,

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

Regards!
Maurilio
User avatar
Maurilio Viana
 
Posts: 252
Joined: Tue Oct 25, 2005 2:48 pm
Location: Garça/Garza/Heron City - Brazil


Postby Badara Thiam » Thu Sep 21, 2006 8:03 am

Hi EveryBody,

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

Best regards,
Badara Thiam
http://www.icim.fr
User avatar
Badara Thiam
 
Posts: 160
Joined: Tue Oct 18, 2005 10:21 am
Location: France


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 93 guests