Error : Lock required <oCol:bOnPostEdit> (is locked !)

Error : Lock required <oCol:bOnPostEdit> (is locked !)

Postby ukoenig » Sat Nov 22, 2008 2:22 pm

Hello,
Because of just edit a single field, I wanted to use < oCol:bOnPostEdit >
As soon I edit the field ( after RETURN ), there is a error.
A normal read / save in the network is no problem.
The record is locked and I get a Error : Lock required.
What is wrong with this line ?

Code: Select all  Expand view

//---------- at Start ----------------------

REQUEST DBFCDX
Rddsetdefault("DBFCDX")

IF !FILE(c_Path + "\WRITE.DBF")
   aStru := { {"TYPE","C",    7, 0}, ;
      {"FORMAT","C",   30, 0}, ;
      {"EXTENSION","C",     5, 0}, ;   
      {"INFO","C",   70, 0}, ;
      {"SORT","C",     3, 0}}

      DBCREATE("&c_Path\WRITE.DBF", aStru)
      NET_APPEND( 5, 5 ) // Network-function
ENDIF

DBSELECTAREA(2)
IF NET_USE(c_Path + "\WRITE.DBF", 5, 5,.T.)  // Network-function
    ORDCREATE( ,"WRITE","SORT", {|| SORT } , .F. )
ELSE
     MsgAlert( "Error open Format-File","Format-File")
     RETURN( NIL )
ENDIF

// ------  Inside a function ----------------------------

DBSELECTAREA(2)
DBSETORDER(1)
DBGOTOP()

oLbx7 := TXBrowse():New( oFolder:aDialogs[2] )
oLbx7:nMarqueeStyle := MARQSTYLE_HIGHLCELL
oLbx7:nColDividerStyle    := LINESTYLE_BLACK
oLbx7:nRowDividerStyle := LINESTYLE_BLACK
oLbx7:nRecSelColor = 15512898
oLbx7:bClrSelFocus = { || { 16777215, 15512898 } }
oLbx7:bClrSel = { || { 16777215, 15512898 } }

oCol := oLbx7:AddCol()
oCol:cHeader  := "Sort"
oCol:bStrData  := { || (2)->SORT }
oCol:nWidth  := 50
oCol:bEditValue := { || (2)->SORT }
oCol:bOnPostEdit := {|oCol, xVal, nKey | ;
IF( nKey == VK_RETURN, ( DBRLOCK(), (2)->SORT := xVal, DBUNLOCK() ),) }

oLbx7:SetRDD()

oLbx7:CreateFromResource( 110 )



Error description: Error DBFCDX/1022 Lock required

Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:POSTEDIT(0)
Called from: .\source\classes\XBROWSE.PRG => EDITGETLOSTFOCUS(0)
Called from: .\source\classes\XBROWSE.PRG => (b)TXBRWCOLUMN:EDIT(0)
Called from: .\source\classes\WINDOW.PRG => TWINDOW:LOSTFOCUS(0)
Called from: .\source\classes\CONTROL.PRG => (b)TCONTROL:TCONTROL(0)
Called from: => TCONTROL:LOSTFOCUS(0)
Called from: .\source\classes\TGET.PRG => TGET:LOSTFOCUS(0)
Called from: .\source\classes\CONTROL.PRG => TGET:KILLFOCUS(0)
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(0)
Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(0)
Called from: => SYSREFRESH(0)
Called from: .\source\classes\CONTROL.PRG => TCONTROL:KEYCHAR(0)
Called from: .\source\classes\TGET.PRG => TGET:KEYCHAR(0)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(0)
Called from: .\source\classes\TGET.PRG => TGET:HANDLEEVENT(0)
Called from: .\source\classes\WINDOW.PRG => _FWH(0)
Called from: => DIALOGBOX(0)
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(0)

Regards
Uwe :lol:
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Postby Daniel Garcia-Gil » Sat Nov 22, 2008 2:48 pm

TEST..
( 2 )->( DBRLOCK() )
( 2 )->( DBUNLOCK() )

or
oCol:bOnPostEdit := {|oCol, xVal, nKey | ;
IF( nKey == VK_RETURN, ( eval(oLbx7:bLock) , (2)->SORT := xVal, eval( oLbx7:bUnlock ) ),) }
User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Record locking

Postby ukoenig » Sat Nov 22, 2008 3:06 pm

Hello mcfox,

Thank You very much, with this solution it works fine now.
Because of my own Network-functions I used :

(2)->(NET_RLOCK( 5, 5 )) // waiting-time, and trys
(2)->(NET_ULOCK())

Because of a indexed field, I had still to add oLbx7:Refresh()
----------------------------------------------------------------------
oCol:bOnPostEdit := {|oCol, xVal, nKey | IF( nKey == VK_RETURN, ;
( (2)->(NET_RLOCK( 5, 5 )), (2)->SORT := xVal, (2)->(NET_ULOCK()), ;
oLbx7:Refresh() ),) }

Regards
Uwe :lol:
Last edited by ukoenig on Sat Nov 22, 2008 4:20 pm, edited 2 times in total.
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: Record locking

Postby demont frank » Sat Nov 22, 2008 3:31 pm

ukoenig wrote:Hello mcfox,

Thank You very much, with this solution it works fine now.
Because of my own Network-functions I used :

(2)->(NET_RLOCK( 5, 5 )) // waiting-time, and trys
(2)->(NET_ULOCK())

Regards
Uwe :lol:


Saw to late same solution , sorry

Frank
demont frank
 
Posts: 167
Joined: Thu Mar 22, 2007 11:24 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 103 guests