Error with bEditValid - xBrowse

Error with bEditValid - xBrowse

Postby Maurizio » Thu Mar 25, 2010 11:02 am

Antonio ,
In this example below bEditVAlid is executed 2 times
Code: Select all  Expand view
#include "FiveWin.ch"
#include "XBrowse.ch"

function Main()

   local oDlg, oBrw
   
   Local aDati := {{0,0,0},{0,0,0},{0,0,0} }
 
   DEFINE DIALOG oDlg RESOURCE "Test"
   REDEFINE XBROWSE oBrw ID 10 OF oDlg ARRAY aDati AUTOCOLS CELL LINES
   
   WITH OBJECT oBrw:aCols[1]
      :nEditType     := EDIT_GET
      :bEditValid    := { | oGet, oCol | MSGINFO("Hello") ,.T. }
   END
   ACTIVATE DIALOG oDlg

return nil

The RC File is
Code: Select all  Expand view
LANGUAGE LANG_ENGLISH,SUBLANG_ENGLISH_US

TEST DIALOG DISCARDABLE 68, 43, 336, 213
STYLE WS_POPUP|DS_MODALFRAME|WS_CAPTION|WS_SYSMENU|WS_VISIBLE
CAPTION "Test"
FONT 8, "MS Sans Serif"
{
  CONTROL "", 10, "TXBrowse", WS_TABSTOP|0x00a00000, 0, 0, 168, 84
}
 


But with this code it is executed correctly 1 time

Code: Select all  Expand view
#include "FiveWin.ch"
#include "XBrowse.ch"

function Main()

   local oDlg, oBrw
   
   Local aDati := {{0,0,0},{0,0,0},{0,0,0} }
   
   DEFINE WINDOW oDlg

   @ 10,10 XBROWSE oBrw OF oDlg ARRAY aDati AUTOCOLS CELL LINES
   WITH OBJECT oBrw:aCols[1]
      :nEditType     := EDIT_GET
      :bEditValid    := { | oGet, oCol | MSGINFO("Hello") ,.T. }
   END
   
   oBrw:CreateFromCode()
   oDlg:oClient   := oBrw

 ACTIVATE WINDOW oDlg
   

return nil
 


Regards Maurizo
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Re: Error with bEditValid - xBrowse

Postby Maurizio » Sun Mar 28, 2010 11:25 am

Hello ,

Is there a solution to this problem?

Regards Maurizio
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Re: Error with bEditValid - xBrowse

Postby Daniel Garcia-Gil » Sun Mar 28, 2010 11:33 am

User avatar
Daniel Garcia-Gil
 
Posts: 2365
Joined: Wed Nov 02, 2005 11:46 pm
Location: Isla de Margarita

Re: Error with bEditValid - xBrowse

Postby nageswaragunupudi » Mon Mar 29, 2010 2:03 am

Please modify xbrowse.prg ( version 10.2 ) like this:
line no:9781-9783
Original code:
Code: Select all  Expand view
  if ::bEditValid != nil
      ::oEditGet:bValid := { | oGet, lRet | oGet:lValidating := .T., lRet := Eval( ::bEditValid, oGet, Self ), oGet:lValidating := .F., If( ! lRet, oGet:SetFocus(),), lRet }
   endif
 

Modify the assignment to ::oEditGet:bValid as :-
Code: Select all  Expand view
     ::oEditGet:bValid := { | oGet, lRet | oGet:lValidating := .T., lRet := Eval( ::bEditValid, oGet, Self ), ;
               oGet:lValidating := .F., If( ! lRet, oGet:SetFocus(), oGet:bValid := nil ), lRet }
 

With this modification, EditValid is executed only once.
Regards

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

Re: Error with bEditValid - xBrowse

Postby Maurizio » Mon Mar 29, 2010 6:32 am

Thank Nage

now works correctly ,
Antonio is it possible include in the original version ?

Maurizio
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Re: Error with bEditValid - xBrowse

Postby Antonio Linares » Mon Mar 29, 2010 10:10 am

Maurizio,

Yes, we are going to include it :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42082
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Silvio.Falconi and 123 guests