Query and restore entire xBrowse Layout ( Uwe and Rao )

Query and restore entire xBrowse Layout ( Uwe and Rao )

Postby Rick Lipkin » Tue Feb 14, 2012 3:54 pm

To All

I have been asked to be able to store then restore and entire set of attributes of an xBrowse with a recordset...Fieldname,Header,Picture,Width

In a Previous post Uwe showed me how to query the browse object and store the Width of each column to an array :

Code: Select all  Expand view

aColw := {}

   i := 1
   For i = 1 to LEN( oBrw:aCols )
       aLine := { oBrw:aCols[i]:nWidth  }
       AAdd( aColw, aLine )
   Next
 


Taking this to the next step I would like to add the Fieldname,Header,Picture as a multi dimensional array to the above code..

As Rao explained in this thread :
viewtopic.php?f=3&t=22533&p=120111&hilit=save+an+array+to+disk#p120111

You can Restore the attributes of xBrowse from a stored array :

Code: Select all  Expand view


Example:
Memowrit( "specs.txt", FW_ValToExp( aCols ) )
Later
aCols := &( MemoRead( "specs.txt" ) )


Prepare a multi-dimensional array with all column specs. Each row is an array specifying { <fieldname>, [<header>], [<picture>], [<width>], [<align>], [<sortorder>]. Only first column is compulsory and all others are optional.

In the above example,
aCols := { ;
{ "first", "Head-1" }, ;
{ "Last", "Head-2" }, ;
{ "City", "Head-3", "@!", 40 } }

@ 0,0 XBROWSE oBrw OF oWnd COLUMNS aCols DATASOURCE oQry CELL LINES
 


I understand the concept and code, however I have a rather complex xBrowse that I create columns to create a single name from First Name+Last Name in a code block and some data masks..

Code: Select all  Expand view


ADD oCol TO oBrw AT 1 DATA {|x| x := _ChkCust(oRsReq:Fields("clname"):Value,oRsReq:Fields("cfname"):Value)  } HEADER "Customer Name" size 110

       oBrw:aCols[ 9 ]:cDataType := "M"

       ADD oCol TO oBrw AT 10 DATA {|x| x := _ChkStock(oRsReq:Fields("OutOfStock"):Value)  } HEADER "For Stock" size 55

       oCol := oBrw:aCols[ 11 ]
       oCol:bStrData := { |x| x := if(oRsReq:eof,,oRsReq:Fields("DateRequested"):Value), If( Empty(x), '00/00/0000',DToC(x) ) }

       oCol := oBrw:aCols[ 12 ]
       oCol:bStrData := { |x| x := if(oRsReq:eof,,oRsReq:Fields("DateOrdered"):Value), If( Empty(x), '00/00/0000',DToC(x) ) }

       oCol := oBrw:aCols[ 13 ]
       oCol:bStrData := { |x| x := if(oRsReq:eof,,oRsReq:Fields("DateShipped"):Value), If( Empty(x), '00/00/0000',DToC(x) ) }

       oCol := oBrw:aCols[ 14 ]
       oCol:bStrData := { |x| x := if(oRsReq:eof,,oRsReq:Fields("DateReceived"):Value), If( Empty(x), '00/00/0000',DToC(x) ) }

       oCol := oBrw:aCols[ 15 ]
       oCol:bStrData := { |x| x := if(oRsReq:eof,,oRsReq:Fields("DateCancelled"):Value), If( Empty(x), '00/00/0000',DToC(x) ) }

 


Is there a way to query the results of each column and in the case of the complex columns, store the code block of the above columns, then be able to restore the array of the columns and execute the embedded code block from the stored array ?

The first starting point is to be able to query the entire browse into an array and store that to disk .. then perhaps I can go from there to see if I can re-create the browse from the stored array ..

Any help would be appreciated.
Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Query and restore entire xBrowse Layout ( Uwe and Rao )

Postby nageswaragunupudi » Wed Feb 22, 2012 5:09 am

Recent versions of SaveState and RestoreState provide user configurable save and restore.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 75 guests