modificar tbrowse
Publicado por Roberto (3 intervenciones) el 28/08/2007 22:31:31
Buenas, haces unos días Pepe me dio un chispazo de como modificar una tabla pero la intencion es que las modificaciones se realicen en el mismo tbrowse, como cuando modificas en el browse de dbase de Clipper. Baje una funcion que funciona pero cuando le doy enter y modifico, no guarda los cambios, más bien los regresa como estaba.
Me gustaria si pueden modificar la funcion de tal manera me guarde los cambios o darme una idea de lo que tengo que hacer pues no soy bueno en esto
Gracias.
FUNCTION DoGet( oBrowse, cGetClr, cPicture, bReader )
LOCAL nCursSave, xOldKey, xNewKey
LOCAL oColumn, oGet, nKey
nCursSave := SETCURSOR(SC_NORMAL)
ForceStable(oBrowse)
oColumn := oBrowse:getColumn(oBrowse:colPos)
// create a corresponding GET and READ it
oGet := GETNEW(ROW(), COL(), oColumn:block,oColumn:heading, cPicture, cGetClr )
oGet:reader := bReader
xOldKey := IF(EMPTY(INDEXKEY()), NIL, &(INDEXKEY()))
READMODAL({oGet})
SETCURSOR(nCursSave)
xNewKey := IF(EMPTY(INDEXKEY()), NIL, &(INDEXKEY()))
IF xOldKey != xNewKey
oBrowse:refreshAll()
ForceStable(oBrowse)
WHILE &(INDEXKEY()) > xNewKey .AND. !oBrowse:hitTop()
oBrowse:up()
ForceStable(oBrowse)
ENDdo
else
oBrowse:refreshCurrent()
forceStable(oBrowse)
ENDIF
nKey := LASTKEY()
IF ( nKey == K_UP .OR. nKey == K_DOWN .OR. ;
nKey == K_PGUP .OR. nKey == K_PGDN )
KEYBOARD CHR(nKey)
ENDIF
RETURN (UPDATED())
([email protected])
Me gustaria si pueden modificar la funcion de tal manera me guarde los cambios o darme una idea de lo que tengo que hacer pues no soy bueno en esto
Gracias.
FUNCTION DoGet( oBrowse, cGetClr, cPicture, bReader )
LOCAL nCursSave, xOldKey, xNewKey
LOCAL oColumn, oGet, nKey
nCursSave := SETCURSOR(SC_NORMAL)
ForceStable(oBrowse)
oColumn := oBrowse:getColumn(oBrowse:colPos)
// create a corresponding GET and READ it
oGet := GETNEW(ROW(), COL(), oColumn:block,oColumn:heading, cPicture, cGetClr )
oGet:reader := bReader
xOldKey := IF(EMPTY(INDEXKEY()), NIL, &(INDEXKEY()))
READMODAL({oGet})
SETCURSOR(nCursSave)
xNewKey := IF(EMPTY(INDEXKEY()), NIL, &(INDEXKEY()))
IF xOldKey != xNewKey
oBrowse:refreshAll()
ForceStable(oBrowse)
WHILE &(INDEXKEY()) > xNewKey .AND. !oBrowse:hitTop()
oBrowse:up()
ForceStable(oBrowse)
ENDdo
else
oBrowse:refreshCurrent()
forceStable(oBrowse)
ENDIF
nKey := LASTKEY()
IF ( nKey == K_UP .OR. nKey == K_DOWN .OR. ;
nKey == K_PGUP .OR. nKey == K_PGDN )
KEYBOARD CHR(nKey)
ENDIF
RETURN (UPDATED())
([email protected])
Valora esta pregunta


0