![Embarassed :oops:](./images/smilies/icon_redface.gif)
How can I implement a report with preview ? I need the simplest example of both (TBrowse & a report) using FiveWin. Thank you.
Code: Select all | Expand
@ 1, 1 LISTBOX oLbx ;
FIELDS Clients->Name, AllTrim( Clients->Address ),;
Clients->Phone, Str( Clients->Age, 3 ) ;
HEADERS "Name", "Address", "Phone", "Age" ;
FIELDSIZES 222, 213, 58, 24 ;
SIZE 284, 137 OF oWnd
Code: Select all | Expand
#include "FiveWin.ch"
#include "report.ch"
function Main()
local oReport
USE TEST INDEX TEST NEW
REPORT oReport TITLE "*** My First Report ***" PREVIEW
COLUMN TITLE "St" DATA Test->State
COLUMN TITLE "First Name" DATA Test->First
COLUMN TITLE " Salary" DATA Test->Salary
END REPORT
oReport:CellView()
ACTIVATE REPORT oReport
CLOSE TEST
RETURN NIL
Code: Select all | Expand
#include "Fivewin.ch"
FUNCTION MAIN()
LOCAL oDlg, oBrw
USE TEST
DEFINE DIALOG oDlg;
SIZE 800, 600
@ 0, 0 LISTBOX oBrw FIELDS
oBrw:bLine = &( "{ || { TEST -> last, TEST -> first } }" )
ACTIVATE DIALOG oDlg;
ON INIT oDlg:SetControl( oBrw );
CENTER
CLOSE
RETURN NIL
HunterEC wrote:Enrico: thank you very much for your example. Now, how can I make this LISTBOX pop up when the user press, for example, F2 to activate a lookup window (which will be the listbox). Thank you.
Code: Select all | Expand
SETKEY( VK_F2, { || YourLookUpFunction() } )
Code: Select all | Expand
oDlg:bKeyDown = { || If( GetKeyState( VK_F2 ), YourLookUpFunction(), ) }
HunterEC wrote:Enrico: if I use the Test file VIA DBFCDX in your example and REQUEST & link the library, the LISTBOX does not come up on screen. Any thoughts on this? Thank you.
Code: Select all | Expand
#include "Fivewin.ch"
REQUEST DBFCDX
FUNCTION MAIN()
LOCAL oDlg, oBrw
RDDSETDEFAULT( "DBFCDX" )
USE TEST
DEFINE DIALOG oDlg;
SIZE 800, 600
@ 0, 0 LISTBOX oBrw FIELDS
oBrw:bLine = &( "{ || { TEST -> last, TEST -> first } }" )
ACTIVATE DIALOG oDlg;
ON INIT oDlg:SetControl( oBrw );
CENTER
CLOSE
RETURN NIL