home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 16
/
CD_ASCQ_16_0994.iso
/
news
/
4611
/
fw16d.ins
/
SAMPLES
/
CUSTOMER.PRG
< prev
next >
Wrap
Text File
|
1994-06-13
|
4KB
|
165 lines
// FiveWin Report Class Tutorial
// FiveWin printing tools
#include "FiveWin.ch"
#include "Customer.ch"
static oWnd, oClients, oClient, oName
static cName
//----------------------------------------------------------------------------//
function Main()
SET 3DLOOK ON
USE Customer ALIAS Clients
USE Sales NEW
SELECT Clients
DEFINE WINDOW oWnd TITLE "Reporting tools" MDI ;
MENU BuildMenu() COLOR "N/W"
DEFINE BUTTONBAR OF oWnd
SET MESSAGE OF oWnd TO "Testing the FiveWin Report Class" CENTERED
ACTIVATE WINDOW oWnd ;
VALID MsgYesNo( "Do you want to end?" )
return nil
//----------------------------------------------------------------------------//
function BuildMenu()
local oMenu
MENU oMenu
MENUITEM "&DataBases"
MENU
MENUITEM "&Clients..." ACTION BrwClients() ;
MESSAGE "Clients management"
MENUITEM "&Report..." ACTION GenReport()
SEPARATOR
MENUITEM "&End" ACTION oWnd:End() ;
MESSAGE "End this test"
ENDMENU
oMenu:AddMdi() // Add standard MDI menu options
ENDMENU
return oMenu
//----------------------------------------------------------------------------//
function BrwClients()
local oBrw, oIco, oBar
if oClients != nil
return nil
endif
DEFINE ICON oIco FILENAME "..\icons\customer.ico"
DEFINE WINDOW oClients TITLE "Clients management" ;
MDICHILD ICON oIco
DEFINE BUTTONBAR oBar OF oClients
DEFINE BUTTON OF oBar ACTION ShowClient()
@ 2, 0 LISTBOX oBrw FIELDS OF oClients ;
SIZE 500, 500 ;
ON CHANGE ChangeClient()
oClients:SetControl( oBrw )
ACTIVATE WINDOW oClients ;
VALID( oClients := nil, .t. ) // We destroy the object
return nil
//----------------------------------------------------------------------------//
function GenReport()
local oWnd, oIco
DEFINE ICON oIco FILENAME "..\icons\print.ico"
DEFINE WINDOW oWnd MDICHILD TITLE "Clients report" ;
VSCROLL HSCROLL ICON oIco
ACTIVATE WINDOW oWnd
return nil
//----------------------------------------------------------------------------//
function ShowClient()
local oIco
if oClient != nil
return nil
endif
DEFINE ICON oIco FILENAME "..\icons\Person.ico"
DEFINE DIALOG oClient RESOURCE "Client" ;
ICON oIco
REDEFINE SAY ID 3 OF oClient // To get the proper color
REDEFINE SAY ID 4 OF oClient
REDEFINE SAY ID 5 OF oClient
REDEFINE GET oName VAR cName ID ID_NAME OF oClient
REDEFINE BUTTON ID ID_NEXT OF oClient ACTION GoNext()
SELECT Sales // We select Sales to properly initialize the Browse
REDEFINE LISTBOX FIELDS ID ID_SALES OF oClient
ACTIVATE DIALOG oClient CENTERED NOWAIT ;
VALID ( oClient := nil, .t. ) // Destroy the object
SELECT Clients
return nil
//----------------------------------------------------------------------------//
function ChangeClient()
if oClient != nil
cName = AllTrim( Clients->Last ) + ", " + Clients->First
oName:Refresh()
endif
return nil
//----------------------------------------------------------------------------//
function GoNext()
if oClients != nil
oClients:oControl:GoDown()
else
SKIP
if EoF()
GO BOTTOM
endif
endif
ChangeClient()
return nil
//----------------------------------------------------------------------------//