Page 1 of 1

Browse edit of cell with brush

Posted: Tue Sep 20, 2022 3:54 pm
by AntoninoP
On my program I have a XBrowse with fast edit and brush. My problem is when I edit last visible row and go down to end the edit the scrolling does not update well:
Image
This piece of code reproduces the issue:

Code: Select all | Expand

#include "fivewin.ch"

Function main()
   local oWnd,oBrw
   LOCAL aData := {},n, oBrush
   for n:=1 to 200
      aAdd(aData, {"Product "+hb_ntoc(n),0.0})
   next
   DEFINE WINDOW oWnd
   @ 0, 0 XBROWSE oBrw OF oWnd STYLE 2015 ;
      DATASOURCE aData ;
      COLUMNS 1,2 ;
      HEADERS "Desc","Qta"
   with object oBrw
      :lFastEdit := .T.
   end
   DEFINE BRUSH oBrush COLOR RGB(192,192,192)
   #define CLR_EDITED RGB(240,64,64)
   with object oBrw:aCols[2]
      :nEditType := EDIT_GET
      :cEditPicture := "999999.99"
      :lAutoSave := .T.
      :oBrush := {|| iif(empty(oBrw:aArrayData[oBrw:KeyNo(),2]),oBrush,nil) }
      :bClrStd := {|| ;
         {  iif(empty(oBrw:aArrayData[oBrw:KeyNo(),2]),CLR_BLACK,CLR_EDITED), ;
            CLR_WHITE} ;
      }
   end
   oBrw:CreateFromCode()
   oWnd:oClient := oBrw
   activate Window oWnd
return nil
 


I am using the FW 18.01, maybe is it already fixed on newer versions?

using 18.01 my PC create an executable of 3.686.400 bytes for this sample, how big is with new version? (the size is main reason why we don't update so long)

Regards,

PS: without brush is worse, you see the old value

Re: Browse edit of cell with brush

Posted: Tue Sep 20, 2022 4:38 pm
by karinha
yo haria asi:

Code: Select all | Expand


// C:\FWH..\SAMPLES\ANTONINO.PRG

#Include "Fivewin.ch"

#Define CLR_EDITED RGB(240,64,64)

FUNCTION main()

   LOCAL oWnd, oBrw

   LOCAL aData := {}, n, oBrush

   FOR n := 1 TO 200
      aAdd( aData, { "Product " + hb_ntoc( n ), 0.0 } )
   NEXT

   DEFINE BRUSH oBrush COLOR RGB( 192, 192, 192 )

   DEFINE WINDOW oWnd

   @ 0, 0 XBROWSE oBrw OF oWnd STYLE 2015 DATASOURCE aData ;
      COLUMNS 1, 2 HEADERS "Desc", "Qta"

   WITH object oBrw
      :lFastEdit := .T.
   END

   WITH object oBrw:aCols[2]

      :nEditType := EDIT_GET
      :cEditPicture := "999999.99"
      :lAutoSave := .T.

      :oBrush := {|| iif( empty( oBrw:aArrayData[oBrw:KeyNo(),2] ), oBrush, nil ) }

      :bClrStd := {|| ;
         {  iif( empty( oBrw:aArrayData[oBrw:KeyNo(),2] ), CLR_BLACK, CLR_EDITED ), ;
         CLR_WHITE } ;
         }
   end

   oBrw:CreateFromCode()

   oWnd:oClient := oBrw

   ACTIVATE WINDOW oWnd

RETURN NIL
 


Regards, saludos.

Re: Browse edit of cell with brush

Posted: Wed Sep 21, 2022 6:27 am
by AntoninoP
karinha wrote:yo haria asi:
Regards, saludos.

I don't see changes in your code

Re: Browse edit of cell with brush

Posted: Wed Sep 21, 2022 7:41 am
by AntoninoP
Looks like if I put

Code: Select all | Expand

oBrw:lFullPaint := .T.
resolves the issue

Re: Browse edit of cell with brush

Posted: Wed Sep 21, 2022 11:53 am
by karinha
AntoninoP wrote:Looks like if I put

Code: Select all | Expand

oBrw:lFullPaint := .T.
resolves the issue


Asi?

Code: Select all | Expand


// C:\FWH..\SAMPLES\ANTONINO.PRG

#Include "Fivewin.ch"

#Define CLR_EDITED RGB(240,64,64)

FUNCTION main()

   LOCAL oWnd, oBrw

   LOCAL aData := {}, n, oBrush

   FOR n := 1 TO 200
      aAdd( aData, { "Product " + hb_ntoc( n ), 0.0 } )
   NEXT

   DEFINE BRUSH oBrush COLOR RGB( 192, 192, 192 )

   DEFINE WINDOW oWnd

   @ 0, 0 XBROWSE oBrw OF oWnd STYLE 2015 DATASOURCE aData ;
      COLUMNS 1, 2 HEADERS "Desc", "Qta"

   WITH object oBrw
      :lFastEdit := .T.
   END

   WITH object oBrw:aCols[2]

      :nEditType := EDIT_GET
      :cEditPicture := "999999.99"
      :lAutoSave := .T.

      :oBrush := {|| iif( empty( oBrw:aArrayData[oBrw:KeyNo(),2] ), oBrush, nil ) }

      :bClrStd := {|| ;
         {  iif( empty( oBrw:aArrayData[oBrw:KeyNo(),2] ), CLR_BLACK, CLR_EDITED ), ;
         CLR_WHITE } ;
         }
   end

   oBrw:lFullPaint := .T.

   oBrw:CreateFromCode()

   oWnd:oClient := oBrw

   ACTIVATE WINDOW oWnd

RETURN NIL
 


Gracias, thanks.

Regards, saludos.

Re: Browse edit of cell with brush

Posted: Sun Sep 25, 2022 1:07 pm
by nageswaragunupudi
On my program I have a XBrowse with fast edit and brush. My problem is when I edit last visible row and go down to end the edit the scrolling does not update well:


Here is the real bug. This has nothing to do with colors or brushes.
Bug:
When the user edits a cell in the last row and then exits the Get by pressing Enter key or UpArrowKey, there is no problem at all and everything works correctly as expected.

But if the user exits the Get by pressing Down Arrow key, the changes are written to the array (or other datasource) but the change is not updated in the browse.
What exactly happening is that the browse is scrolled up without repainting the last row.

This bug remains even till today.

We will work on suitable fix and get back.

Till then, please depend on oBrw:lFullPaint := .t., though this slows down the browse painting

Re: Browse edit of cell with brush

Posted: Sun Sep 25, 2022 1:27 pm
by nageswaragunupudi
using 18.01 my PC create an executable of 3.686.400 bytes for this sample, how big is with new version? (the size is main reason why we don't update so long)


4.8 MB

Re: Browse edit of cell with brush

Posted: Sun Sep 25, 2022 1:53 pm
by cnavarro
nageswaragunupudi wrote:
This bug remains even till today.

We will work on suitable fix and get back.

Till then, please depend on oBrw:lFullRefresh := .t., though this slows down the browse painting


Mr. Rao,
oBrw:lFullRefresh := .t. // I do not know this DATA


or

oBrw:lFullPaint := .t.

Thanks

Re: Browse edit of cell with brush

Posted: Sun Sep 25, 2022 5:48 pm
by nageswaragunupudi
Extremely sorry.
lFullPaint is the correct name.
I edited and corrected this mistake
Thanks