WBrowse changes the current file record by itself

WBrowse changes the current file record by itself

Postby concentra » Wed Feb 01, 2012 5:00 pm

In some situations, WBrowse changes the current file record by itself...

Is this the expected behavior ?

In the sample, left click in 16 and after that type 11.

Harbour 3.1.0dev (Rev. 17102)
FiveWin Harbour October 2011
Code: Select all  Expand view
#INCLUDE "FIVEWIN.CH"

FUNCTION MAIN()

   GenerateTestFile()

   cCodigo := "  "

   DEFINE WINDOW oDlg FROM 1,1 TO 20,60

   @ 1,5 GET oGetCodigo VAR cCodigo OF oDlg VALID( V_Codigo() ) SIZE 90, 22

   oBrw := TWBrowse():New( 5,5,400,150,,,,oDlg,,,,,,,,,,,,, "TESTBRW" )

   oBrw:SetCols( {{ || TESTBRW->CODIGO }}, {"Produto"}, {260} )

   ACTIVATE DIALOG oDlg

RETURN

/************************************************/
STATIC FUNCTION V_Codigo()
/************************************************/

   IF ! EMPTY(cCodigo) .AND. TESTBRW->( DBSEEK( cCodigo ) )
      ALERT( Recno() )
      oBrw:Refresh()
      ALERT( Recno() )
   ENDIF

   oGetCodigo:cText( "  " )

RETURN( .F. )

/************************************************/
STATIC FUNCTION GenerateTestFile()
/************************************************/

   aSTRU := { { "CODIGO", "C", 2, 0 } }
   DBCREATE( "TESTBRW.DBF", aSTRU )

   USE TESTBRW EXCLUSIVE
   INDEX ON FIELD->CODIGO TAG "COD"

   FOR I := 10 TO 25
      DBAPPEND()
      FIELD->CODIGO := STR(I,2)
   NEXT

   TESTBRW->( DBGOTOP() )

RETURN( .F. )
 


[[]] Maurício Ventura Faria
User avatar
concentra
 
Posts: 124
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: WBrowse changes the current file record by itself

Postby Enrico Maria Giordano » Wed Feb 01, 2012 6:48 pm

I don't understand. Can you build a sample showing the problem, please?

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8712
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: WBrowse changes the current file record by itself

Postby concentra » Thu Feb 02, 2012 9:40 am

Hi Enrico.
Enrico Maria Giordano wrote:I don't understand. Can you build a sample showing the problem, please?

The sample is part of the message...
The sample generates a DBF, indexes, and shows it in a wbrowse.
Run the sample, click on record showing 16 ( 7th record ) and then type 11 that seeks "11" in DBF that is record 2.
Before a wbrowse:refresh() the DBF is on record 2 what is OK and after the wbrowse:refresh() the DBF is on record 7... To me this seems not Ok.

[[]]
Maurício Ventura Faria
User avatar
concentra
 
Posts: 124
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: WBrowse changes the current file record by itself

Postby Enrico Maria Giordano » Thu Feb 02, 2012 9:43 am

Your sample shows 2 and 2 here using FWH 11.11.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8712
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: WBrowse changes the current file record by itself

Postby concentra » Thu Feb 02, 2012 10:32 am

Enrico Maria Giordano wrote:Your sample shows 2 and 2 here using FWH 11.11

Ok. I am using October 2011 version...
What version of Harbour ?
May I send you my EXE in order to you test ? And could you send me yours ?
The problem doesn't occur all the time...
User avatar
concentra
 
Posts: 124
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: WBrowse changes the current file record by itself

Postby concentra » Thu Feb 02, 2012 10:34 am

Enrico Maria Giordano wrote:Your sample shows 2 and 2 here using FWH 11.11.

If you repeat the process of clicking and typing a few times does the problem shows ?
Thanks for your help !
User avatar
concentra
 
Posts: 124
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: WBrowse changes the current file record by itself

Postby concentra » Thu Feb 02, 2012 10:53 am

And I compiled it with xHarbour.com commercial version and the problem is still there...
User avatar
concentra
 
Posts: 124
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: WBrowse changes the current file record by itself

Postby Enrico Maria Giordano » Thu Feb 02, 2012 10:57 am

concentra wrote:If you repeat the process of clicking and typing a few times does the problem shows ?


Yes, now I get the problem. Sorry, there must be something wrong in TWBrowse class. :-(

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8712
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: WBrowse changes the current file record by itself

Postby Enrico Maria Giordano » Thu Feb 02, 2012 11:00 am

Please remove the ALERTs and replace Refresh() with UpStable().

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8712
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: WBrowse changes the current file record by itself

Postby concentra » Thu Feb 02, 2012 11:31 am

Enrico Maria Giordano wrote:Please remove the ALERTs and replace Refresh() with UpStable().

Ok, in this way it works as expected.
But why it do not with the alerts ?
And I tried UpStable() in my application, the one i got the problem, and it didn't work, in fact the problem was greater with it !
User avatar
concentra
 
Posts: 124
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: WBrowse changes the current file record by itself

Postby Enrico Maria Giordano » Thu Feb 02, 2012 12:34 pm

concentra wrote:Ok, in this way it works as expected.


Great! :-)

concentra wrote:But why it do not with the alerts ?


Probably because the alerts cause lostfocus and gotfocus events.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8712
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: WBrowse changes the current file record by itself

Postby concentra » Fri Feb 03, 2012 10:37 am

Enrico Maria Giordano wrote:Great! :-)

Not so greate since it do not work all the time !
The alerts are there to prove.

Is wbrowse deprecated to xbrowse ? Should I remove it from my apps ?
User avatar
concentra
 
Posts: 124
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: WBrowse changes the current file record by itself

Postby Antonio Linares » Fri Feb 03, 2012 10:42 am

wbrowse is supported and if it is enough for your needs then you can keep using it :-)

xbrowse is the way to go when you need much more features from the browse, that wbrowse does not offer
regards, saludos

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

Re: WBrowse changes the current file record by itself

Postby concentra » Fri Feb 03, 2012 11:19 am

Ok Antonio.

And what about this bug ?
Wbrowse changing the file record by itself is a huge issue to me...

[[]] Maurício Faria
User avatar
concentra
 
Posts: 124
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: WBrowse changes the current file record by itself

Postby Antonio Linares » Fri Feb 03, 2012 11:44 am

Mauricio,

As Enrico has pointed, the problem comes from changing the focus meanwhile the browse is working.

If you need to check some values, etc. you can use the function LogFile() or change the caption of the window, etc. Use other ways to report info without interfering with the focus :-)
regards, saludos

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

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Otto and 108 guests