Page 1 of 2

xbrowse edit columns

PostPosted: Sun May 13, 2018 9:21 am
by Silvio.Falconi
Can not edit a column of a one row of xbrowse ?

I explain you

I have this xbrowse

Image

I wish edit only for the first row only the columns I draw on green box

it's possible ?

Re: xbrowse edit columns

PostPosted: Sun May 13, 2018 12:34 pm
by nageswaragunupudi
See oCol:nEditType := any value > 0 like EDIT_GET, EDIT_BUTTON, etc for the columns you want to edit.
Retain oCol:nEditType := 0 for other columns.

What else am I missing?

Re: xbrowse edit columns

PostPosted: Sun May 13, 2018 7:21 pm
by Silvio.Falconi
Sorry perhaps I not explain good

Look the picture please

for the first record I wish edit only the columns 8 and 9 ( dates) and this record must not deleted

from second record to all records I wish edit only the column 4 and 5 , 8 and 9 ( and can be deleted)

thanks

Re: xbrowse edit columns

PostPosted: Sun May 13, 2018 9:32 pm
by nageswaragunupudi
For columns 4,5,8 and 9, set nEditType := EDIT_GET or EDIT_BUTTON or etc.
For columns 8 and 9 also add
Code: Select all  Expand view

oCol:bEditWhen := { || oBrw:BookMark == 1 }
 


Deletion has to be handled in the program code.

Re: xbrowse edit columns

PostPosted: Mon May 14, 2018 7:11 am
by Silvio.Falconi
WITH OBJECT oBrw:aCols[ 5]
:AddBmpFile(".\bitmaps\sh_plus.bmp")
:nBtnBmp := 1
:nwidth := 60
:nDataStrAlign := AL_CENTER
:nHeadStrAlign := AL_CENTER
:nEditType := EDIT_BUTTON
:bEditBlock := { ||RES->QUANTITY++ }
:lBtnTransparent := .t.
:bEditWhen := { || oBrw:BookMark == 1 }
END

not run it add the quantity also the record number 1

I think ed something of
:bEditWhen := { ||oBrw:aArrayData:nat<>1 }

where 1 is the first record

If you see the picture I wish the final user can edit only date for the first line of xbrowse
I wish also the final user cannot delete the first line

Re: xbrowse edit columns

PostPosted: Mon May 14, 2018 8:41 am
by Silvio.Falconi
I tried also with

:nEditType := EDIT_BUTTON
:bEditBlock := { |o|Msginfo("") }
:bEditWhen := { || oBrw:nArrayAt<>1 }

I wish when on first line of the browse thefinal user cannot edit the cell

the user can edit only from second line

Re: xbrowse edit columns

PostPosted: Mon May 14, 2018 9:42 am
by nageswaragunupudi
Please try
:bEditWhen := { || oBrw:KeyNo == 1 }

Re: xbrowse edit columns

PostPosted: Mon May 14, 2018 9:59 am
by nageswaragunupudi
This is possible in 18.04:
Image

For Gets also.

Re: xbrowse edit columns

PostPosted: Mon May 14, 2018 10:12 am
by Silvio.Falconi
nageswaragunupudi wrote:This is possible in 18.04:
Image

For Gets also.


GOOD

RAO YOU'RE FANTASTIC

tha value must be on center!

Re: xbrowse edit columns

PostPosted: Mon May 14, 2018 10:15 am
by Silvio.Falconi
Rao

:bEditWhen := { || oBrw:KeyNo == 1 }

I tried also with

:bEditWhen := { || oBrw:KeyNo <>1 }

it continue to process the editblock on first line

Re: xbrowse edit columns

PostPosted: Mon May 14, 2018 12:02 pm
by Silvio.Falconi
Rao if you try this test
Code: Select all  Expand view
#include "fivewin.ch"

function Main()

   local oDlg, oBrw

   USE c:\work\FWH\SAMPLES\CUSTOMER  

   DEFINE DIALOG oDlg SIZE 700,400 PIXEL TRUEPIXEL
   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg DATASOURCE Alias() ;
      AUTOCOLS CELL LINES NOBORDER

   WITH OBJECT oBrw:aCols[ 2 ]
      :nEditType     := EDIT_BUTTON
      :AddResource( "OPEN" )
      :nBtnBmp       := 1
      :bEditBlock    := { || test()}
      :beditwhen    := { || oBrw:keyno <> 1 }
   END
   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED

return nil

Function test()
return "modified"


it modified the record inserting "modified"

I wish no modify the first record How I can resolve ?

beditwhen must make as this function

Function test(oBrw)
IF oBrw:keyno =1
Msginfo(" I cannot mofified")
else
return "modified"
endif

return nil

but it not run ok


Now I correct with

:bEditBlock := { ||IF(oBrw:KeyNo=1,,RES->QUANTITY++) }

but I cannot use bwhenedit codeblock

Re: xbrowse edit columns

PostPosted: Mon May 14, 2018 12:12 pm
by Silvio.Falconi
Now with these lines seem run ok

Code: Select all  Expand view
WITH OBJECT oBrw:aCols[ 4]
            :AddBmpFile(".\bitmaps\sh_minus.bmp")
            :nBtnBmp := 1
            :nwidth    := 40
            :nEditType := EDIT_BUTTON
            :bEditBlock := { ||IF(oBrw:KeyNo=1,,IIF(RES->QUANTITY>1, RES->QUANTITY--,RES->QUANTITY:= 1))  }
            :lBtnTransparent := .t.
            :lBmpStretch := .t.
            :nDataStrAlign := AL_CENTER
            :nHeadStrAlign := AL_CENTER
         END


          WITH OBJECT oBrw:aCols[ 5]
            :AddBmpFile(".\bitmaps\sh_plus.bmp")
            :nBtnBmp := 1
            :nwidth    := 60
            :nDataStrAlign := AL_CENTER
            :nHeadStrAlign := AL_CENTER
            :nEditType := EDIT_BUTTON
            :bEditBlock := { ||IF(oBrw:KeyNo=1,,RES->QUANTITY++)  }
            :lBtnTransparent := .t.
           END



is there a bug on bwhenedit codeblock ?

Re: xbrowse edit columns

PostPosted: Tue May 15, 2018 2:14 am
by nageswaragunupudi
is there a bug on bwhenedit codeblock ?

You are right.
bEditWhen is not preventing button action of EDIT_BUTTON.
This is now fixed in 18.04.

Re: xbrowse edit columns

PostPosted: Tue May 15, 2018 7:23 am
by Silvio.Falconi
thanks

Re: xbrowse edit columns

PostPosted: Sat Sep 15, 2018 2:46 am
by CARLOS ATUNCAR
Saludos estoy necesitando poner un button en el xbrowse que me lleve a una consulta de movimientos del documento seleccionado todo funciona bien le he puesto una imagen al button pero cuando abandono la aplicación se me cuelga comento ese configuracion de la columna y termina normal.


/*
WITH OBJECT aBrw:aCols[ 1 ]
:addbmpfile( op:bmp16+"eye.bmp" )
:nBtnBmp := 1
:nEditType := EDIT_BUTTON
:bEditBlock := {|| VerItems( cCodigo,cQry:tipo,cQry:ord_comp )}
:lBtnTransparent := .t.
:lBmpStretch := .t.
END
*/
he tenido que solucionarlo usando

:aCols[01]:bLDClickData := { || VerItems( cCodigo,cQry:tipo,cQry:ord_comp ) }

version de FWH 1801 hay alguna razon ??