FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour XBrows Column's Cell does not capture Edit Value
Posts: 336
Joined: Mon Dec 07, 2009 02:49 PM
XBrows Column's Cell does not capture Edit Value
Posted: Thu Dec 27, 2018 09:17 AM
Dear Rao Sir ,

The Xbrowse objects has 5 columns from the array , when user enters value in the 3 Column/Cell It does NOT capture/display values in the Cell when oTBrow:SelectCol(5) method used in the bKeyDown Code Block.
But when oTBrow:SelectCol(5) Method is removed from the code block , the Edit Values are capturing but can not move the control to the 5th column.
Is this correct behaviour of the XBROWSE ? if it is correct then how we should skip 4th column and jump to 5th column ?
Please guide for the same. Thanks in advance...!

Given Below Code:
Code (fw): Select all Collapse
function TestBrw
local oTBrow
local oDlg
local aTxnVou := {{"D" ,"Abc A/c ", 0 , 0 , Space(100) }}


DEFINE DIALOG oDlg FROM 0 , 0 TO 500 ,1050 PIXEL TRUEPIXEL STYLE nOr( DS_MODALFRAME , WS_POPUP )


   @120, 020 XBROWSE oTBrow SIZE 1020, 350 PIXEL OF oDlg ;
      DATASOURCE aTxnVou ;
      COLUMNS {1, 2, 3, 4, 5 };
      HEADERS {"D/C", "Account", "Debit",  "Credit",  "Narration" };
      PICTURES {"!",    NIL,  "@Z 99,99,999.99",   "@Z 99,99,999.99",NIL } ;
      COLSIZES { 40, 350, 140, 140, 200 } ;
      CELL LINES NOBORDER FASTEDIT FOOTERS


    // Debit column
    WITH OBJECT oTBrow:aCols[ 3 ]
      :nEditType     := EDIT_GET
      :bKeyDown := < | nKey |
                      IF ( nKey == VK_RETURN )

                        // to Jump to the Narration Column
                        oTBrow:SelectCol(5)

                      ENDIF
                  >

    END

   WITH OBJECT oTBrow
      :lEnterKey2Edit := .F.
      :CreateFromCode()
   END



ACTIVATE WINDOW  oDlg

return nil
Thanks

Shridhar

FWH 24.04, BCC 7 32 bit, MariaDB
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: XBrows Column's Cell does not capture Edit Value
Posted: Thu Dec 27, 2018 12:54 PM
May this will help you for a part

Code (fw): Select all Collapse
// Jump to the xBrowse Column and Row 
IF nAt < 25 // Group1
oBrw2:nColSel := 1  
oBrw2:nArrayAt := nAt
ENDIF
IF nAt > 24 .and. nAt < 48 // Group2
oBrw2:nColSel := 3
oBrw2:nArrayAt := nAt - 24
ENDIF
IF nAt > 47 // Group3
oBrw2:nColSel := 5
oBrw2:nArrayAt := nAt - 47
ENDIF
oBrw2:Refresh()


Code (fw): Select all Collapse
 oBrw:bChange  := {|nRow,nCol| if(oBrw:nColSel>=3, (oBrw:nColSel:=2,oBrw:Refresh()) ,) }
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrows Column's Cell does not capture Edit Value
Posted: Thu Dec 27, 2018 02:35 PM
Shridhar
Try this program
Code (fw): Select all Collapse
#include "fivewin.ch"

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

function Main()

   FWNumFormat( "I", .t. )

   TestBrw1()

return nil

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

function TestBrw1

   local oBrw
   local oDlg
   local aNewRow  := { "D", "Abc A/c ", 0.00 , 0.00 , Space(100) }
   local aTxnVou  := { AClone( aNewRow ) }

   DEFINE DIALOG oDlg FROM 0 , 0 TO 500 ,1050 PIXEL TRUEPIXEL STYLE nOr( DS_MODALFRAME , WS_POPUP )

   @120, 020 XBROWSE oBrw SIZE 1020, 350 PIXEL OF oDlg ;
      DATASOURCE aTxnVou ;
      COLUMNS 1, 2, 3, 4, 5;
      HEADERS "D/C", "Account", "Debit",  "Credit",  "Narration";
      PICTURES "!" ;
      COLSIZES 40, 350, 140, 140, 200 ;
      CELL LINES NOBORDER FASTEDIT FOOTERS

   WITH OBJECT oBrw
      :nEditTypes       := EDIT_GET
      :lEnterKey2Edit   := .F.
      :lDisplayZeros    := .f.

      WITH OBJECT :aCols[ 1 ]
         :cEditKeys     := "CDcd"
         :bKeyChar      := { |k| If( Chr(k) $ "CDcd", ;
                              ( oBrw:aCols[ 1 ]:VarPut( Upper( Chr( k ) ) ), oBrw:GoRight(), 0 ), ;
                              nil ) }
         :bEditValid    := { |oGet| oGet:VarGet() $ "CD" }
         :bOnChange     := < |oCol|
               if oCol:Value == "C"
                  oBrw:Credit:VarPut( oBrw:Debit:Value )
                  oBrw:Debit:VarPut( 0.00 )
               else
                  oBrw:Debit:VarPut( oBrw:Credit:Value )
                  oBrw:Credit:VarPut( 0.00 )
               endif
               return nil
               >
      END
      WITH OBJECT :Account
         :nEditType     := EDIT_LISTBOX
         :aEditListTxt  := { "ABC", "BCD", "CDE" }
         :cFooter       := "TOTALS"
      END
      WITH OBJECT :Debit
         :bEditWhen     := { || oBrw:aRow[ 1 ] == "D" }
         :bEditValid    := { |oGet| oGet:VarGet() > 0.00 }
         :nFooterType   := AGGR_SUM
      END
      WITH OBJECT :Credit
         :bEditWhen     := { || oBrw:aRow[ 1 ] == "C" }
         :bEditValid    := { |oGet| oGet:VarGet() > 0.00 }
         :nFooterType   := AGGR_SUM
      END

      WITH OBJECT :Narration
         :bKeyChar      := { |k| If( k == VK_RETURN, ( oBrw:GoDown(), 0 ), nil ) }
      END

      :bPastEof         := <||
         if !( Empty( oBrw:aRow[ 3 ] ) .and. Empty( oBrw:aRow[ 4 ] ) )
            AAdd( oBrw:aArrayData, AClone( aNewRow ) )
            oBrw:GoDown()
            oBrw:GoLeftMost()
         endif
         return nil
         >

      :bKeyDown         := { |k| If( k == VK_DELETE .and. oBrw:nLen > 1, ( oBrw:Delete(), 0 ), nil ) }
      :bClrStd          := { || { CLR_BLACK, If( Empty( oBrw:aRow[ 3 ] + oBrw:aRow[ 4 ] ), 0xb0f3ff, ;
                                  If( oBrw:aRow[ 4 ] > 0.00, 0xe0e0ff,CLR_WHITE ) ) } }

      :MakeTotals()

      :CreateFromCode()
   END

   ACTIVATE DIALOG oDlg CENTERED

return nil

//----------------------------------------------------------------------------//
Regards



G. N. Rao.

Hyderabad, India
Posts: 336
Joined: Mon Dec 07, 2009 02:49 PM
Re: XBrows Column's Cell does not capture Edit Value
Posted: Fri Dec 28, 2018 05:06 AM

Dear Sir ,

 Thanks a lot ...! You have almost done it. Everything working fine.

 Just one question on the navigation of the 5th Column that when user does not enter value and just press enter, IS IT POSSIBLE TO ADD/MOVE NEXT RECORD OF THE XBROWSE  ?

 I have tried by using bKeyDown but it is NOT working.

Thanks
Shridhar

Thanks

Shridhar

FWH 24.04, BCC 7 32 bit, MariaDB
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrows Column's Cell does not capture Edit Value
Posted: Fri Dec 28, 2018 08:44 AM

I modified the above program. Please test the revised program.

Also, please note that pressing down arrow when on the last row adds a new row, if the last row is valid.

Regards



G. N. Rao.

Hyderabad, India
Posts: 336
Joined: Mon Dec 07, 2009 02:49 PM
Re: XBrows Column's Cell does not capture Edit Value
Posted: Wed Jan 02, 2019 04:08 AM

Dear Rao Sir ,

Thanks a lot..! Yes , its working as expected...!

Thanks
Shridhar

Thanks

Shridhar

FWH 24.04, BCC 7 32 bit, MariaDB

Continue the discussion