Alaska Software Inc. - Edit data directly in TBrowse.
Username: Password:
AuthorTopic: Edit data directly in TBrowse.
César Calvo Edit data directly in TBrowse.
on Wed, 08 Oct 2014 19:57:41 +0200
Hi.
I want to edit data in one TBrowse without other window pushing enter, 
directly inside de TBrowse.
Can you say me how?
Regards,
César.

//----------------------------------------------------------------------------------------------//

SetMouse(.T.)
SetCursor(SC_INSERT)
ReadInsert(.T.)


DispBox(0,0,45,179,2,"W+/B")

oBtn := XbpPushButton():new(,, {25, 5}, {80, 30} )
oBtn:caption := "Uno"
oBtn:activate := {|| PostAppEvent( xbeK_ESC ) }
oBtn:create()
oBtn:show()

USE ("Cust.dbf") SHARED NEW

oTB := TBrowseDb( nT+1, nL+1, nB-1, nR-1 )

oTB:goTopBlock    := {|| DbGoTop() }
oTB:goBottomBlock := {|| DbGoBottom() }
oTB:skipBlock     := {|nSkip| DbSkipper(nSkip) }
oTb:colSep  := "|"
oTb:headSep := "="

iCnt := fcount()

FOR i:=1 TO iCnt
   cField := FieldName( i )
   oTB:AddColumn( TBColumnNew( cField, FieldBlock(cField) ) )
NEXT

DO WHILE .T.
   DO WHILE !oTb:stabilize()
   ENDDO

   lEdit := .T.

   nEvent := AppEvent( @mp1, @mp2, @oXbp, 0 )

   If oXbp == SetAppWindow()

      If nEvent == xbeK_RETURN
         lEdit := .T.

         Elseif nEvent == xbeK_ESC
            EXIT

         Elseif nEvent == xbeK_INS
            lEdit := .T.

         Else

         TBHandleEvent( oTB, nEvent, mp1, mp2, oXbp )

      ENDIF

      ELSE

      oXbp:handleEvent( nEvent, mp1, mp2 )

   ENDIF


ENDDO

DbCloseArea()

//----------------------------------------------------------------------------------------------//
Till WarwegRe: Edit data directly in TBrowse.
on Thu, 09 Oct 2014 10:56:13 +0200
Dear César,

Please have a look at the documentation of the DbEdit() function; it 
contains
an example for an editable (T) browse. In this example, the RETURN key is
handled via a user function which creates a @GET for editing.

I think the example does exactly what you're looking for.

Best regards,
  Till Warweg
-------------------------------------------------------------------- 

Technical Support: support@alaska-software.com

News Server: news.alaska-software.com
Homepage: http://www.alaska-software.com
WebKnowledgeBase: http://www.alaska-software.com/kbase.shtm

Fax European Office: +49 (0) 61 96 - 77 99 99 23
Fax US Office: +1 (646) 218 1281
-------------------------------------------------------------------- 
"César Calvo"  wrote in message 
news:2e62822b$5fa203e6$11fd2@news.alaska-software.com...

Hi.
I want to edit data in one TBrowse without other window pushing enter,
directly inside de TBrowse.
Can you say me how?
Regards,
César.

//----------------------------------------------------------------------------------------------//

SetMouse(.T.)
SetCursor(SC_INSERT)
ReadInsert(.T.)


DispBox(0,0,45,179,2,"W+/B")

oBtn := XbpPushButton():new(,, {25, 5}, {80, 30} )
oBtn:caption := "Uno"
oBtn:activate := {|| PostAppEvent( xbeK_ESC ) }
oBtn:create()
oBtn:show()

USE ("Cust.dbf") SHARED NEW

oTB := TBrowseDb( nT+1, nL+1, nB-1, nR-1 )

oTB:goTopBlock    := {|| DbGoTop() }
oTB:goBottomBlock := {|| DbGoBottom() }
oTB:skipBlock     := {|nSkip| DbSkipper(nSkip) }
oTb:colSep  := "|"
oTb:headSep := "="

iCnt := fcount()

FOR i:=1 TO iCnt
   cField := FieldName( i )
   oTB:AddColumn( TBColumnNew( cField, FieldBlock(cField) ) )
NEXT

DO WHILE .T.
   DO WHILE !oTb:stabilize()
   ENDDO

   lEdit := .T.

   nEvent := AppEvent( @mp1, @mp2, @oXbp, 0 )

   If oXbp == SetAppWindow()

      If nEvent == xbeK_RETURN
         lEdit := .T.

         Elseif nEvent == xbeK_ESC
            EXIT

         Elseif nEvent == xbeK_INS
            lEdit := .T.

         Else

         TBHandleEvent( oTB, nEvent, mp1, mp2, oXbp )

      ENDIF

      ELSE

      oXbp:handleEvent( nEvent, mp1, mp2 )

   ENDIF


ENDDO

DbCloseArea()

//----------------------------------------------------------------------------------------------//
César Calvo Re: Edit data directly in TBrowse.
on Thu, 09 Oct 2014 11:49:36 +0200
Hi Till, yes, it is I need.
Still I have not see all documentation.
Thanks.
César.

"Till Warweg" escribió en el mensaje de 
noticias:17ee6971$767b8d03$13c3f@news.alaska-software.com...

Dear César,

Please have a look at the documentation of the DbEdit() function; it
contains
an example for an editable (T) browse. In this example, the RETURN key is
handled via a user function which creates a @GET for editing.

I think the example does exactly what you're looking for.

Best regards,
  Till Warweg
-------------------------------------------------------------------- 

Technical Support: support@alaska-software.com

News Server: news.alaska-software.com
Homepage: http://www.alaska-software.com
WebKnowledgeBase: http://www.alaska-software.com/kbase.shtm

Fax European Office: +49 (0) 61 96 - 77 99 99 23
Fax US Office: +1 (646) 218 1281
-------------------------------------------------------------------- 
"César Calvo"  wrote in message
news:2e62822b$5fa203e6$11fd2@news.alaska-software.com...

Hi.
I want to edit data in one TBrowse without other window pushing enter,
directly inside de TBrowse.
Can you say me how?
Regards,
César.

//----------------------------------------------------------------------------------------------//

SetMouse(.T.)
SetCursor(SC_INSERT)
ReadInsert(.T.)


DispBox(0,0,45,179,2,"W+/B")

oBtn := XbpPushButton():new(,, {25, 5}, {80, 30} )
oBtn:caption := "Uno"
oBtn:activate := {|| PostAppEvent( xbeK_ESC ) }
oBtn:create()
oBtn:show()

USE ("Cust.dbf") SHARED NEW

oTB := TBrowseDb( nT+1, nL+1, nB-1, nR-1 )

oTB:goTopBlock    := {|| DbGoTop() }
oTB:goBottomBlock := {|| DbGoBottom() }
oTB:skipBlock     := {|nSkip| DbSkipper(nSkip) }
oTb:colSep  := "|"
oTb:headSep := "="

iCnt := fcount()

FOR i:=1 TO iCnt
   cField := FieldName( i )
   oTB:AddColumn( TBColumnNew( cField, FieldBlock(cField) ) )
NEXT

DO WHILE .T.
   DO WHILE !oTb:stabilize()
   ENDDO

   lEdit := .T.

   nEvent := AppEvent( @mp1, @mp2, @oXbp, 0 )

   If oXbp == SetAppWindow()

      If nEvent == xbeK_RETURN
         lEdit := .T.

         Elseif nEvent == xbeK_ESC
            EXIT

         Elseif nEvent == xbeK_INS
            lEdit := .T.

         Else

         TBHandleEvent( oTB, nEvent, mp1, mp2, oXbp )

      ENDIF

      ELSE

      oXbp:handleEvent( nEvent, mp1, mp2 )

   ENDIF


ENDDO

DbCloseArea()

//----------------------------------------------------------------------------------------------//