WBrowse changes the current file record by itself

User avatar
concentra
Posts: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

WBrowse changes the current file record by itself

Post by concentra »

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

#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: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: WBrowse changes the current file record by itself

Post by concentra »

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: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: WBrowse changes the current file record by itself

Post by concentra »

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: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: WBrowse changes the current file record by itself

Post by concentra »

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: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: WBrowse changes the current file record by itself

Post by concentra »

And I compiled it with xHarbour.com commercial version and the problem is still there...
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: WBrowse changes the current file record by itself

Post by Enrico Maria Giordano »

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
concentra
Posts: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: WBrowse changes the current file record by itself

Post by concentra »

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
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: WBrowse changes the current file record by itself

Post by Enrico Maria Giordano »

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
concentra
Posts: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: WBrowse changes the current file record by itself

Post by concentra »

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
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: WBrowse changes the current file record by itself

Post by Antonio Linares »

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
concentra
Posts: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: WBrowse changes the current file record by itself

Post by concentra »

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
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: WBrowse changes the current file record by itself

Post by Antonio Linares »

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
Post Reply