Hi all,
I'm using xbrowse to scroll an array when I have a list of names and a record number.
When the use select a row I read some files using the record number in the array and I display the related information.
In order to make the array selection fastest, I made in my program a small routine to check the record only when the selection is done.
To explain me better, if a user use the arrow key to select a specific name in the array, I go to read the related file only when 0.20 seconds occurred from the selection.
All runs fine with arrow keys but if I press with the mouse the arrow on the scroll then the scrolling continuosly runs also if I release the mouse buttonr.
This is a self executable that show the problem. Try to press with the mouse on the scroll's godown arrow.
Any ideas to solve this problem ?
Thanks in advance
prg and executble file are also on www.softwarexp.co.uk/beta/testxbr4.zip
*** self-contained sample that show the problem ***
#include "FiveWin.ch"
#include "xbrowse.ch"
function Main()
local oDlg, oBrw, aArray
local nLastCell
aArray:={}
for i:=1 to 200
aadd(aArray,{"Marc",str(i,3)})
next
DEFINE DIALOG oDlg SIZE 300, 200
@0,0 XBROWSE oBrw OF oDlg ARRAY aArray AUTOCOLS ;
oBrw:bChange:={|| SelectFunc(oBrw)}
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTER
return nil
Function SelectFunc(oBrw)
oBrw:bChange:={|| nil}
xBrowseLoop(oBrw)
&& do something
oBrw:bChange:={|| SelectFunc(oBrw)}
return
Function xBrowseLoop(oBrw)
local nSeconds, nLocalIndex,i
nLocalIndex:=oBrw:nArrayAt()
nSeconds:=seconds()
do while .t.
oBrw:Refresh()
sysrefresh()
if seconds()-nSeconds>.20
if nLocalIndex<>oBrw:nArrayAt()
nLocalIndex:=oBrw:nArrayAt()
nSeconds:=seconds()
loop
endif
exit
endif
enddo
return