FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Edit cell on xbrowse
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Edit cell on xbrowse

Posted: Mon Oct 28, 2024 06:26 PM
on a xbrowse I use




: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 March-April 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
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM

Re: Edit cell on xbrowse

Posted: Mon Oct 28, 2024 11:16 PM
Puedes usar bEditValid
Code (fw): Select all Collapse
:bEditValid :=  {| oGet | if(oGet:value > 0 .and. oGet:value < 91,.t.,(MsgInfo("Solo 0 a 90"),.f.)) }
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: Edit cell on xbrowse

Posted: Tue Oct 29, 2024 07:13 AM
cmsoft wrote:Puedes usar bEditValid
Code (fw): Select all Collapse
:bEditValid :=  {| oGet | if(oGet:value > 0 .and. oGet:value < 91,.t.,(MsgInfo("Solo 0 a 90"),.f.)) }


Not Work



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 March-April 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
Posts: 7318
Joined: Thu Oct 18, 2012 07:17 PM

Re: Edit cell on xbrowse

Posted: Tue Oct 29, 2024 07:18 AM
perhaps ...
Code (fw): Select all Collapse
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 March-April 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
Posts: 1344
Joined: Wed Nov 16, 2005 09:14 PM

Re: Edit cell on xbrowse

Posted: 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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Edit cell on xbrowse

Posted: Tue Oct 29, 2024 09:37 PM
But it must erase the edit
Please try this alternative
Code (fw): Select all Collapse
#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

Continue the discussion