This works well for the last months without any crashes or other problems.
Now, if I define one or more columns for inline editing, the functions crashes without any error when switching the column set.
Here is a sample to show the problem:
- Code: Select all Expand view
- #include "FiveWin.ch"
#include "XBrowse.ch"
STATIC oWnd, oBrw, oCol
FUNCTION Main()
USE Customer
DEFINE WINDOW oWnd MENU BuildMenu()
@ 0, 0 XBROWSE oBrw OF oWnd ALIAS "Customer"
oBrw:lFastEdit := .T.
oCol := oBrw:AddCol()
oCol:bStrData := { || Customer->First }
oCol:cHeader := "First"
oCol:nEditType := EDIT_GET
oCol:bOnPostEdit := { | oCol, xVal, nKey | If( RecCount() == 0, ( DbAppend(), oBrw:Refresh() ),), If( nKey == VK_RETURN, Customer->First := xVal,) }
oCol := oBrw:AddCol()
oCol:bStrData := { || Customer->Last }
oCol:cHeader := "Last"
oCol:nEditType := EDIT_GET
oCol:bOnPostEdit := { | oCol, xVal, nKey | If( RecCount() == 0, DbAppend(),), If( nKey == VK_RETURN, ( Customer->Last := xVal, DbAppend(), oBrw:Refresh() ),) }
oBrw:CreateFromCode()
oWnd:oClient := oBrw
ACTIVATE WINDOW oWnd
RETURN NIL
FUNCTION BuildMenu()
LOCAL oMenu
MENU oMenu
MenuItem "Redesign browse" ACTION RedesignBrowse()
ENDMENU
RETURN oMenu
FUNCTION RedesignBrowse()
DO WHILE .T.
IF Len( oBrw:aCols ) == 0
EXIT
ELSE
oBrw:DelCol( 1 )
ENDIF
ENDDO
oCol := oBrw:AddCol()
oCol:bStrData := { || Customer->First }
oCol:cHeader := "First"
oCol:nEditType := EDIT_GET
oCol:bOnPostEdit := { | oCol, xVal, nKey | If( RecCount() == 0, ( DbAppend(), oBrw:Refresh() ),), If( nKey == VK_RETURN, Customer->First := xVal,) }
oCol := oBrw:AddCol()
oCol:bStrData := { || Customer->Last }
oCol:cHeader := "Last"
oCol:nEditType := EDIT_GET
oCol:bOnPostEdit := { | oCol, xVal, nKey | If( RecCount() == 0, DbAppend(),), If( nKey == VK_RETURN, ( Customer->Last := xVal, DbAppend(), oBrw:Refresh() ),) }
oCol := oBrw:AddCol()
oCol:bStrData := { || Customer->Street }
oCol:cHeader := "Street"
oCol := oBrw:AddCol()
oCol:bStrData := { || "test" }
oCol:cHeader := "test"
oBrw:Refresh( .T. )
RETURN NIL
What is wrong?