XBrows Column's Cell does not capture Edit Value

XBrows Column's Cell does not capture Edit Value

Postby shri_fwh » Thu Dec 27, 2018 9: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: Select all  Expand view  RUN


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 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: XBrows Column's Cell does not capture Edit Value

Postby Marc Venken » Thu Dec 27, 2018 12:54 pm

May this will help you for a part

Code: Select all  Expand view  RUN
// 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: Select all  Expand view  RUN
oBrw:bChange  := {|nRow,nCol| if(oBrw:nColSel>=3, (oBrw:nColSel:=2,oBrw:Refresh()) ,) }
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1447
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: XBrows Column's Cell does not capture Edit Value

Postby nageswaragunupudi » Thu Dec 27, 2018 2:35 pm

Shridhar
Try this program
Code: Select all  Expand view  RUN
#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
User avatar
nageswaragunupudi
 
Posts: 10662
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBrows Column's Cell does not capture Edit Value

Postby shri_fwh » Fri Dec 28, 2018 5: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 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm

Re: XBrows Column's Cell does not capture Edit Value

Postby nageswaragunupudi » Fri Dec 28, 2018 8: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
User avatar
nageswaragunupudi
 
Posts: 10662
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBrows Column's Cell does not capture Edit Value

Postby shri_fwh » Wed Jan 02, 2019 4:08 am

Dear Rao Sir ,

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


Thanks
Shridhar
Thanks
Shridhar
FWH 19.12, BCC 7 32 bit, MariaDB
shri_fwh
 
Posts: 301
Joined: Mon Dec 07, 2009 2:49 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 73 guests