FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour In xbrowse valid is Executed twice
Posts: 181
Joined: Thu Apr 17, 2008 02:38 PM
In xbrowse valid is Executed twice
Posted: Fri Jun 01, 2018 12:02 PM
hi all,
when I exit from the get in XBROWSE with the TAB key
the valid is done 2 times while if I go out with enter is performed only once.
I attach an example to reproduce the problem.
My version of FWH is 17.01.
Is this anomaly already resolved?

Thank you


Code (fw): Select all Collapse
// managing arrays with XBrowse

#INCLUDE "FiveWin.ch"

FUNCTION Main()

   LOCAL oDlg
   LOCAl oCol
   LOCAL oBrw
   LOCAL aSample :=  {}  
   LOCAL cIniFile := GetWinDir()+"\FiveWin.ini"

   SET _3DLOOK ON

   aadd(aSample, {"Init 01", "Init 02"})
   
   DEFINE DIALOG oDlg FROM 2, 2 TO 30, 100 ;
      TITLE "FiveWin TWBrowse Power!!!"

   @ 1, 2 XBROWSE oBrw OF oDlg ;
      SIZE 180, 180 ARRAY aSample ;
      FASTEDIT

   ADD COLUMN oCol TO oBrw ARRAY ELEM 1 SIZE 150 EDITABLE VALID { | oGet | Controlli("01", oGet:VarGet()) }
   ADD COLUMN oCol TO oBrw ARRAY ELEM 2 SIZE 150 EDITABLE VALID { | oGet | Controlli("02", oGet:VarGet()) }
   oBrw:createfromcode()

   @ 1, 55 BUTTON "E&xit" OF oDlg ;
      ACTION oDlg:End() CANCEL

   @ 3, 55 BUTTON "&Add " OF oDlg      ;
      ACTION ( AAdd( aSample, { time() + "[01]", dtoc(date()) + "[02]" } ), ;
               oBrw:GoBottom(),;
               oBrw:SetFocus(),;
               oBrw:Refresh() )

   @ 5, 55 BUTTON "&Del " OF oDlg                               ;
      ACTION iif( len( aSample ) > 0                          , ;
         (asize( aSample, len( aSample ) - 1 ), oBrw:Refresh()),)

   ACTIVATE DIALOG oDlg                                         ;
      CENTERED

RETURN( NIL )

FUNCTION Controlli ( cCol , cVal )
   if empty(cVal)
      MsgStop("Error")
      return(.F.)
   ENDIF
return (.T.)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: In xbrowse valid is Executed twice
Posted: Wed Jun 06, 2018 01:49 PM

When TAB is pressed, if bEditValid returns .T., it is executed only once, but if it returns .f., it is executed twice.
This issue is still present.
We are looking into this.

Incidentally, we should not have any screen I/O inside bEditValid.

Regards



G. N. Rao.

Hyderabad, India
Posts: 85
Joined: Mon Apr 18, 2011 02:32 AM
Re: In xbrowse valid is Executed twice
Posted: Thu Jun 13, 2019 07:58 AM

Mr. Nages,

How to controll bEditValid if we Paste a Data on xbrowse..?

Thanks.

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: In xbrowse valid is Executed twice
Posted: Thu Jun 13, 2019 08:17 AM

I am unable to understand your question properly. Can you explain in greater detail?

Regards



G. N. Rao.

Hyderabad, India
Posts: 85
Joined: Mon Apr 18, 2011 02:32 AM
Re: In xbrowse valid is Executed twice
Posted: Fri Jun 14, 2019 01:01 AM

oh i'm sory,

table: items

kode | nama barang

0001 | Item A <- paste data from excel or another source
0001 | <- paste again

with features lCanPaste: = .T.
and bEditValid

suppose the item code column is unique, we can paste the same code data in each row.

Then how can we control the data validation of line 2 or the next (from the last paste) so that the same data cannot enter because it has been registered in xbrowse using bEditValid ...?

Thanks

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: In xbrowse valid is Executed twice
Posted: Fri Jun 14, 2019 03:03 AM
Paste operation ignores both bEditWhen and bEditValid. Paste operation works on multiple cells and multiple rows. bEditValid is programmed to work with a Get and there is no Get in paste operation. Also despite our advices that bEditValid should not contain any screen i/o, but should limit to return .t. or .f. most programmers code it more elaborately and call to such bEditValid does not suit the multiple cell/row paste operation.

However, we will still consider if and how can we implement this.

If you want to enable the user to paste and validate with bEditValid for a single cell, you can do it by

1) Retain oBrw:lCanPaste := .f. // keep it unchanged
2) User can enter Get by pressing Enter or a key on the cell. Once he is in Get, he can paste text into the Get and this is validated by bEditValid.
Regards



G. N. Rao.

Hyderabad, India
Posts: 85
Joined: Mon Apr 18, 2011 02:32 AM
Re: In xbrowse valid is Executed twice
Posted: Fri Jun 14, 2019 06:10 AM

OK, I understand about the limits of pasting operations in xbrowse mode.

Thanks, Regards.

Continue the discussion