Page 1 of 1

Problem to assign value on Xbrowse

Posted: Sun Jun 09, 2019 4:19 pm
by Silvio.Falconi
I have this row
Image

if Press "-" the value become 0 I wish the value is 1 if the value is 0
this the code

Code: Select all

 WITH OBJECT oBrowse:aCols[ 3]
          :nWidth        := 100
          :nDataStrAlign := AL_CENTER
          :AddBitmap( { FW_BmpPlus(), FW_BmpMinus() } )

          // Right Button
         :nEditType     := EDIT_BUTTON
         :bEditBlock    := { |r,c,oCol| oCol:Value + 1 }
         :nBtnBmp       := 1
         :lBtnTransparent  := .t.

         // Left Button
         :bBmpData      := { |v,lSel| If( lSel, 2, 0 ) }
         :bBmpAction    := { |oCol| IIF( oCol:Value>0,oCol:VarPut( oCol:Value - 1 ),) }

                 :bOnChange := bCalcRow

        END

I allready tried with
:bBmpAction := { |oCol| IIF( oCol:Value>0,oCol:VarPut( oCol:Value - 1 ),oCol:VarPut(1)) }

or
:bBmpAction := { |oCol| IIF( oCol:Value>0,oCol:VarPut( oCol:Value - 1 ),oCol:VarPut(oCol:Value:= 1)) }
or
:bBmpAction := { |oCol| IIF( oCol:Value>0,oCol:VarPut( oCol:Value - 1 ),1) }

with no success!!!

the value cannot be zero

any solution please ?

Re: Problem to assign value on Xbrowse

Posted: Sun Jun 09, 2019 5:03 pm
by nageswaragunupudi

Code: Select all

:bBmpAction := { |oCol| oCol:VarPut( Max( 1, oCol:Value - 1 ) ) }
 

Re: Problem to assign value on Xbrowse

Posted: Sun Jun 09, 2019 9:07 pm
by Silvio.Falconi
thanks rao...

how adjust the btnbmp " + " do you see the white background ?

it seem more small than the other button "-"