Page 1 of 1

FWH 1805: XBrowse New syntax

Posted: Sun Jul 08, 2018 4:18 am
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

Re: FWH 1805: XBrowse New syntax

Posted: Tue Jul 10, 2018 1:03 pm
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

Re: FWH 1805: XBrowse New syntax

Posted: Tue Jul 10, 2018 3:11 pm
by nageswaragunupudi
Please add the clause SHOW RECID or SHOW SLNUM to the Xbrowser command.

Re: FWH 1805: XBrowse New syntax

Posted: Mon May 18, 2020 4:13 pm
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

Re: FWH 1805: XBrowse New syntax

Posted: Tue May 19, 2020 6:00 am
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.