Alaska Software Inc. - Put the cell of one XbpBrowse in edit mode.
Username: Password:
AuthorTopic: Put the cell of one XbpBrowse in edit mode.
César Calvo Put the cell of one XbpBrowse in edit mode.
on Fri, 21 Mar 2014 22:05:12 +0100
Hi friends.
How can I get for see the cell selected in edit mode and if I push ESC it 
returns to normal mode?
Regards.
César.

METHOD CCC_BROWSE CLASS PRUEBAS
LOCAL oBro, oXbp := NIL, mp1  := NIL, mp2  := NIL, oCol, I, cField
LOCAL nWidth, oGroup, cFIL, cCon1, oCon1, cSEL1, oCur1, nCols, bCol
LOCAL aPresParam, bPRU

cFIL := CurDrive() + ":\" +Curdir() + '\' + 'PRUEBA.xlsx'

IF FExists(cFIL)

   cCon1 := "DBQ=" + cFIL
   cCon1 += ";DRIVER={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, 
*.xlsb)}"
   cCon1 += ";ReadOnly=0;MaxScanRows=0;FirstRowHasNames=1"

   oCon1 := SQLConnection():new()

   oCon1:driverConnect(nil, cCon1)

   cSEL1 := 'SELECT * FROM [Hoja1$] ORDER BY EJE,DOC'

   oCur1 := oCon1:Cursor(cSEL1)
   oCur1:execute()

   ::datalink := oCur1

   oBro := XbpBrowse():New( ::oST0 )

   oBro:skipBlock     := {|n| ::datalink:Skipper(n)}
   oBro:GoBottomBlock := {|| ::datalink:GoBottm() }
   oBro:GoTopBlock    := {|| ::datalink:GoTop() }
   oBro:phyPosBlock   := {|n|iif(ValType(n)!="N", ::datalink:RecNo(), 
::datalink:GoTo(n))}

   oBro:posBlock      := {|| ::datalink:RecNo()}
   oBro:goPosBlock    := {|n| ::datalink:GoTo(n)}
   oBro:lastPosBlock  := {|| ::datalink:RecCount()}
   oBro:firstPosBlock := {|| 1}

   oBro:CursorMode    := XBPBRW_CURSOR_ROW
   oBro:UseVisualStyle := .F.
   oBro:Create( ,,,,, .F. )

   nCols := ::datalink:FCount()

   FOR I := 1 to nCols

      oBro:addColumn( ::SQLField(I),,::datalink:FieldName(I))

   NEXT

   oBro:HScrollObject:UseVisualStyle  := .T.
   oBro:VScrollObject:UseVisualStyle  := .T.

   oBro:Show()
   SetAppFocus( oBro )

   ::nEvent := xbeP_None

   DO WHILE ::nEvent != xbeP_Close
      ::nEvent := AppEvent( @mp1, @mp2, @oXbp )
      oXbp:HandleEvent( ::nEvent, mp1, mp2 )
   ENDDO

   ELSE

   Infobox("No existe el fichero " + cFIL)

ENDIF

RETURN self

//-------------------------------------------------------------------------------------------
METHOD SQLField( nField ) CLASS PRUEBAS
   Return {|x| iif(PCount()==0, ::datalink:fieldGet(nField), 
::datalink:fieldPut(nField, x))}

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