In xbrowse valid is Executed twice

In xbrowse valid is Executed twice

Postby mauri.menabue » 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: Select all  Expand view

// 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.)
User avatar
mauri.menabue
 
Posts: 155
Joined: Thu Apr 17, 2008 2:38 pm

Re: In xbrowse valid is Executed twice

Postby nageswaragunupudi » Wed Jun 06, 2018 1: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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: In xbrowse valid is Executed twice

Postby Mulyadi » Thu Jun 13, 2019 7:58 am

Mr. Nages,

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

Thanks.
User avatar
Mulyadi
 
Posts: 82
Joined: Mon Apr 18, 2011 2:32 am

Re: In xbrowse valid is Executed twice

Postby nageswaragunupudi » Thu Jun 13, 2019 8:17 am

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

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

Re: In xbrowse valid is Executed twice

Postby Mulyadi » Fri Jun 14, 2019 1: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
User avatar
Mulyadi
 
Posts: 82
Joined: Mon Apr 18, 2011 2:32 am

Re: In xbrowse valid is Executed twice

Postby nageswaragunupudi » Fri Jun 14, 2019 3: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
User avatar
nageswaragunupudi
 
Posts: 10620
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: In xbrowse valid is Executed twice

Postby Mulyadi » Fri Jun 14, 2019 6:10 am

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

Thanks, Regards.
User avatar
Mulyadi
 
Posts: 82
Joined: Mon Apr 18, 2011 2:32 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 51 guests