FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour XBrowse bEditValid strange behavior (SOLVED)
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
XBrowse bEditValid strange behavior (SOLVED)
Posted: Wed Jun 19, 2013 02:42 PM
Hello to all,

I have a xBrowse to edit an array, its definition is as follows:

Code (fw): Select all Collapse
   REDEFINE XBROWSE oBrw ID 1001 OF oDlg ARRAY aNuevos CELL FASTEDIT;
             HEADER {"ORIGEN","DESTINO"} COLUMNS {1,2} PICTURE "@!","@!" SIZES 205,205

   oBrw:aCols[ 1 ]:lAutoSave  := .F.
   oBrw:aCols[ 2 ]:lAutoSave  := .T.
   oBrw:aCols[ 2 ]:nEditType  := EDIT_GET
   oBrw:aCols[ 2 ]:bEditValid := {|oGet| check_stock( oGet:cText) }


the validation function is:

Code (fw): Select all Collapse
//------------------------------------------------------------------------------
FUNCTION check_Stock( codigo )
//-------------------------- ----------------------------------------------------
   LOCAL ret := .F.

   nn++

   ? Codigo,  nn
   
    xBrowse( aStock )

   RETURN .T.


It is very strange, if you can see I'm printing nn (a global variable for test) after increasing it, the issue is that the xBrowse (Astock) is not displayed until [b]? Code, nn [/ b] is printed twice, with value 1, 2 respectively for [b] nn [/ b], only thereafter xBrowse appears also twice. No matter if function return T. o. F. , the behavior is the same.

some help?

regards

Marcelo
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: XBrowse bEditValid strange behavior
Posted: Wed Jun 19, 2013 03:11 PM
Marcello

If I understand you .. what you want to do is get the value of the xbrowse cell and pass it to a function to do something ??

Here is some code using the bOnPostEdit codeblock to check a stock number against an inventory table.. where the variable "v" is the value of the xbrowse cell.

Rick Lipkin

Code (fw): Select all Collapse
oLbxB:aCols[3]:bOnPostEdit := {|o,v| _InvtLook( v, oRsDetail, oRsRepair, "3", oLbxB, @lTaxable, oTaxable, cLoc,oLabor,oParts,oMisc,oTax,oTotal,nTaxNumber,nAssignedTo) }
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: XBrowse bEditValid strange behavior
Posted: Wed Jun 19, 2013 03:21 PM

Hello Rick,

thank for response, what I want to do, is valid the data input in the xBrowse GET, if I understand, bEditValid work like a VALID clause in a normal GET, in this case the get is created in the xbrowse. When the code exist return .T., when not, I want to display a grid for choose the right code. Maybe I can use bOnPostEdit for this purpoce, but I think the valid is the correct approach

Regards

Marcelo

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: XBrowse bEditValid strange behavior
Posted: Wed Jun 19, 2013 06:02 PM

In xbrowse, the scope of bEditValid function is limited only to validate the input and return valid or not.

If we want to take some action after a cell value is changed, please use
oCol:bOnChange := { |oCol, uOldValue| <any kind of action here> }

Sameway oCol:bEditWhen also needs to be a silent function and return whether the cell is editable or not. Please do not include any messages or any other action here. This codeblock may get evaluated more than once.

Regards



G. N. Rao.

Hyderabad, India
Posts: 1088
Joined: Fri Oct 07, 2005 03:33 PM
Re: XBrowse bEditValid strange behavior
Posted: Wed Jun 19, 2013 06:45 PM

Hello Mr. Rao,

thanks for response, finally I found the problem, the strange behavior is when set oCol:lAutoSave := .T. , this behavior is in all the the method bEditValid, bOnPostEdit, bOnChange, then I think this is a bug in xBrowse

Muchas gracias

saludos

Marcelo

Continue the discussion