XBrowse bEditValid strange behavior (SOLVED)

XBrowse bEditValid strange behavior (SOLVED)

Postby Marcelo Via Giglio » Wed Jun 19, 2013 2:42 pm

Hello to all,

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

Code: Select all  Expand view

   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: Select all  Expand view
//------------------------------------------------------------------------------
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
Last edited by Marcelo Via Giglio on Wed Jun 19, 2013 6:52 pm, edited 1 time in total.
Marcelo Via Giglio
 
Posts: 1050
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: XBrowse bEditValid strange behavior

Postby Rick Lipkin » Wed Jun 19, 2013 3: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: Select all  Expand view

oLbxB:aCols[3]:bOnPostEdit := {|o,v| _InvtLook( v, oRsDetail, oRsRepair, "3", oLbxB, @lTaxable, oTaxable, cLoc,oLabor,oParts,oMisc,oTax,oTotal,nTaxNumber,nAssignedTo) }
 
User avatar
Rick Lipkin
 
Posts: 2629
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: XBrowse bEditValid strange behavior

Postby Marcelo Via Giglio » Wed Jun 19, 2013 3: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
Marcelo Via Giglio
 
Posts: 1050
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia

Re: XBrowse bEditValid strange behavior

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

Re: XBrowse bEditValid strange behavior

Postby Marcelo Via Giglio » Wed Jun 19, 2013 6: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
Marcelo Via Giglio
 
Posts: 1050
Joined: Fri Oct 07, 2005 3:33 pm
Location: Cochabamba - Bolivia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 11 guests