#include "FiveWin.ch"
#include "XBrowse.ch"
function Main()
local oDlg, oBrw
local aValues := { { "one", "two", "three" }, { "four", "five", "six" }, { "seven", "eight", "nine" } }
DEFINE DIALOG oDlg SIZE 400, 300
@ 1, 1 XBROWSE oBrw ARRAY aValues SIZE 185, 120
oBrw:CreateFromCode()
oBrw:bSeek := { | cKey | SeekOnArray( oBrw,, cKey ) }
ACTIVATE DIALOG oDlg CENTER ;
ON INIT ( oBrw:aCols[ 1 ]:cOrder := "D" )
return nil
#include "FiveWin.Ch"
#include "xbrowse.ch"
//------------------------------------------------------------------//
function Main()
local oDlg, oBrw
local aData := { ;
{ 4578, 'Sales', 'B012' }, ;
{ 234, 'Purchaes', 'B342' }, ;
{ 75, 'Wages', 'C567' }, ;
{ 1435, 'Freight', 'C203' } }
DEFINE DIALOG oDlg SIZE 440,240 PIXEL
@ 10,10 XBROWSE oBrw SIZE 200,100 PIXEL OF oDlg ;
COLUMNS 3, 2, 1 ;
HEADERS 'Account', 'Description', 'D/C' ;
COLSIZES 80,150,80 ;
ARRAY aData ;
AUTOSORT ;
ON DBLCLICK ( MsgInfo( oBrw:aRow[ 3 ] ), oDlg:End() )
// Note: oBrw:aRow is shortcut for oBrw:aArrayData[oBrw:nArrayAt]
oBrw:nStretchCol := 2
// Following three lines are needed till XBrowse is rectified
oBrw:aCols[ 1 ]:cOrder := 'D'
oBrw:aCols[ 1 ]:SetOrder()
oBrw:bSeek := { |c| ArrayIncrSeek( oBrw, aData, c ) }
// < .. other browse settings .. >
oBrw:CreateFromCode()
ACTIVATE DIALOG oDlg CENTERED
return ( 0 )
//------------------------------------------------------------------//
function ArrayIncrSeek( oBrw, aData, cSeek )
local nRow, nCol
local cVal
if ( nCol := AScan( oBrw:aCols, { |oCol| ! Empty( oCol:cOrder ) } ) ) > 0
// following line is ommitted in TXBrowse source code
nCol := oBrw:aCols[ nCol ]:nArrayCol
cSeek := Upper( cSeek )
for nRow := 1 to Len( aData )
if Upper( cValToChar( aData[ nRow ][ nCol ] ) ) = cSeek // non-exact =
oBrw:nArrayAt := nRow
return .t.
endif
next nRow
endif
return .f.
//------------------------------------------------------------------//
As Per Antonio, Whats new in FWH 10.2 wrote:* Fix: XBrowse.prg: Incremental seek on Arrays works only when columns are added sequentially and that too in the
SetArray method. Now fixed. Incremental seek works irrespective of the order of the array columns if lAutoSort is
set to true in SetArray method.
#include "FiveWin.ch"
#include "XBrowse.ch"
function Main()
local oDlg, oBrw
local aValues := { { "one", "two", "three" }, { "four", "five", "six" }, { "seven", "eight", "nine" } }
DEFINE DIALOG oDlg SIZE 400, 300
@ 1, 1 XBROWSE oBrw ARRAY aValues SIZE 185, 120
oBrw:CreateFromCode()
oBrw:bSeek := { | cKey | SeekOnArray( oBrw,, cKey ) }
ACTIVATE DIALOG oDlg CENTER ;
ON INIT ( oBrw:aCols[ 1 ]:cOrder := "D" )
return nil
Unresolved external '_HB_FUN_SEEKONARRAY' referenced from D:\FwhTest\Test.Obj
oBrw:bSeek := { | cKey | oBrw:SeekOnArray( oBrw,, cKey ) }
Application
===========
Path and name: D:\FWHTest\test.exe (32 bits)
Size: 1,769,984 bytes
Time from start: 0 hours 0 mins 2 secs
Error occurred at: 03/03/10, 16:25:59
Error description: Error BASE/1004 Message not found: TXBROWSE:SEEKONARRAY
Args:
Stack Calls
===========
Called from: .\source\function\HARBOUR.PRG => _CLSSETERROR(166)
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:SEEKONARRAY(6980)
Called from: test.prg => (b)MAIN(14)
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:SEEK(5383)
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:KEYCHAR(2185)
Called from: => TWINDOW:HANDLEEVENT(0)
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1464)
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT(10470)
Called from: .\source\classes\WINDOW.PRG => _FWH(3378)
Called from: => DIALOGBOXINDIRECT(0)
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(273)
Called from: test.prg => MAIN(17)
oLbx:bSeek := { |c| oDbf:Seek( c ) }
With Mr.Rao's sample, incremental search on Array using xBrowse is working fine.
Mr.Rao wrote:SeekOnArray function in XBrowse is static function. Therefore it is not available for linking in our programs.
Mr.Rao wrote:My personal advice is not to assign any codeblock to bSeek. The default codeblock generated by xBrowse is much better.
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 98 guests