FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Get lock up problem
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Get lock up problem
Posted: Wed Sep 20, 2006 04: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

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 252
Joined: Tue Oct 25, 2005 02:48 PM
Re: Get lock up problem
Posted: Wed Sep 20, 2006 04: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

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Get lock up problem
Posted: Wed Sep 20, 2006 06:22 PM

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

EMG

Posts: 252
Joined: Tue Oct 25, 2005 02:48 PM
Re: Get lock up problem
Posted: Wed Sep 20, 2006 07:00 PM

Enrico,

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

Regards!
Maurilio

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Get lock up problem
Posted: Wed Sep 20, 2006 08:26 PM

No, it isn't.

EMG

Posts: 160
Joined: Tue Oct 18, 2005 10:21 AM
Get lock up problem
Posted: Thu Sep 21, 2006 08:03 AM

Hi EveryBody,

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

Best regards,

Badara Thiam
http://www.icim.fr

Continue the discussion