Edit cell on xbrowse

Edit cell on xbrowse

Postby Silvio.Falconi » Mon Oct 28, 2024 6:26 pm

on a xbrowse I use

Image


:nEditTypes := EDIT_GET

the user can insert numbers But I wish the use can insert only number of two digit from 1 to 90

How I can resolve ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: Edit cell on xbrowse

Postby cmsoft » Mon Oct 28, 2024 11:16 pm

Puedes usar bEditValid
Code: Select all  Expand view  RUN

:bEditValid :=  {| oGet | if(oGet:value > 0 .and. oGet:value < 91,.t.,(MsgInfo("Solo 0 a 90"),.f.)) }
User avatar
cmsoft
 
Posts: 1293
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: Edit cell on xbrowse

Postby Silvio.Falconi » Tue Oct 29, 2024 7:13 am

cmsoft wrote:Puedes usar bEditValid
Code: Select all  Expand view  RUN

:bEditValid :=  {| oGet | if(oGet:value > 0 .and. oGet:value < 91,.t.,(MsgInfo("Solo 0 a 90"),.f.)) }




Not Work

Image

I made

@ 80, 10 XBROWSE oBrw SIZE 455,oDlg:nBottom-200 PIXEL OF oDlg ;
DATASOURCE aData AUTOCOLS CELL LINES NOBORDER FASTEDIT

SetupBrowseMatrix(oBrw)
oBrw:RecSelShowKeyNo()
oBrw:CreateFromCode()

static function SetupBrowseMatrix( oBrw )

WITH OBJECT oBrw
// :RecSelShowKeyNo()

AEval( :aCols, { |o,i| o:cHeader := LTrim( Str( i, 2 ) ) } )
:bEditValid := {| oGet | if(oGet:value > 0 .and. oGet:value < 91,.t.,(MsgInfo("Solo 0 a 90"),.f.)) }
:nEditTypes := EDIT_GET
:nWidths := 24
:lDrawBorder := .t.


....


END
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: Edit cell on xbrowse

Postby Silvio.Falconi » Tue Oct 29, 2024 7:18 am

perhaps ...

Code: Select all  Expand view  RUN
For n=1 to  len(oBrw:aCols)
        oBrw:aCols[n]:bEditValid :=  {| oGet | if(oGet:value >= 0 .and. oGet:value < 91,.t.,;
                         (MsgInfo("Solo da 0  a 90"),.f.)) }
      END


But it must erase the edit
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7090
Joined: Thu Oct 18, 2012 7:17 pm

Re: Edit cell on xbrowse

Postby cmsoft » Tue Oct 29, 2024 12:18 pm

bEditValid es un metodo de la clase TXBrwColumn no de la clase TXBrowse
Debes ponerlo a cada columna que desees
User avatar
cmsoft
 
Posts: 1293
Joined: Wed Nov 16, 2005 9:14 pm
Location: Mercedes - Bs As. Argentina

Re: Edit cell on xbrowse

Postby nageswaragunupudi » Tue Oct 29, 2024 9:37 pm

But it must erase the edit


Please try this alternative

Code: Select all  Expand view  RUN
#include "fivewin.ch"

function Main()

   local aData := Array( 10, 10 )

   AEval( aData, { |aRow| AFill( aRow, 0 ) } )

   XBROWSER aData FASTEDIT SHOW RECID SETUP ( ;
      oBrw:bEditValues := { |x,o| If( x == nil, o:oBrw:aRow[ o:nCreationOrder ], ;
         If( x >= 0 .and. x < 91, o:oBrw:aRow[ o:nCreationOrder ] := x, nil ) ) }, ;
      oBrw:cEditPictures := "@Z 99" ;
      )

return nil
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10690
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 85 guests