OnPostEdit does not save changes

OnPostEdit does not save changes

Postby mariordz » Tue Apr 15, 2014 6:54 pm

Good afetrnoon all, I got an xbrowse, built from a DBF file, it builds fine and I have only one column to be edited, the user clicks twice on the cell or hits enter and changes the value already there, when hitting enter again the value is not saved neither in the xbrowse, nor in the DBF file, a zero is saved instead of the typed value, could you please take a look at my code and see what I am doing wrong?

Thanks in advance.

Code: Select all  Expand view

function resulrep
    Public oDlg, oBrw
    Public oBtn1, oBtn2, oBtn3
    ciccc="S"
    do while ciccc="S"
    close all
    USE &dbtmp1 shared new alias repos
    DEFINE DIALOG oDlg resource "dlgverdb3" of oVentprinc title "Title" font oFont1g
    redefine say prompt"List of stuff" ID 0 of oDlg
    define font oFont1  name "TIMES NEW ROMAN" size 0,-12 bold
        oBrw := TXBrowse():New( oDlg )
        oBrw:nMarqueeStyle := MARQSTYLE_HIGHLROW
    oBrw:nColDividerStyle := LINESTYLE_INSET
    oBrw:nRowDividerStyle := LINESTYLE_INSET
    oBrw:lColDividerComplete := .t.
    oBrw:nHeaderHeight := 22
    oBrw:lRecordSelector := .t.
    oBrw:bClrHeader := {|| { nRGB(152, 251, 152), nRGB(47, 79, 79) } }//{|| { nRGB(140, 0, 0), nRGB(229,0,0) } }
    oBrw:bClrFooter := oBrw:bClrHeader
    oBrw:bClrStd := {|| { nRGB( 0, 0, 0), nRGB(255,248,220) } }
    oBrw:bClrSel := {|| { nRGB( 0, 0,255), nRGB(241,222,088) } }
    oBrw:bClrSelFocus := {|| { nRGB( 0, 0, 0), nRGB(248,195, 34) } }
    oBrw:nRowHeight := 19

    oCol = oBrw:AddCol()
    oCol:bStrData = { || (repos->codigo) }
        oCol:nDataStrAlign := 0
    oCol:cHeader = "Código"
    oCol:nWidth = 100
    oCol:oHeaderFont := oFont1
    oCol:bClrHeader := { || {  65535, nRGB(47, 79, 79) } }

    oCol = oBrw:AddCol()
    oCol:bStrData =  { || repos->descrip }
    oCol:nDataStrAlign := 0
        oCol:cHeader = "Descripción"
    oCol:nWidth = 220
    oCol:oHeaderFont := oFont1
    oCol:bClrHeader := { || {  65535, nRGB(47, 79, 79) } }

    oCol = oBrw:AddCol()
    oCol:bStrData = { || transform(repos->solicita,"###,###.##") }
        oCol:nDataStrAlign := 0
    oCol:cHeader = "Solicitados"
    oCol:nWidth = 90
    oCol:bEditValue = { || repos->solicita }
    oCol:cEditPicture := "@Z 999,999.99"
    oCol:nEditType := EDIT_GET
    oCol:bOnPostEdit = { | oCol, xVal, nKey | If( nKey == VK_RETURN, (DBRLOCK(), (repos->solicita := xVal), DBUNLOCK()) ,) }
    oCol:bLClickHeader:= {|| oBrw:Gotop() }
     
    oBrw:SetRDD()
   
    oBrw:CreatefromResource(2)

    redefine button oBtn1 ID 3 of oDlg action msgalert("Boton 1","1")
    redefine button oBtn2 ID 4 of oDlg action msgalert("Boton 2","2")
    REDEFINE Button oBtn3 ID 5 OF oDlg action (ciccc:="N",oDlg:end())
    activate dialog oDlg centered
   enddo
return
 
User avatar
mariordz
 
Posts: 131
Joined: Tue Dec 26, 2006 4:50 pm
Location: Ciudad de México

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: byron.hopp and 31 guests