home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2002 June
/
PCWorld_2002-06_cd.bin
/
Software
/
Komercni
/
xbase
/
express
/
exd17208.r04
/
exp17
/
Samples
/
Xdemo2.prg
< prev
next >
Wrap
Text File
|
2002-01-30
|
7KB
|
245 lines
/*
╓───────────────────────────────────────────────────────╖
║ Program..: XDEMO2.PRG ║
║ Author...: Roger J. Donnay ║
║ Notice...: (c) DONNAY Software Designs 1987-2001 ║
║ Date.....: Sep 15, 2001 ║
║ Notes....: eXPress Demo Program # 2 ║
╙───────────────────────────────────────────────────────╜
This sample program demonstrates "application" features of
eXPress++ like DCAPPEDIT, DCAPPBROWSE and DCAPPFIELD.
*/
#include "dcapp.ch"
#include "dcbitmap.ch"
#include "appevent.ch"
#define oTabPage1 aLocals[1]
#define oTabPage2 aLocals[2]
#define oTabPage3 aLocals[3]
#define oTabPage4 aLocals[4]
#define oTabPage5 aLocals[5]
#define oTabPage6 aLocals[6]
#define oTabPage7 aLocals[7]
#define oAppEdit1 aLocals[8]
#define oAppEdit2 aLocals[9]
#define oAppEdit3 aLocals[10]
#define oAppEdit4 aLocals[11]
#define oAppEdit5 aLocals[12]
#define oAppBrow1 aLocals[13]
#define oStatic1 aLocals[14]
#define oStatic2 aLocals[15]
#define oStatic3 aLocals[16]
#define oStatic4 aLocals[17]
#define oStatic5 aLocals[18]
#define oStatic6 aLocals[19]
#define oToolBar aLocals[20]
#define cSource aLocals[21]
#define oDlg aLocals[22]
#define oDlgWindow aLocals[23]
#define cTitle aLocals[24]
#define lMDIApp aLocals[25]
FUNCTION XDemo_2 ( oDialog )
LOCAL oCrt, oOldCrt, GetList, GetOptions, aLocals[25], aApplication
SET DEFA TO
SET PATH TO ..\DATA
IF Select('COLLECT') = 0
USE COLLECT VIA DBFNTX NEW SHARED
ELSE
dbSelectArea('COLLECT')
ENDIF
DEFAULT aApplication := _BuildApp( aLocals, oDialog )
GetOptions := aApplication[1]
Getlist := aApplication[2]
DCREAD GUI ;
OPTIONS GetOptions ;
TITLE 'Demo of Application Browse/Edit' ;
APPWINDOW oDialog ;
FIT
CLOSE DATABASES
RETURN nil
* ----------------------
STATIC FUNCTION _BuildApp( aLocals, oDialog )
LOCAL Getlist := {}, GetOptions, aCoords
cTitle := 'Demo Application of AppEdit/AppBrowse'
/* ---- Tab Page #1 ---- */
@ 0,0 DCTABPAGE oTabPage1 CAPTION 'Plain' ;
SIZE 80,19.5 PREOFFSET 0 POSTOFFSET 86 ;
COLOR GRA_CLR_BLUE, GRA_CLR_RED
@ 1.5,1 DCSTATIC XBPSTATIC_TYPE_RAISEDBOX SIZE 78,17.5 ;
OBJECT oStatic1 PARENT oTabPage1
DCAPPEDIT INTO oAppEdit1 STYLE PLAIN POSITION 0,0 PARENT oStatic1
/* ---- Tab Page #2 ---- */
@ 0,0 DCTABPAGE oTabPage2 CAPTION '3D' ;
RELATIVE oTabPage1 ;
COLOR GRA_CLR_RED
@ 1.5,1 DCSTATIC XBPSTATIC_TYPE_RAISEDBOX SIZE 78,17.5 ;
OBJECT oStatic2 PARENT oTabPage2
DCAPPEDIT INTO oAppEdit2 STYLE 3D POSITION 0,0 PARENT oStatic2
DCAPPFIELD COLLECT->descrip INTO oAppEdit2 CAPTION 'Description' ;
COLOR GRA_CLR_BLUE
DCAPPFIELD COLLECT->type INTO oAppEdit2 CAPTION 'Type' ;
COLOR GRA_CLR_BLUE
DCAPPFIELD COLLECT->sub_type INTO oAppEdit2 CAPTION 'Sub-Type' ;
COLOR GRA_CLR_BLUE
DCAPPFIELD COLLECT->location INTO oAppEdit2 CAPTION 'Location' ;
COLOR GRA_CLR_BLUE
DCAPPFIELD COLLECT->date_orig INTO oAppEdit2 CAPTION 'Date of Origin' ;
COLOR GRA_CLR_BLUE
DCAPPFIELD COLLECT->date_acqu INTO oAppEdit2 CAPTION 'Acquired Date' ;
COLOR GRA_CLR_BLUE
DCAPPFIELD COLLECT->appr_value INTO oAppEdit2 CAPTION 'Appraised Value' ;
COLOR GRA_CLR_BLUE
DCAPPFIELD COLLECT->for_sale INTO oAppEdit2 CAPTION 'For Sale?' ;
COLOR GRA_CLR_BLUE
DCAPPFIELD COLLECT->condition INTO oAppEdit2 CAPTION 'Condition' ;
COLOR GRA_CLR_BLUE
DCAPPFIELD COLLECT->bitmap1 INTO oAppEdit2 CAPTION 'Bit Map File #1' ;
COLOR GRA_CLR_BLUE
DCAPPFIELD COLLECT->bitmap2 INTO oAppEdit2 CAPTION 'Bit Map File #2' ;
COLOR GRA_CLR_BLUE
DCAPPFIELD COLLECT->comments INTO oAppEdit2 CAPTION 'Comments' ;
COLOR GRA_CLR_BLUE
DCAPPFIELD COLLECT->memo INTO oAppEdit2 CAPTION 'How was this item acquired?' ;
COLOR GRA_CLR_BLUE ;
WIDTH 300
/* ---- Tab Page #3 ---- */
@ 0,0 DCTABPAGE oTabPage3 CAPTION 'Fancy' ;
RELATIVE oTabPage2 ;
COLOR GRA_CLR_YELLOW
@ 1.5,1 DCSTATIC XBPSTATIC_TYPE_RAISEDBOX SIZE 78,17.5 ;
OBJECT oStatic3 PARENT oTabPage3
DCAPPEDIT INTO oAppEdit3 STYLE FANCY POSITION 0,0 PARENT oStatic3
/* ---- Tab Page #4 ---- */
@ 0,0 DCTABPAGE oTabPage4 CAPTION '3D 1' ;
RELATIVE oTabPage3 ;
COLOR GRA_CLR_CYAN
@ 1.5,1 DCSTATIC XBPSTATIC_TYPE_RAISEDBOX SIZE 78,17.5 ;
OBJECT oStatic4 PARENT oTabPage4
DCAPPEDIT INTO oAppEdit4 POSITION 0,0 PARENT oStatic4 ;
STYLE APPSTYLE_ACTIONICONS+APPSTYLE_RAISED+APPSTYLE_ACTIONTOP
/* ---- Tab Page #5 ---- */
@ 0,0 DCTABPAGE oTabPage5 CAPTION 'Fancy 2' ;
RELATIVE oTabPage4 ;
COLOR GRA_CLR_GREEN
@ 1.5,1 DCSTATIC XBPSTATIC_TYPE_RAISEDBOX SIZE 78,17.5 ;
OBJECT oStatic5 PARENT oTabPage5
DCAPPEDIT INTO oAppEdit5 STYLE FANCY POSITION 0,0 ;
FIELDS COLLECT->descrip, COLLECT->type, COLLECT->sub_type, ;
COLLECT->date_orig, COLLECT->date_acqu, COLLECT->orig_price, ;
COLLECT->appr_value, COLLECT->condition ;
BITMAP BITMAP_WIZARD FIT ;
PARENT oStatic5 TITLE "My Collection"
/* ---- Tab Page #6 ---- */
@ 0,0 DCTABPAGE oTabPage6 CAPTION 'Browse' ;
RELATIVE oTabPage5 ;
COLOR GRA_CLR_WHITE ;
GOTFOCUS {||dbSkip(0)}
@ 1.5,1 DCSTATIC XBPSTATIC_TYPE_RAISEDBOX SIZE 78,17.5 ;
OBJECT oStatic6 PARENT oTabPage6
DCAPPBROWSE INTO oAppBrow1 STYLE FANCY POSITION 0,0 ;
PARENT oStatic6 TITLE "My Collection"
DCAPPFIELD COLLECT->descrip INTO oAppBrow1 CAPTION 'Description' ;
COLOR GRA_CLR_BLUE, GRA_CLR_WHITE
DCAPPFIELD COLLECT->type INTO oAppBrow1 CAPTION 'Item Type' ;
COLOR GRA_CLR_BLUE, GRA_CLR_WHITE
DCAPPFIELD COLLECT->sub_type INTO oAppBrow1 CAPTION 'Sub-Type' ;
COLOR GRA_CLR_BLUE, GRA_CLR_WHITE
/* ---- Tab Page #7---- */
@ 0,0 DCTABPAGE oTabPage7 CAPTION 'Source' ;
RELATIVE oTabPage6
cSource := MemoRead('XDEMO2.PRG')
IF Empty(cSource)
cSource := MemoRead('..\PRG\XDEMO2.PRG')
ENDIF
IF Empty(cSource)
cSource := 'XDEMO2.PRG cannot be found'
ENDIF
@ 1.2,1 DCMULTILINE cSource PARENT oTabPage7 SIZE 78,18.2 ;
FONT "8.Courier" EDITPROTECT {||.t.}
/* ---- Tool Bar ---- */
@ 1,81 DCPUSHBUTTON CAPTION '&Exit' ;
SIZE 7,1 ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}
DCGETOPTIONS ;
CASCADE
RETURN { GetOptions, GetList, aLocals }
/* ------------------------ */
STATIC FUNCTION _RefreshBrow(aLocals)
LOCAL aChildList := oStatic6:ChildList(), i
FOR i := 1 TO Len(aChildList)
IF aChildList[i]:ClassName() == 'XbpBrowse'
aChildList[i]:refreshAll()
ENDIF
NEXT
RETURN nil