Listbox never hits EOF oLbx:ReFresh()

Listbox never hits EOF oLbx:ReFresh()

Postby Rick Lipkin » Mon Aug 04, 2008 7:04 pm

In trouble-shooting a particular module .. I have a .dbf table that I use a standard wbrowse listbox. As I run thru the listbox in a do while .not. eof I use the oLbx:ReFresh() method to show the progress of the loop .. for some unknown reason .. the loop never hits the EOF and you have to hit the ESC key to get out of the look.

If I take out the oLbx:ReFresh() .. I do hit the EOF .. but if I leave in the oLbx:ReFresh() .. the record pointer never hit the eof()

FWH 8.07 ...

Here is an abreviated snipit of code

//-----------

oLBX:SetFocus()
SELECT 9

dbGoTop()
oLbx:Upstable()
SysReFresh()

DO WHILE .not. EOF()

SELECT 9
DELETE
SKIP
oLBX:ReFresh() // take this out and the loop hits eof
SysReFresh() //

SELECT 9 // never hits EOF
IF EOF()
msginfo( "eof exit" )
EXIT
ENDIF

ENDDO

oDLG1:End()

SAYING := "Batch Import Completed "
SAYING += ""+STR(nLOADED,4)+" Records Loaded"

MsgInfo( SAYING )
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Postby Rick Lipkin » Mon Aug 04, 2008 7:18 pm

To All

Seems there has been a change in behavoir .. since I re-compiled this application:

I have to test for EOF first before the oLbx:ReFresh() .. Antonio .. can you look at the Refresh() method and see what has changed ??

Rick Lipkin

DO WHILE .not. EOF()

SELECT 9
DELETE
SKIP

// insert the eof test here before the oLbx:ReFresh()

IF EOF()
EXIT
ENDIF

oLBX:ReFresh()
SysReFresh()

ENDDO
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Postby yury » Mon Aug 04, 2008 7:44 pm

hello, try this way:

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

Function Act_Lbx()

SET DELETE ON

cFile = 'c:\temp\MyDBF.DBF'

DBUSEAREA(.T.,'DBFNTX',cFile,'temp',.F.)

if NETERR()
   ? 'Error. Abort...'
   RETURN
endif

bAction = {|| xDel() }

select temp
go top

define dialog oDlg from 01,01 to 32,100 title 'Lines'

@ 01,01 listbox oLbx FIELDS of oDlg SIZE 383,160

oDlg:bStart = {|| EVAL(bAction) }

activate dialog oDlg

return




Function xDel()

nreg=0

msginfo('Starting...')

while .t.
    Sysrefresh()
   oLbx:GoTop()
   oLbx:Refresh()
   go top
   if eof()
      exit
  else
      delete
      nreg++
   endif   
enddo   

msginfo('Finished ! '+alltrim(str(nreg))+' records deleted...'  )

oDLg:End()

return


attention in SET DELETE ON

regards
Yury Marcelino Al
yury030575@yahoo.com.br
vimansca@vimansca.com.br
Leme / SP - Brasil
yury
 
Posts: 56
Joined: Wed May 23, 2007 2:01 pm

Postby Rick Lipkin » Mon Aug 04, 2008 7:50 pm

Yury

Thank you for your comments .. the code I was using was working fine under FWH 27 .. I was using the oLbx:Refresh after the record was deleted and then testing for EOF after that event .. something has changed in the ReFresh() method that will not allow EOF to test .T. when the record pointer hits eof .. or ReFresh is moving the record pointer and it never hits eof

Rick
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Postby Antonio Linares » Tue Aug 05, 2008 4:36 am

Rick,

You could check oBrw:lHitBottom to see if EOF was detected.
regards, saludos

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

Postby Rick Lipkin » Tue Aug 05, 2008 10:23 am

Antonio

I will be away from the office today but I will try your suggestion and let you know

Rick
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 66 guests