FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour FWH 1805: XBrowse New syntax
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
FWH 1805: XBrowse New syntax
Posted: Sun Jul 08, 2018 04:18 AM
An alternative syntax is now availabe for defining columns while creating XBrowse.
The syntax is explained with examples.

Code (fw): Select all Collapse
#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


Regards



G. N. Rao.

Hyderabad, India
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: FWH 1805: XBrowse New syntax
Posted: Tue Jul 10, 2018 01:03 PM

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

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH 1805: XBrowse New syntax
Posted: Tue Jul 10, 2018 03:11 PM

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

Regards



G. N. Rao.

Hyderabad, India
Posts: 85
Joined: Mon Apr 18, 2011 02:32 AM
Re: FWH 1805: XBrowse New syntax
Posted: Mon May 18, 2020 04:13 PM
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 (fw): Select all Collapse
@ 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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: FWH 1805: XBrowse New syntax
Posted: Tue May 19, 2020 06:00 AM
Code (fw): Select all Collapse
<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

Continue the discussion