nageswaragunupudi wrote:To save the last used state of xbrowse, we can save the state with cSaveState := oBrw:SaveState() and in the next session restore the same the state with oBrw:RestoreState( cSavedState )
We need not always specify the column names as literals.
We can use an array like this:
aColNames := { "FIRSTNAME", "LASTNAME", "CITY". ...... }
and then
@ 10,10 XBROWSE oBrw ............ COLUMNS aColNames ............etc
Thanks for your help !
At first I created xbrowse without any descriptions of cols . Mine code :
local oWnd, oBrw, oQry
local aDgr, aCol
local cFld
local cSql
local cTbl := "uzsakym"
local aGrd := { ;
{ "uzsak" , "Order.ID" }, ;
{ "telkinys" , "Pool" }, ;
{ "preke" , "Item ID" }, ;
{ "uzs_kiekis" , "Qty." }, ;
{ "svarbus" , "Import." }, ;
{ "specai" , "Spec." }, ;
{ "mazi" , "Smalls" }, ;
{ "uzs_spalv" , "Ord.colors" }, ;
{ "uzs_data" , "Ord.date" }, ;
{ "uzs_sav" , "Ord.week" }, ;
{ "graz_data" , "Ret.date" }, ;
{ "graz_sav" , "Ret.week" }, ;
{ "fakt_data" , "Fact.date" }, ;
{ "fakt_sav" , "Fact.week" }, ;
{ "pastabos_ord" , "Ord.note" }, ;
{ "zymos" , "Notes" }, ;
{ "kerpa" , "Cutting" }, ;
{ "sukirp_lap" , "Cut.page" }, ;
{ "etiketes" , "Labels" }, ;
{ "gav_data" , "Recv.date" }, ;
{ "subrang" , "Subcontr." }, ;
{ "aud_nuras" , "Mater.off" }, ;
{ "frn_nuras" , "Furnit.off" }, ;
{ "invc_nuras" , "Invoice off" }, ;
{ "nav_nuras" , "NAV off" }, ;
{ "pasel_prad" , "Mak.begin" }, ;
{ "pokav_prad" , "Pack.begin" }, ;
{ "prilyg_mod" , "Equat.model" }, ;
{ "prilyg_kiekis", "Eq.qty" }, ;
{ "pastabos_buh" , "Account notes" }, ;
{ "buh_specas" , "Buh.spec" }, ;
{ "pastabos_zs" , "Notes of Zarasai" }, ;
{ "pok_lap_mod" , "Pack.list model" } }
aDgr := grd_set( cTbl, aGrd, cLg )
cFld := aDgr[ 1 ]
aCol := aDgr[ 2 ]
cSql := "select " + cFld + " from uzsakym where uzsakym.db = '" + cDb_id + "'"
oQry := oServ:Query( cSql )
MsgInfo( cFld )
MsgInfo( cSql )
MsgInfo( valtoprg( aCol ) )
DEFINE WINDOW oWnd TITLE "Užsakymai" MDICHILD OF wndMain()
@ 0, 0 XBROWSE oBrw OF oWnd DATASOURCE oQry COLUMNS aCol
oBrw:SetMySQL( oQry )
oBrw:CreateFromCode()
oWnd:oClient := oBrw
ACTIVATE WINDOW oWnd ON INIT oBrw:SetFocus()
return( NIL )
But it returns error :
Application
===========
Path and name: D:\A\Amdi2\engel.exe (32 bits)
Size: 3,318,757 bytes
Compiler version: Harbour 3.1.0dev (Rev. 17140)
FiveWin Version: FWH 11.10
Windows version: 6.1, Build 7601 Service Pack 1
Time from start: 0 hours 0 mins 7 secs
Error occurred at: 2013.03.01, 18:36:05
Error description: Error BASE/44 Assigned value is wrong class: TXBROWSE:NLEN
Args:
[ 1] = C
Stack Calls
===========
Called from: => TXBROWSE:_NLEN( 0 )
Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE( 0 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:KEYCOUNT( 0 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:ADJUST( 0 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:INITIATE( 0 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:CREATEFROMCODE( 0 )
Called from: uzs.prg => UZSAK( 62 )
Called from: engel.prg => RUN_PRG( 441 )
Called from: engel.prg => (b)MENU_RUN( 433 )
Called from: .\source\classes\VISTAMNU.PRG => TVISTAMENU:LBUTTONUP( 0 )
Called from: .\source\classes\CONTROL.PRG => TVISTAMENU:HANDLEEVENT( 0 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 0 )
Called from: => WINRUN( 0 )
Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 0 )
Called from: engel.prg => MAIN( 243 )
Added xbrowse.prg from sources to mine project. Now it's directed to error line ( 407 ) . This line :
METHOD KeyCount() INLINE ( ::nLen := Eval( ::bKeyCount ),;
iif(::oVScroll != nil ,;
( ::VSetRange( 1, ::nLen ), ::VUpdatePos() ), ),;
::nLen )
What that mean ? Empty query ?
I also added this :
u := 0
oQry:GoTop()
while !oQry:eof()
MsgInfo( oQry:uzsak + " " + oQry:preke )
oQry:skip()
u ++
if ( u == 5 )
exit
endif
enddo
Query isn't empty . Also tried with only first 3 columns : "uzsak", "telkinys", "preke" . They are varchar types only . The same result ... What that is bad ? Can you help me ?
P.S.: At this moment I noticed that mine version of Fwh is 11.11 , not 11.12 ...
With best regards ! Rimantas
ADDED ! This problem solved : Simply in xBrowse was query method ::RecCount() , but in TMySql is ::LastRec() . Changed , now I can see data of query in xBrowse ...

Rimantas U.