FWH 1805: XBrowse New syntax

Post Reply
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

FWH 1805: XBrowse New syntax

Post by nageswaragunupudi »

An alternative syntax is now availabe for defining columns while creating XBrowse.
The syntax is explained with examples.

Code: Select all

#include "fivewin.ch"

function Main()

   local oDlg, oBrw, aData

   USE CUSTOMER NEW

   DEFINE DIALOG oDlg SIZE 560,400 PIXEL TRUEPIXEL TITLE "NEW SYNTAX" RESIZABLE

   @ 20,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE Alias() COLUMNS ;
         "TRIM(FIRST)+', '+TRIM(LAST) AS FullName PICTURE @! WIDTH 150 ALIGN CENTER SORT FIRST", ;
         "TRIM(STREET)+', '+TRIM(CITY) AS Address WIDTH 250 SORT CITY", ;
         "AGE PICT 999" ;
      CELL LINES NOBORDER AUTOSORT

   oBrw:CreateFromCode()

   ACTIVATE DIALOG oDlg CENTERED NOMODAL

   GO TOP
   aData := FW_DbfToArray( "FIRST,CITY" )

   XBROWSER aData COLUMNS "1 AS FirstName", "2 AS City"

   CLOSE CUSTOMER

return nil
 
Image
Regards

G. N. Rao.
Hyderabad, India
User avatar
Rick Lipkin
Posts: 2397
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: FWH 1805: XBrowse New syntax

Post by Rick Lipkin »

Rao

Very impressive ... I like being able to combine data, headers, colsizes, picture in one command ... one other suggestion ... I use the xBrowse(oRs) function frequently when debugging Sql recordsets ... It would be very helpful if you could add the number of returned rows on the xBrowse footer .. Usually I already know how many rows should be returned by a query .. adding the number of return rows on the xBrowse() footer would be an easy way to confirm my logic.

Thanks
Rick Lipkin
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FWH 1805: XBrowse New syntax

Post by nageswaragunupudi »

Please add the clause SHOW RECID or SHOW SLNUM to the Xbrowser command.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Mulyadi
Posts: 77
Joined: Mon Apr 18, 2011 2:32 am

Re: FWH 1805: XBrowse New syntax

Post by Mulyadi »

Mr Rao.

where can I get a complete reference to new syntax of xbrowse ?
for example, how to write validations and button actions in the new syntax.

I try like this but not working:

Code: Select all


@ 25,210 XBROWSE oBrwPrice SIZE -5,-5 PIXEL OF oFld:aDialogs[1] ;
 DATASOURCE orsPrice ;
  COLUMNS ...
          ...
          "price as Final Price picture '999,999,999' width 80 bitmap '.\Images\x64\calc.bmp' " + ;
            "nEditType := EDIT_GET_BUTTON transparent " + ;
            "valid if( oget:Value < 0, .F., .T. ) ", ;
          ...
  CELL FASTEDIT NOBORDER      
 
Regards

Mulyadi
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: FWH 1805: XBrowse New syntax

Post by nageswaragunupudi »

Code: Select all

<expression> AS/HEADER <header> WIDTH <nwidth> PIC/PICT/PICTURE <cpic> ALIGN <calign> SORT/ORDER BY <csortorder>
 
<expression> has to be the first
Other clauses are all optional and can be in any order.

";" embedded in header is translated as CRLF.

Note:
XBrowse automatically decides the width, picture, align and sort order. Unless it is really necessary, it is not necessary to specify these.

nEditType, bEditValid, bitmaps are all to be assigned separately as normal.
Regards

G. N. Rao.
Hyderabad, India
Post Reply