home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2002 June
/
PCWorld_2002-06_cd.bin
/
Software
/
Komercni
/
xbase
/
express
/
exd17208.r04
/
exp17
/
Samples
/
Xsample4.prg
< prev
next >
Wrap
Text File
|
2002-01-30
|
62KB
|
2,304 lines
*-- PROGRAM FILE -------------------------------------------------------------
* Application: eXPress++ Library
* Description: eXPress++ sample programs
* File Name: xsample4.prg
* Author: Roger Donnay Tester:
* Date created: 01/01/00 Date updated: 11/07/2001
* Copyright: (c) 2001 by DONNAY Software Designs
*-----------------------------------------------------------------------------
#include "DCDIALOG.CH"
#include "SET.CH"
#include "XBP.CH"
#include "APPEVENT.CH"
#INCLUDE "inkey.CH"
#INCLUDE "dcicon.CH"
#INCLUDE "dcgrump.ch"
#INCLUDE "dcbitmap.ch"
#include "font.ch"
#INCLUDE "dcprint.CH"
#define VK_NUMLOCK 0x90
#define VK_SCROLL 0x91
#define VK_CAPITAL 0x14
#define APPKEY_PRESSED 2
#define CRLF Chr(13)+Chr(10)
FUNCTION X_Samples_4( oDialog )
LOCAL GetList := {}, nTest := 0, cMemo := '', oMemo, i, j, oDlg, ;
lDebugCreate := .f., lDebugEvent := .f., GetOptions, aApp[1], ;
cTitle, oDlgWindow, aCoords, oSourceFile, cSource
SET DEFA TO
SET PATH TO ..\DATA
cTitle := 'eXPress++ Sample Programs (Set 4)'
nTest := 0
cMemo := ''
lDebugEvent := .f.
lDebugCreate := .f.
FOR i := 1 TO 5
FOR j := 1 TO 6
nTest++
@ j-1,1 + (i-1)*14 DCRADIO nTest ;
VALUE _Value(nTest) ;
PROMPT XSample_Header(nTest) ;
ACTION {||XSample_Memo(nTest,oMemo,oSourceFile,@cSource)} ;
COLOR XSample_Color(nTest)
NEXT j
NEXT i
nTest := 1
@ 2,73 DCPUSHBUTTON CAPTION 'Run Sample' ;
SIZE 12, 1 ;
ACTION {||XSample_Run(nTest,oDialog,lDebugCreate,lDebugEvent,GetList,GetOptions)}
@ 3,73 DCPUSHBUTTON CAPTION 'Print Source' ;
SIZE 12, 1 ;
ACTION {||XSample_Print(cSource)}
@ 4,73 DCPUSHBUTTON CAPTION 'Exit' ;
SIZE 12, 1 ;
ACTION {||PostAppEvent(xbeP_Close,,,oDlg)}
@ 5,73 DCCHECKBOX lDebugEvent PROMPT 'Debug Events'
@ 6.3,5 DCSAY '' SAYSIZE 60 COLOR GRA_CLR_DARKBLUE ;
OBJECT oSourceFile FONT '8.Courier Bold'
@ 7,1 DCMULTILINE cMemo ;
OBJECT oMemo ;
SIZE 85,12 ;
FONT '8.Alaska Crt'
DCGETOPTIONS ;
ICON ICON_EXPRESS ;
NOBUSY ;
CASCADE
DCREAD GUI ;
OPTIONS GetOptions ;
EVAL {||XSample_Memo(nTest,oMemo,oSourceFile,@cSource)} ;
APPWINDOW oDialog ;
PARENT @oDlg ;
TITLE cTitle ;
FIT
CLOSE DATABASES
RETURN nil
* ---------------------------- *
STATIC FUNCTION _Value( nTest )
RETURN nTest
* ---------------------------- *
STATIC FUNCTION XSample_Memo( nTest, oMemo, oSourceFile, cSource )
LOCAL cFunction, nFound, cSourceFile
cSource := ''
nTest += 102
cFunction := 'XSample_' + Alltrim(Str(nTest))
cSourceFile := 'XSAMPLE4.PRG'
cSource := MemoRead(cSourceFile)
IF Empty(cSource)
cSourceFile := '..\PRG\XSAMPLE4.PRG'
cSource := MemoRead(cSourceFile)
ENDIF
IF Empty(cSource)
cSource := 'XSAMPLE4.PRG cannot be found'
ENDIF
nFound := AT('FUNCTION ' + cFunction,cSource)
cSource := Substr(cSource,nFound)
nFound := AT('*** END OF EXAMPLE ***',cSource)
cSource := Substr(cSource,1,nFound+21)
IF !Empty(cSource)
oMemo:setData(cSource)
oSourceFile:setCaption(cSourceFile)
ENDIF
RETURN nil
* -------------------
STATIC FUNCTION XSample_Print( cSource )
LOCAL oPrinter, nLineCount := MLCount(cSource), i, cMemoLine, nRow
DCPRINT ON TO oPrinter PREVIEW FONT '10.Courier' NONSTOP HIDE
IF Valtype(oPrinter) # 'O' .OR. !oPrinter:lActive
RETURN nil
ENDIF
nRow := 1
FOR i := 1 TO nLineCount - 1
cMemoLine := MemoLine( cSource, nil, i )
@ nRow++,2 DCPRINT SAY cMemoLine PRINTER oPrinter
IF nRow > 60
DCPRINT EJECT
nRow := 1
ENDIF
NEXT
DCPRINT OFF
RETURN nil
* ---------------------------- *
STATIC FUNCTION XSample_Run( nTest, oDialog, lDebugCreate, lDebugEvent, ;
GetList, GetOptions )
LOCAL nDebug := 0, lVer20, oThread
#ifdef EXPRESS20
lVer20 := .t.
#else
lVer20 := .f.
#endif
DC_Gui(.t.)
nTest += 102
IF lDebugCreate
nDebug += DCGUI_DEBUG_CREATE
ENDIF
IF lDebugEvent
nDebug += DCGUI_DEBUG_EVENTS
ENDIF
DC_ReadGuiDebug(nDebug)
CLOSE ALL
SET DEFA TO
IF nTest = 103 .AND. lVer20
XSample_103()
ELSEIF nTest = 104 .AND. lVer20
XSample_104()
ELSEIF nTest = 105 .AND. lVer20
XSample_105()
ELSEIF nTest = 106 .AND. lVer20
XSample_106()
ELSEIF nTest = 107 .AND. lVer20
XSample_107()
ELSEIF nTest = 108 .AND. lVer20
XSample_108()
ELSEIF nTest = 109 .AND. lVer20
XSample_109()
ELSEIF nTest = 110 .AND. lVer20
XSample_110()
ELSEIF nTest = 111 .AND. lVer20
XSample_111()
ELSEIF nTest = 112 .AND. lVer20
XSample_112()
ELSEIF nTest = 113 .AND. lVer20
XSample_113()
ELSEIF nTest = 114 .AND. lVer20
XSample_114()
ELSEIF nTest = 115 .AND. lVer20
XSample_115()
ELSEIF nTest = 116 .AND. lVer20
XSample_116()
ELSEIF nTest = 117 .AND. lVer20
XSample_117()
ELSEIF nTest = 118 .AND. lVer20
XSample_118()
ELSEIF nTest = 119 .AND. lVer20
XSample_119()
ELSEIF nTest = 120
XSample_120()
ELSEIF nTest = 121
XSample_121()
ELSEIF nTest = 122 .AND. lVer20
XSample_122()
ELSEIF nTest = 123
oThread := Thread():new()
oThread:start( {||XSample_123()} )
ELSEIF nTest = 124 .AND. lVer20
XSample_124()
ELSEIF nTest = 125
XSample_125()
ELSEIF nTest = 126
XSample_126()
ELSEIF nTest = 127
XSample_127()
ELSEIF nTest = 128
XSample_128()
ELSEIF nTest = 129
XSample_129()
ELSEIF nTest = 130
XSample_130()
ELSEIF nTest = 131
XSample_131()
ELSEIF nTest = 132
XSample_132()
ELSE
DC_WinAlert('This sample is available under eXPress++ 2.0 or later')
ENDIF
DC_ClearEvents()
RETURN nil
* ---------------------------- *
STATIC FUNCTION XSample_Header( nTest )
nTest += 102
IF nTest = 103
RETURN "DotPrompt 1"
ELSEIF nTest = 104
RETURN "DotPrompt 2"
ELSEIF nTest = 105
RETURN "DotPrompt 3"
ELSEIF nTest = 106
RETURN "Intepret 1"
ELSEIF nTest = 107
RETURN "Intepret 2"
ELSEIF nTest = 108
RETURN "Intepret 3"
ELSEIF nTest = 109
RETURN "Intepret 4"
ELSEIF nTest = 110
RETURN "ComplRun 1"
ELSEIF nTest = 111
RETURN "ComplRun 2"
ELSEIF nTest = 112
RETURN "ComplRun 3"
ELSEIF nTest = 113
RETURN "Pre-Proc 1"
ELSEIF nTest = 114
RETURN "Pre-Proc 2"
ELSEIF nTest = 115
RETURN "Pre-Proc 3"
ELSEIF nTest = 116
RETURN "ProgramMgr"
ELSEIF nTest = 117
RETURN "Menu 1"
ELSEIF nTest = 118
RETURN "Menu 2"
ELSEIF nTest = 119
RETURN "MenuEditor"
ELSEIF nTest = 120
RETURN "GUIMenuTo"
ELSEIF nTest = 121
RETURN "StatusBars"
ELSEIF nTest = 122
RETURN "WorkTree"
ELSEIF nTest = 123
RETURN "ShortCut"
ELSEIF nTest = 124
RETURN "Design 1"
ELSEIF nTest = 125
RETURN "GETFonts"
ELSEIF nTest = 126
RETURN "GrumpBrow"
ELSEIF nTest = 127
RETURN 'HiddenDialog'
ELSEIF nTest = 128
RETURN 'ToggleCells'
ELSEIF nTest = 129
RETURN 'OneToMany 1'
ELSEIF nTest = 130
RETURN 'OneToMany 2'
ELSEIF nTest = 131
RETURN 'OneToMany 3'
ELSEIF nTest = 132
RETURN 'StaticScroll'
ENDIF
RETURN ''
* ---------------------------- *
STATIC FUNCTION XSample_Color( nTest )
LOCAL lVer20
#ifdef EXPRESS20
lVer20 := .t.
#else
lVer20 := .f.
#endif
IF lVer20
RETURN GRA_CLR_BLACK
ENDIF
nTest += 102
IF nTest <= 119 .OR. nTest = 122 .OR. nTest = 124 .OR. nTest = 125
RETURN GRA_CLR_DARKGRAY
ENDIF
RETURN GRA_CLR_BLACK
* ---------------------------- *
STATIC FUNCTION XSample_103
/*
Demonstration of DC_Dot() # 1
*/
DC_Gui(.f.)
DC_Do('DC_Dot()')
DC_Gui(.t.)
RETURN nil
*** END OF EXAMPLE ***
* ---------------------------- *
STATIC FUNCTION XSample_104
/*
Demonstration of DC_Dot() # 2
*/
LOCAL GetList := {}, oBrowse
USE COLLECT ALIAS 'XCOLLECT' VIA DBFNTX
@ 1,0 DCSAY 'Press ALT_D for Dot Prompt' SAYSIZE 0 ;
COLOR GRA_CLR_BLUE FONT '12.Arial Bold'
@ 3,0 DCBROWSE oBrowse ALIAS 'XCOLLECT' SIZE 60,10
DCBROWSECOL FIELD XCOLLECT->descrip HEADER 'Description' PARENT oBrowse
DCBROWSECOL FIELD XCOLLECT->type HEADER 'Type' PARENT oBrowse
DCBROWSECOL FIELD XCOLLECT->sub_type HEADER 'Sub-Type' PARENT oBrowse
DCREAD GUI FIT BUTTONS DCGUI_BUTTON_OK ;
TITLE 'DC_Dot() Sample 2' MODAL
RETURN nil
*** END OF EXAMPLE ***
* ---------------------------- *
STATIC FUNCTION XSample_105
/*
Demonstration of DC_Dot() # 3
*/
LOCAL GetList := {}, oBrowse
USE COLLECT ALIAS 'XCOLLECT' VIA DBFNTX
@ 1,0 DCBROWSE oBrowse ALIAS 'XCOLLECT' SIZE 60,10
DCBROWSECOL FIELD XCOLLECT->descrip HEADER 'Description' ;
PARENT oBrowse WIDTH 20
DCBROWSECOL FIELD XCOLLECT->type HEADER 'Type' ;
PARENT oBrowse WIDTH 10
DCBROWSECOL FIELD XCOLLECT->sub_type HEADER 'Sub-Type' ;
PARENT oBrowse WIDTH 10
@ 12,0 DCPUSHBUTTON CAPTION '&Ok' SIZE 9,1.2 ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}
@ 12,11 DCPUSHBUTTON CAPTION '&Dot' SIZE 9,1.2 ;
ACTION {||DC_Do('DC_Dot()')}
DCREAD GUI FIT TITLE 'DC_Dot() Sample 3' MODAL
RETURN nil
*** END OF EXAMPLE ***
* ---------------------------- *
STATIC FUNCTION XSample_106
/*
Demonstration of Interpreter # 1
This example builds a dialog using eXPress++ commands
*/
LOCAL oAppWindow := SetAppWindow(DC_QoutWindow())
ERASE XSample.TXT
TEXT TO FILE XSample.TXT
SET ECHO ON
USE COLLECT ALIAS 'XCOLLECT' VIA DBFNTX
@ 1,0 DCBROWSE oBrowse ALIAS 'XCOLLECT' SIZE 60,10 ;
PRESENTATION DC_BrowPres()
DCBROWSECOL FIELD XCOLLECT->descrip HEADER 'Description' ;
PARENT oBrowse WIDTH 20
DCBROWSECOL FIELD XCOLLECT->type HEADER 'Type' ;
PARENT oBrowse WIDTH 10
DCBROWSECOL FIELD XCOLLECT->sub_type HEADER 'Sub-Type' ;
PARENT oBrowse WIDTH 10
@ 12,0 DCPUSHBUTTON CAPTION '&Ok' SIZE 9,1.2 ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}
@ 12,11 DCPUSHBUTTON CAPTION '&Dot' SIZE 9,1.2 ;
ACTION {||DC_Do('DC_Dot()')}
DCREAD GUI FIT TITLE 'DC_Interpret() Sample 1' MODAL
ENDTEXT
DC_Interpret(MemoRead('XSample.TXT'))
SetAppWindow(oAppWindow)
RETURN nil
*** END OF EXAMPLE ***
* ---------------------------- *
STATIC FUNCTION XSample_107
/*
Demonstration of Interpreter # 2
This example builds a dialog window using Xbase++ parts
*/
LOCAL oAppWindow := SetAppWindow(DC_QoutWindow())
ERASE XSample.TXT
TEXT TO FILE XSample.TXT
oDlg := XbpDialog():New(AppDeskTop(),,{50,50},{300,300})
oDlg:title := 'DC_Interpret() Sample 2'
oDlg:create()
oButton := XbpPushButton():new(oDlg:drawingArea,,{50,50},{100,25})
oButton:caption := 'Test'
oButton:activate := {||MsgBox('This is a Test')}
oButton:create()
DC_AppEvent()
oDlg:Destroy()
ENDTEXT
DC_Interpret(MemoRead('XSample.TXT'))
SetAppWindow(oAppWindow)
RETURN nil
*** END OF EXAMPLE ***
* ---------------------------- *
STATIC FUNCTION XSample_108
/*
Demonstration of Interpreter # 3
This example runs any program entered into a memo box.
*/
LOCAL GetList := {}, cInterpret
cInterpret := "DCMSGBOX 'This is a test' TIMEOUT 2" + Chr(13)+Chr(10)
@ 1,0 DCSAY 'Enter command(s) to Interpret' SAYSIZE 0 ;
COLOR GRA_CLR_BLUE FONT '12.Arial Bold'
@ 2,0 DCMULTILINE cInterpret SIZE 60,5 ;
FONT '10.Courier New' COMPATIBLE
@ 8,0 DCPUSHBUTTON CAPTION '&Exit' SIZE 10,1.2 ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}
@ 8,12 DCPUSHBUTTON CAPTION '&Interpret' SIZE 10,1.2 ;
TOOLTIP 'Run this program' ;
ACTION {||DC_GetRefresh(GetList), ;
DC_Interpret(cInterpret) }
DCREAD GUI FIT MODAL TITLE 'DC_Interpret() Sample #3'
RETURN nil
*** END OF EXAMPLE ***
* ---------------------------- *
STATIC FUNCTION XSample_109
/*
Demonstration of Interpreter # 4
This example runs any program entered into a memo box.
*/
LOCAL oAppWindow := SetAppWindow(DC_QoutWindow()), oAppFocus
oAppFocus := SetAppFocus(oAppWindow)
ERASE XSample.TXT
TEXT TO FILE XSample.TXT
GUI OFF
CLS
FOR i := 1 TO 20
? 'This is number', i
NEXT
WAIT
CLS
CLOSE ALL
USE COLLECT VIA DBFNTX
DO WHILE !Eof()
? descrip, type, sub_type
SKIP
ENDDO
WAIT
CLS
ENDTEXT
DC_Interpret(MemoRead('XSAMPLE.TXT'))
SetAppWindow(oAppWindow)
SetAppFocus(oAppFocus)
GUI ON
DCMSGBOX 'Done!'
RETURN nil
*** END OF EXAMPLE ***
* ---------------------------- *
STATIC FUNCTION XSample_110
/*
Demonstration of Compile and Run # 1
This example will compile and run a pre-defined
program dynamically.
*/
LOCAL lOk, oAppWindow := SetAppWindow(DC_QoutWindow())
ERASE XSample.PRG
TEXT TO FILE XSample.PRG
#include "dcdialog.ch"
FUNCTION XSample_Run
LOCAL GetList := {}
@ 0,0 DCSAY 'This dialog was created by saving some text' SAYSIZE 0
@ 1,0 DCSAY 'to a file named XSAMPLE.PRG, then compiling' SAYSIZE 0
@ 2,0 DCSAY 'it to XSAMPLE.OBJ with DC_COMPILE(), then' SAYSIZE 0
@ 3,0 DCSAY 'loading the compiled object dynamically with' SAYSIZE 0
@ 4,0 DCSAY 'DC_OBJLOAD() and running the function XSAMPLE_RUN()' SAYSIZE 0
DCREAD GUI FIT BUTTONS DCGUI_BUTTON_OK MODAL ;
TITLE 'Compile/Run Example' TO lOk
RETURN lOk
ENDTEXT
SetAppWindow(oAppWindow)
IF DC_Compile('XSAMPLE.PRG')
IF DC_ObjLoad('XSAMPLE')
lOk := DC_Do('XSample_Run()')
DC_MsgBox({lOk})
ELSE
DC_WinAlert('Cannot create XSAMPLE.DLL')
ENDIF
ELSE
DC_WinAlert('Cannot not compile XSAMPLE.PRG')
ENDIF
RETURN nil
*** END OF EXAMPLE ***
* ---------------------------- *
STATIC FUNCTION XSample_111
/*
Demonstration of Compile and Run # 2
This example will compile and run a user-defined
program dynamically.
*/
LOCAL GetList := {}, cFunction, cSource
cFunction := Pad('Testing()',30)
cSource := ;
'#include "dcdialog.ch"' + CRLF + ;
'FUNCTION Testing()' + CRLF + ;
'' + CRLF + ;
'LOCAL GetList := {}, dDate := Date()' + CRLF + ;
'@ 0,0 DCSAY "Enter Date" GET dDate POPUP {|d|DC_PopDate(d)}' + CRLF + ;
'DCREAD GUI FIT ADDBUTTONS ENTEREXIT MODAL TITLE "Testing"' + CRLF + ;
'' + CRLF + ;
'RETURN dDate' + CRLF
@ 1,0 DCSAY 'Function to Execute' GET cFunction SAYSIZE 0
@ 2,0 DCSAY 'Source Code:'
@ 3,0 DCMULTILINE cSource SIZE 80,15 FONT '8.Courier'
@20,0 DCPUSHBUTTON CAPTION 'Exit' SIZE 10,1.2 ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}
@20,12 DCPUSHBUTTON CAPTION 'Compile/Run' SIZE 10,1.2 ;
ACTION {||_XSample_111( cSource, cFunction ) }
DCREAD GUI FIT MODAL TITLE 'Compile/Run Example #2'
RETURN nil
* ------------------
STATIC FUNCTION _XSample_111( cSource, cFunction )
LOCAL xReturn
MemoWrit( 'XSAMPLE.PRG', cSource )
IF DC_Compile('XSAMPLE.PRG')
IF DC_ObjLoad('XSAMPLE')
xReturn := DC_Do(Alltrim(cFunction))
DC_MsgBox({xReturn})
ELSE
DC_WinAlert('Cannot create XSAMPLE.DLL')
ENDIF
ELSE
DC_WinAlert('Cannot not compile XSAMPLE.PRG')
ENDIF
RETURN nil
*** END OF EXAMPLE ***
* ---------------------------- *
STATIC FUNCTION XSample_112
/*
Demonstration of Compile and Run # 2
This example will show how to use the XPP and OBJ commands
at the dot prompt
*/
LOCAL lOk, GetList := {}, oDlg
ERASE XSample.PRG
TEXT TO FILE XSample.PRG
#include "dcdialog.ch"
FUNCTION XSample_Run
LOCAL GetList := {}
@ 0,0 DCSAY 'This dialog was created by saving some text' SAYSIZE 0
@ 1,0 DCSAY 'to a file named XSAMPLE.PRG, then compiling' SAYSIZE 0
@ 2,0 DCSAY 'it to XSAMPLE.OBJ with the XPP command, then' SAYSIZE 0
@ 3,0 DCSAY 'loading the compiled object dynamically with' SAYSIZE 0
@ 4,0 DCSAY 'OBJ command and running the function XSAMPLE_RUN()' SAYSIZE 0
DCREAD GUI FIT BUTTONS DCGUI_BUTTON_OK MODAL ;
TITLE 'Compile/Run Example' TO lOk
RETURN lOk
ENDTEXT
@ 2,0 DCSAY 'Enter the following commands at the Dot Prompt:' SAYSIZE 0
@ 4,0 DCSAY '. XPP XSAMPLE' FONT '10.Courier Bold' SAYSIZE 0
@ 5,0 DCSAY '. OBJ XSAMPLE' FONT '10.Courier Bold' SAYSIZE 0
@ 6,0 DCSAY '. XSample_Run()' FONT '10.Courier Bold' SAYSIZE 0
@ 7,0 DCSAY '. EXIT' FONT '10.Courier Bold' SAYSIZE 0
DCREAD GUI FIT PARENT @oDlg EXIT EVAL {|o|o:setPos({0,0})} ;
TITLE 'Instructions!!'
DC_Do('DC_Dot()')
oDlg:destroy()
RETURN nil
*** END OF EXAMPLE ***
* ---------------------------- *
STATIC FUNCTION XSample_113
/*
Demonstration of Runtime Pre-Processor # 1
This example will pre-process a set of commands
to their equivalent functions by using the
DC_TRANSLATE() function.
*/
LOCAL GetList := {}, cText := '', cCrLf := Chr(13)+Chr(10), ;
aCommands, i, j, aTokens, aFunctions, nRow, nFunction, ;
nCommands
cText += 'USE COLLECT NEW VIA DBFNTX' + cCrLf
cText += 'SET INDEX TO COLLECT1, COLLECT2' + cCrLf
cText += 'GO TOP' + cCrLf
cText += 'DO WHILE !Eof() .AND. Inkey() # K_ESC' + cCrLf
cText += ' ? COLLECT->descrip, COLLECT->type' + cCrLf
cText += ' SKIP' + cCrLf
cText += 'ENDDO' + cCrLf
aCommands := DC_TokenArray( cText, cCrLf )
nCommands := Len(aCommands) - 1
aFunctions := DC_Translate(cText)
@ 0,1 DCSAY 'Commands (Input):' FONT '12.Courier Bold' SAYSIZE 0
FOR nRow := 1 TO nCommands
@ nRow,1 DCSAY aCommands[nRow] SAYSIZE 95 FONT '8.Courier New Bold' ;
COLOR GRA_CLR_BLUE, GRA_CLR_WHITE
NEXT
@ nRow,1 DCSAY 'Functions (Output):' FONT '12.Courier Bold' ;
SAYSIZE 0
nRow++
nFunction := 1
FOR nFunction := 1 TO Len(aFunctions)
aTokens := DC_TokenArray(aFunctions[nFunction], cCrLf)
FOR j := 1 TO Len(aTokens)
@ nRow, 1 DCSAY aTokens[j] SAYSIZE 95 FONT '8.Courier New Bold' ;
COLOR GRA_CLR_BLUE, GRA_CLR_WHITE
nRow++
NEXT j
NEXT nFunction
DCREAD GUI FIT BUTTONS DCGUI_BUTTON_OK MODAL ;
TITLE 'Run-time Pre-Processor Example #1 (DC_Translate())'
RETURN nil
*** END OF EXAMPLE ***
* ---------------------------- *
STATIC FUNCTION XSample_114
/*
Demonstration of Runtime Pre-Processor # 2
*/
LOCAL GetList := {}, cCommand, oOutput, cStatements, cOutput, ;
GetOptions, cCrLf := Chr(13)+Chr(10)
cStatements := '#include "BOX.CH"' + cCrLf + '#define HANDLE 1234567'
cOutput := ''
cCommand := Pad('? B_DOUBLE, B_SINGLE, HANDLE',200)
@ 1,0 DCSAY 'Enter Preprocessor Statements:'
@ 2,0 DCMULTILINE cStatements SIZE 80, 4 FONT '8.Courier'
@ 6,0 DCSAY 'Enter a Command to Pre-Process:'
@ 7,0 DCGET cCommand GETSIZE 80 ;
LOSTFOCUS {||_XSample_114(cStatements,cCommand,oOutput)}
@ 8,0 DCSAY 'Pre-Processed Output:'
@ 9,0 DCMULTILINE cOutput SIZE 80,8 EDITPROTECT {||.t.} ;
FONT '8.Courier New' OBJECT oOutput
@18,0 DCPUSHBUTTON CAPTION '&Exit' SIZE 10,1.2 ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,Getlist)}
@18,12 DCPUSHBUTTON CAPTION '&Translate' SIZE 10,1.2 ;
ACTION {||_XSample_114(cStatements,cCommand,oOutput)}
DCGETOPTIONS HILITEGETS GRA_CLR_RED SAYLEFTBOTTOM
DCREAD GUI FIT MODAL TITLE 'Run-time Pre-Processor Example #2' ;
OPTIONS GetOptions
RETURN nil
* -----------------
STATIC FUNCTION _XSample_114( cStatements, cCommand, oOutput )
LOCAL nFunction, aTokens, j, cFunctions := '', aFunctions, ;
cCrLf := Chr(13)+Chr(10)
aFunctions := DC_Translate(cStatements + cCrlf + cCommand )
nFunction := 1
FOR nFunction := 1 TO Len(aFunctions)
aTokens := DC_TokenArray(aFunctions[nFunction], cCrLf)
FOR j := 1 TO Len(aTokens)
IF !Empty(aTokens[j]) .AND. Left(aTokens[j],1) # '#'
cFunctions += aTokens[j] + cCrLf
ENDIF
NEXT j
NEXT nFunction
oOutput:setData(cFunctions)
RETURN nil
*** END OF EXAMPLE ***
* ---------------------------- *
STATIC FUNCTION XSample_115
/*
Demonstration of Runtime Pre-Processor # 3
Not completed!
*/
RETURN nil
*** END OF EXAMPLE ***
* ---------------------------- *
STATIC FUNCTION XSample_116
/*
Run the Program Manager. This is a program
dictionary for incorporating interpretive
programs into an application.
*/
LOCAL GetList := {}, cProgram := Space(10)
@ 0,0 DCSAY 'Enter Program to Run' GET cProgram SAYSIZE 0 ;
POPUP {|c|DC_ProgPick(c)}
@ 2,0 DCPUSHBUTTON CAPTION '&Exit' SIZE 9,1.2 ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}
@ 2,11 DCPUSHBUTTON CAPTION '&Manager' SIZE 9,1.2 ;
TOOLTIP 'Run the Program Manager' ;
ACTION {||DC_ProgMaint()}
@ 2,22 DCPUSHBUTTON CAPTION '&Run' SIZE 9,1.2 ;
TOOLTIP 'Run the Selected Program' ;
ACTION {||DC_Program(cProgram)} WHEN {||!Empty(cProgram)}
DCREAD GUI FIT MODAL TITLE 'Program Manager Example'
RETURN nil
*** END OF EXAMPLE ***
* ---------------------------- *
STATIC FUNCTION XSample_117
/*
Demonstration of Runtime Menu system # 1
*/
LOCAL GetList := {}, oDialog, cMenu, oMemo, cMemo := ''
@ 1,1 DCSAY 'This example will load a menu from the Menu Dictionary' ;
SAYSIZE 0 FONT '12.Arial'
@ 2,1 DCSAY 'and write eXPress++ source code into the below memo.' ;
SAYSIZE 0 FONT '12.Arial'
@ 3,1 DCMULTILINE cMemo SIZE 90,15 OBJECT oMemo ;
FONT '8.Courier New'
@19,1 DCPUSHBUTTON CAPTION '&Exit' SIZE 12,1.2 ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}
@19,16 DCPUSHBUTTON CAPTION '&Pick Menu' SIZE 12,1.2 ;
ACTION {||cMenu := nil, _XSample_117(@cMenu,oMemo)}
@19,31 DCPUSHBUTTON CAPTION '&Menu Editor' SIZE 12,1.2 ;
ACTION {||DC_MenuEdit(@cMenu),_XSample_117(@cMenu,oMemo)}
DCREAD GUI FIT MODAL
RETURN nil
* ---------------
STATIC FUNCTION _XSample_117( cMenu, oMemo, lPick )
LOCAL aMenu, cSource
aMenu := DC_MenuLoad(@cMenu)
IF Valtype(aMenu) = 'A'
cSource := DC_MenuSource(aMenu)
oMemo:setData(cSource)
ENDIF
RETURN nil
*** END OF EXAMPLE ***
* ---------------------------- *
STATIC FUNCTION XSample_118
/*
Demonstration of Runtime Menu system # 2
*/
LOCAL GetList := {}, oDialog
@ 0,1 DCSAY ''
@ 2,1 DCSAY 'This example will install a menu at the top of this dialog' ;
SAYSIZE 0 FONT '12.Arial'
@ 3,1 DCSAY 'window. Select menu to install by clicking on Menu Button' ;
SAYSIZE 0 FONT '12.Arial'
@ 5,1 DCPUSHBUTTON CAPTION '&Exit' SIZE 9,1.2 ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}
@ 5,12 DCPUSHBUTTON CAPTION '&Menu' SIZE 9,1.2 ;
ACTION {||_XSample_118(oDialog)}
DCREAD GUI FIT MODAL PARENT @oDialog
RETURN nil
* ---------------
STATIC FUNCTION _XSample_118( oDialog )
LOCAL aMenu
aMenu := DC_MenuCompile(DC_MenuLoad())
IF Valtype(aMenu) = 'A'
DC_MenuOSys( aMenu, oDialog )
ENDIF
RETURN nil
*** END OF EXAMPLE ***
* ---------------------------- *
STATIC FUNCTION XSample_119
/*
Run the Menu Editor/Manager. This is a menu
dictionary for incorporating data-driven menus
into an application.
*/
LOCAL GetList := {}, cMenu := Space(10)
@ 0,0 DCSAY 'Enter Menu to Run' GET cMenu SAYSIZE 0 ;
POPUP {|c|DC_MenuPick(c)}
@ 2,0 DCPUSHBUTTON CAPTION '&Exit' SIZE 9,1.2 ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}
@ 2,11 DCPUSHBUTTON CAPTION '&Manager' SIZE 9,1.2 ;
TOOLTIP 'Run the Menu Editor/Manager' ;
ACTION {||DC_MenuEdit(cMenu)}
@ 2,22 DCPUSHBUTTON CAPTION '&Run' SIZE 9,1.2 ;
TOOLTIP 'Run the Selected Menu' ;
ACTION {||DC_MenuRun(cMenu)} WHEN {||!Empty(cMenu)}
DCREAD GUI FIT MODAL TITLE 'Menu Editor/Manager Example'
RETURN nil
*** END OF EXAMPLE ***
STATIC FUNCTION XSample_120()
/* This sample shows how to make a GUI replacement
for MENU TO style menus that has a better
look and feel */
LOCAL GetList := {}, aButtons, GetOptions, i, oStatic, oMsgBoxStatic, ;
oMsgBoxText, nTabGroup, nChoice := 0, nRow, aMenuItems
aMenuItems := { ;
{ 'Database','Open a New Database'}, ;
{ 'Index','Open a New Index File'}, ;
{ 'Pack Database','Remove all Deleted Records from current Database'}, ;
{ 'Customer Screen','Manage the Customer Database'}, ;
{ 'Invoice Screen','Manage the Invoice Database'}, ;
{ 'Exit','Quit the Program'} ;
}
@ 0,5 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX ;
OBJECT oStatic SIZE 51, (Len(aMenuItems)*1.4) + .2
aButtons := Array(Len(aMenuItems))
nRow := .1
FOR i := 1 TO Len(aMenuItems)
IF i = 1
nTabGroup := XBP_BEGIN_GROUP
ELSEIF i = Len(aMenuItems)
nTabGroup := XBP_END_GROUP
ELSE
nTabGroup := XBP_WITHIN_GROUP
ENDIF
@ nRow,.6 DCPUSHBUTTON CAPTION Pad(aMenuItems[i,1],35) SIZE 50,1.3 ;
ACTION _ActionBlock(i,@nChoice,GetList) ;
TOOLTIP aMenuItems[i,2] ;
FONT '10.Alaska Crt' ;
PARENT oStatic ;
ACCELKEY i + 48 ;
TABSTOP ;
TABGROUP nTabGroup ;
GOTFOCUS {|a,b,o|_Hilite(o,1)} ;
LOSTFOCUS {|a,b,o|_Hilite(o,2)} ;
OBJECT aButtons[i] ;
MESSAGE IIF( Empty(aMenuItems[i,2]),Chr(255),aMenuItems[i,2]) ;
INTO oMsgBoxText
nRow += 1.4
NEXT
@ nRow + 1,0 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX ;
OBJECT oMsgBoxStatic SIZE 60, 1.2
@ .1,5 DCSTATIC TYPE XBPSTATIC_TYPE_TEXT ;
PARENT oMsgBoxStatic ;
OBJECT oMsgBoxText ;
FONT '12.Arial Bold' ;
COLOR GRA_CLR_BLUE ;
SIZE 58, .9 ;
OPTIONS XBPSTATIC_TEXT_CENTER ;
EVAL {|o|DC_CenterObject(o,oMsgBoxStatic)}
DCGETOPTIONS NOTITLEBAR NOBUSY
DCREAD GUI FIT MODAL OPTIONS GetOptions ;
EVAL {||SetAppFocus(aButtons[1])}
DCMSGBOX 'You Chose Menu Selection #' + Alltrim(Str(nChoice))
RETURN nChoice
* -------------
STATIC FUNCTION _ActionBlock( i, nChoice, GetList )
RETURN {||nChoice := i, DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}
* --------------
STATIC FUNCTION _Hilite( o, nMode )
LOCAL oPS, nCol, nRow, nWidth, nHeight, aAttr[ GRA_AL_COUNT]
IF o:status() <= 0
RETURN nil
ENDIF
nCol := o:currentpos()[1]
nRow := o:currentpos()[2]
nWidth := o:currentsize()[1]
nHeight := o:currentsize()[2]
IF IsMethod(o:SetParent(),'LOCKPS')
oPS := o:setParent():lockPS()
ENDIF
IF nMode = 1
aAttr[ GRA_AL_COLOR ] := GRA_CLR_RED
ELSE
aAttr[ GRA_AL_COLOR ] := GRA_CLR_PALEGRAY
ENDIF
GraSetAttrLine( oPS, aAttr )
GraBox( oPS, {nCol-1,nRow-1}, {nCol+nWidth,nRow+nHeight}, GRA_OUTLINE )
IF Valtype(oPS) = 'O'
o:setParent():unlockPS(oPS)
ENDIF
RETURN nil
*** END OF EXAMPLE ***
* --------------------
STATIC FUNCTION XSample_121()
/* This is an example of how to use DCSTATUSBAR to create
locked status areas around the perimiter of a dialog window */
LOCAL GetList := {}, GetOptions, oMenuBar, oFileMenu, oToolBottom, ;
oDlg, oDrawingArea, oStatBottom, bReSize, oMsgBox, oProgress, ;
oMsgStatic, lTesting := .f., oInsStatic, oNumStatic, ;
oCapsStatic, oStatTop, oToolTop, oStatTop2, oToolTop2, ;
lHideStatus2 := .f., lHideStatus3 := .f., lHideStatus4 := .f., ;
lHideStatus5 := .f., oStatLeft1, oStatLeft2, oStatRight1, ;
oToolLeft1, oToolleft2, oToolRight1, oProgressStatic, ;
oStatRight2, oToolRight2, lHideStatus6 := .f., lHideStatus7 := .f.
DCMENUBAR oMenuBar
DCSUBMENU oFileMenu CAPTION 'File' ;
MESSAGE 'File Options' INTO oMsgBox ;
PARENT oMenuBar
DCMENUITEM CAPTION 'Browse' ;
MESSAGE 'Browse the Documentation Database' ;
INTO oMsgBox ;
PARENT oFileMenu ;
ACTION {|o|o:=Thread():new(), ;
o:start({||BrowseWindow(oDlg:drawingArea,oMsgBox,;
oProgress,@lTesting,GetList)}) }
DCMENUITEM CAPTION 'Exit' ;
MESSAGE 'Quit this Program' INTO oMsgBox ;
PARENT oFileMenu ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}
// Top Statusbar #1 with Toolbar
DCSTATUSBAR oStatTop HEIGHT 20 ALIGN DCGUI_ALIGN_TOP SPACING 0
@ 0,0 DCTOOLBAR oToolTop SIZE 400,20 BUTTONSIZE 100,20 ;
TYPE XBPSTATIC_TYPE_RAISEDBOX PARENT oStatTop PIXEL
DCADDBUTTON CAPTION 'Top ToolBar 2' ;
ACTION {||lHideStatus2 := !lHideStatus2, ;
DC_GetRefresh(GetList), ;
DC_StatusBarRePaint(oDlg)} ;
PARENT oToolTop PIXEL
DCADDBUTTON CAPTION 'Bottom StatusBar' ;
ACTION {||lHideStatus3 := !lHideStatus3, ;
DC_GetRefresh(GetList), ;
DC_StatusBarRePaint(oDlg)} ;
PARENT oToolTop PIXEL
DCADDBUTTON CAPTION 'Left ToolBar #1' ;
ACTION {||lHideStatus4 := !lHideStatus4, ;
DC_GetRefresh(GetList), ;
DC_StatusBarRePaint(oDlg)} ;
PARENT oToolTop PIXEL
DCADDBUTTON CAPTION 'Left ToolBar #2' ;
ACTION {||lHideStatus5 := !lHideStatus5, ;
DC_GetRefresh(GetList), ;
DC_StatusBarRePaint(oDlg)} ;
PARENT oToolTop PIXEL
DCADDBUTTON CAPTION 'Right ToolBar #1' ;
ACTION {||lHideStatus6 := !lHideStatus6, ;
DC_GetRefresh(GetList), ;
DC_StatusBarRePaint(oDlg)} ;
PARENT oToolTop PIXEL
DCADDBUTTON CAPTION 'Right ToolBar #2' ;
ACTION {||lHideStatus7 := !lHideStatus7, ;
DC_GetRefresh(GetList), ;
DC_StatusBarRePaint(oDlg)} ;
PARENT oToolTop PIXEL
// Top Statusbar #2 (Hideable) with toolbar
DCSTATUSBAR oStatTop2 HEIGHT 20 ALIGN DCGUI_ALIGN_TOP ;
HIDE {||lHideStatus2}
@ 0,0 DCTOOLBAR oToolTop2 SIZE 400,20 BUTTONSIZE 50,20 ;
TYPE XBPSTATIC_TYPE_RAISEDBOX PARENT oStatTop2 PIXEL
DCADDBUTTON CAPTION 'Button4' ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)} ;
PARENT oToolTop2 PIXEL
DCADDBUTTON CAPTION 'Button5' ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)} ;
PARENT oToolTop2 PIXEL
DCADDBUTTON CAPTION 'Button6' ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)} ;
PARENT oToolTop2 PIXEL
// Bottom Statusbar (Hideable) with message, scrollbar, buttons, key status
DCSTATUSBAR oStatBottom HEIGHT 28 ALIGN DCGUI_ALIGN_BOTTOM ;
HIDE {||lHideStatus3}
@ 3,0 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX ;
SIZE 300,20 ;
PARENT oStatBottom PIXEL OBJECT oMsgStatic
@ 2,2 DCMESSAGEBOX TYPE XBPSTATIC_TYPE_TEXT ;
SIZE 300,20 MOTION ;
COLOR GRA_CLR_BLUE, GRA_CLR_BACKGROUND ;
OBJECT oMsgBox PARENT oMsgStatic PIXEL
@ 3,0 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX ;
OBJECT oProgressStatic ;
SIZE 100,20 PARENT oStatBottom PIXEL
@ 2,3 DCPROGRESS oProgress ;
COLOR GRA_CLR_DARKRED, GRA_CLR_BACKGROUND ;
TYPE XBPSTATIC_TYPE_TEXT ;
SIZE 96,16 PARENT oProgressStatic PIXEL
@ 3,0 DCTOOLBAR oToolBottom SIZE 126,20 BUTTONSIZE 40,20 ;
TYPE XBPSTATIC_TYPE_RECESSEDBOX PARENT oStatBottom PIXEL
DCADDBUTTON CAPTION '&Exit' ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)} ;
PARENT oToolBottom PIXEL
DCADDBUTTON TYPE XBPSTATIC_TYPE_RAISEDBOX SIZE 3,22 ;
PARENT oToolBottom PIXEL
DCADDBUTTON CAPTION '&Cancel' ;
ACTION {||lTesting := .f.} ;
WHEN {||lTesting} ;
PARENT oToolBottom PIXEL
DCADDBUTTON TYPE XBPSTATIC_TYPE_RAISEDBOX SIZE 3,22 ;
PARENT oToolBottom PIXEL
DCADDBUTTON CAPTION '&Browse' ;
PARENT oToolBottom ;
ACTION {|o|o:=Thread():new(), ;
o:start({||BrowseWindow(oDlg:drawingArea,oMsgBox:ChildList()[1], ;
oProgress,@lTesting,GetList)}) } ;
PIXEL
@ 3,0 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX ;
SIZE 30,20 PARENT oStatBottom PIXEL OBJECT oCapsStatic
@ 1,1 DCSAY '' PARENT oCapsStatic ID 'CAPSLOCK' ;
SAYSIZE 28,18 SAYCENTER PIXEL
@ 3,0 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX ;
SIZE 30,20 PARENT oStatBottom PIXEL OBJECT oNumStatic
@ 1,1 DCSAY '' PARENT oNumStatic ID 'NUMLOCK' ;
SAYSIZE 28,18 SAYCENTER PIXEL
@ 3,0 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX ;
SIZE 30,20 PARENT oStatBottom PIXEL OBJECT oInsStatic
@ 1,1 DCSAY '' PARENT oInsStatic ID 'INSERT' ;
SAYSIZE 28,18 SAYCENTER PIXEL
// Left Statusbar #1 (Hideable) with toolbar
DCSTATUSBAR oStatLeft1 WIDTH 45 ALIGN DCGUI_ALIGN_LEFT ;
HIDE {||lHideStatus4} TYPE XBPSTATIC_TYPE_TEXT
@ 0,0 DCTOOLBAR oToolLeft1 SIZE 45,1000 BUTTONSIZE 45,20 ;
TYPE XBPSTATIC_TYPE_RAISEDBOX PARENT oStatLeft1 PIXEL
DCADDBUTTON CAPTION '1-Test1' PARENT oToolLeft1 PIXEL
DCADDBUTTON CAPTION '1-Test2' PARENT oToolLeft1 PIXEL
DCADDBUTTON CAPTION '1-Test3' PARENT oToolLeft1 PIXEL
DCADDBUTTON CAPTION '1-Test4' PARENT oToolLeft1 PIXEL
// Left Statusbar #2 (Hideable) with toolbar
DCSTATUSBAR oStatLeft2 WIDTH 45 ALIGN DCGUI_ALIGN_LEFT ;
HIDE {||lHideStatus5} TYPE XBPSTATIC_TYPE_TEXT
@ 0,0 DCTOOLBAR oToolLeft2 SIZE 45,1000 BUTTONSIZE 45,20 ;
TYPE XBPSTATIC_TYPE_RAISEDBOX PARENT oStatLeft2 PIXEL
DCADDBUTTON CAPTION '2-Test1' PARENT oToolLeft2 PIXEL
DCADDBUTTON CAPTION '2-Test2' PARENT oToolLeft2 PIXEL
DCADDBUTTON CAPTION '2-Test3' PARENT oToolLeft2 PIXEL
DCADDBUTTON CAPTION '2-Test4' PARENT oToolLeft2 PIXEL
// Right Statusbar #1 (Hideable) with toolbar
DCSTATUSBAR oStatRight1 WIDTH 30 ALIGN DCGUI_ALIGN_RIGHT ;
HIDE {||lHideStatus6} TYPE XBPSTATIC_TYPE_TEXT
@ 0,0 DCTOOLBAR oToolRight1 SIZE 30,1000 BUTTONSIZE 30,25 ;
TYPE XBPSTATIC_TYPE_RAISEDBOX PARENT oStatRight1 PIXEL
DCADDBUTTON CAPTION BITMAP_EXECUTE_M PARENT oToolRight1 PIXEL
DCADDBUTTON CAPTION BITMAP_UNDO_M PARENT oToolRight1 PIXEL
DCADDBUTTON CAPTION BITMAP_REDO_M PARENT oToolRight1 PIXEL
DCADDBUTTON CAPTION BITMAP_BOLD_M PARENT oToolRight1 PIXEL
DCADDBUTTON CAPTION BITMAP_ITALIC_M PARENT oToolRight1 PIXEL
DCADDBUTTON CAPTION BITMAP_UNDERLINE_M PARENT oToolRight1 PIXEL
DCADDBUTTON CAPTION BITMAP_CODEWRITE_M PARENT oToolRight1 PIXEL
DCADDBUTTON CAPTION BITMAP_CONFIG_M PARENT oToolRight1 PIXEL
DCADDBUTTON CAPTION BITMAP_DESIGN_M PARENT oToolRight1 PIXEL
DCADDBUTTON CAPTION BITMAP_COMMENT_M PARENT oToolRight1 PIXEL
// Right Statusbar #2 (Hideable) with toolbar
DCSTATUSBAR oStatRight2 WIDTH 30 ALIGN DCGUI_ALIGN_RIGHT ;
HIDE {||lHideStatus7} TYPE XBPSTATIC_TYPE_TEXT
@ 0,0 DCTOOLBAR oToolRight2 SIZE 30,1000 BUTTONSIZE 30,25 ;
TYPE XBPSTATIC_TYPE_RAISEDBOX PARENT oStatRight2 PIXEL
DCADDBUTTON CAPTION BITMAP_BROWSER_M PARENT oToolRight2 PIXEL
DCADDBUTTON CAPTION BITMAP_CHECKBOX_M PARENT oToolRight2 PIXEL
DCADDBUTTON CAPTION BITMAP_LISTBOX_M PARENT oToolRight2 PIXEL
DCADDBUTTON CAPTION BITMAP_DIALOG_M PARENT oToolRight2 PIXEL
DCADDBUTTON CAPTION BITMAP_EDIT_M PARENT oToolRight2 PIXEL
DCADDBUTTON CAPTION BITMAP_SPINBUTTON_M PARENT oToolRight2 PIXEL
DCADDBUTTON CAPTION BITMAP_MLE_M PARENT oToolRight2 PIXEL
DCADDBUTTON CAPTION BITMAP_GET_M PARENT oToolRight2 PIXEL
DCHOTKEY xbeK_INS ACTION {||ReadInsert(!ReadInsert())}
DCGETOPTIONS WINDOWWIDTH 610 ;
WINDOWHEIGHT 400
DCREAD GUI OPTIONS GetOptions ;
PARENT @oDlg ;
TITLE 'Status Bar Example' ;
EVAL {|o|SetTimerEvent(100,{||_UpdateStats(GetList)}) }
SetTimerEvent(0)
RETURN nil
* ------------------
STATIC FUNCTION _UpdateStats( GetList )
LOCAL oCapsLock := DC_GetObject(GetList,'CAPSLOCK')
LOCAL oNumLock := DC_GetObject(GetList,'NUMLOCK')
LOCAL oInsert := DC_GetObject(GetList,'INSERT')
LOCAL lCaps := AppKeystate( VK_CAPITAL, .T. )
LOCAL lNum := AppKeystate( VK_NUMLOCK, .T. )
IF lNum == APPKEY_PRESSED
oNumlock:SetCaption( "Num" )
ELSE
oNumlock:SetCaption( "" )
ENDIF
IF lCaps == APPKEY_PRESSED
oCapslock:SetCaption( "Caps" )
ELSE
oCapslock:SetCaption( "" )
ENDIF
IF ReadInsert()
oInsert:SetCaption( "Ins" )
ELSE
oInsert:SetCaption( "Ovr" )
ENDIF
RETURN nil
* ------------
STATIC FUNCTION BrowseWindow( oDlg, oMsgBox, oProgress, ;
lTesting, aMainGetList )
LOCAL GetList := {}, oBrowse, GetOptions
IF !File('..\XDOC\EXPRESS.DBF')
DC_MsgBox({'Sorry. The database required to show this feature',;
'is not included in the demonstration version', ;
'or the ..\XDOC\EXPRESS.DBF file does not exist'})
RETURN nil
ENDIF
SET DEFA TO ..\XDOC
USE EXPRESS VIA FOXCDX SHARED ALIAS 'XDOC'
SET INDEX TO EXPRESS.CDX
OrdSetFocus('COMMAND')
SET DEFA TO
@ 0,0 DCSAY ''
@ 1,0 DCBROWSE oBrowse ALIAS 'XDOC' SIZE 50, 8
DCBROWSECOL DATA {||XDOC->command} HEADER 'Command' ;
PARENT oBrowse ;
MESSAGE 'This is the Command, Function or Class' ;
INTO oMsgBox
DCBROWSECOL DATA {||XDOC->short} HEADER 'Short' ;
PARENT oBrowse ;
MESSAGE 'This is the Short Description' ;
INTO oMsgBox
DCBROWSECOL DATA {||XDOC->type} HEADER 'Type' ;
PARENT oBrowse ;
MESSAGE 'This is the Type of Help Item' ;
INTO oMsgBox
DCBROWSECOL DATA {||XDOC->module} HEADER 'Module' ;
PARENT oBrowse ;
MESSAGE 'This is the name of the Module containing this item' ;
INTO oMsgBox
DCBROWSECOL DATA {||XDOC->see_also} HEADER 'See Also' ;
PARENT oBrowse ;
MESSAGE 'This is a list of related items' ;
INTO oMsgBox
@ 9.5,40 DCPUSHBUTTON CAPTION 'Test' SIZE 10,1.2 ;
TOOLTIP 'Test all the records in the database' ;
WHEN {||!lTesting} ;
TITLE 'eXPress++ Documentation' ;
ACTION {||_TestRecords(oMsgBox,oProgress,@lTesting,aMainGetList)}
DCHOTKEY xbeK_INS ACTION {||ReadInsert(!ReadInsert())}
DCGETOPTIONS AUTORESIZE
DCREAD GUI FIT ;
OPTIONS GetOptions ;
APPWINDOW oDlg ;
TITLE 'eXPress++ Help File'
RETURN nil
* -------------
STATIC FUNCTION _TestRecords( oMsgBox, oProgress, lTesting, aMainGetList )
LOCAL nRecNo := RecNo(), nCount
lTesting := .t.
DC_GetRefresh(aMainGetList)
oMsgBox:setCaption('Test in Progress...')
GO TOP
nCount := 0
DO WHILE !Eof() .AND. lTesting
DC_AppEvent(@lTesting,0,.01)
DC_GetProgress( oProgress, nCount++, RecCount() )
Sleep(1)
// .. put test code here
SKIP
ENDDO
oMsgBox:setCaption('Test Completed! No Errors!')
DC_GetProgress( oProgress, -1, 0 ) // Clear progress box
GO nRecNo
lTesting := .f.
DC_GetRefresh(aMainGetList)
RETURN nil
*** END OF EXAMPLE ***
* ----------------
STATIC FUNCTION XSample_122()
/* This example shows how to use DC_WorkTree() to display
a Tree-View browse of all open work areas */
dbeSetDefault('DBFNTX')
USE CUSTOMER INDEX CUSTOMER
USE INVOICE INDEX INVOICE NEW
SET RELATION TO INVOICE->cust_nmbr INTO customer
USE INVITEMS INDEX INVITEMS NEW
SET RELATION TO INVITEMS->inv_nmbr INTO invoice
IF File('..\XDOC\EXPRESS.DBF')
SET DEFA TO ..\XDOC
USE EXPRESS VIA FOXCDX SHARED ALIAS 'XDOC' NEW
SET INDEX TO EXPRESS.CDX
SET DEFA TO
ENDIF
DC_WorkTree()
RETURN nil
*** END OF EXAMPLE ***
* ----------------
STATIC FUNCTION XSample_123()
/* This is an example of a Shortcut Bar that can be
anchored to the top or bottom of the DeskTop.
This function may be started in another thread. */
LOCAL GetList := {}, oToolBar, GetOptions, oSay, oSubMenu, ;
oShortCut, bRbDown
bRbDown := {|a,b,o|oSubMenu:PopUp(o, a, 2, ;
XBPMENU_PU_DEFAULT + XBPMENU_PU_MOUSE_RBDOWN ) }
@ 2,2 DCTOOLBAR oToolBar TYPE XBPSTATIC_TYPE_TEXT SIZE 9*20,20 ;
BUTTONSIZE 20,20 PIXEL
DCSETPARENT TO oToolBar
DCADDBUTTON CAPTION '1' FONT '12.Arial Bold' ;
ACTION {||MsgBox('Button 1 pressed')} PIXEL ;
TOOLTIP 'Run Program #1'
DCADDBUTTON CAPTION '2' FONT '12.Arial Bold' ;
ACTION {||MsgBox('Button 2 pressed')} PIXEL ;
TOOLTIP 'Run Program #1'
DCADDBUTTON CAPTION '3' FONT '12.Arial Bold' ;
ACTION {||MsgBox('Button 3 pressed')} PIXEL ;
TOOLTIP 'Run Program #1'
DCADDBUTTON CAPTION '4' FONT '12.Arial Bold' ;
ACTION {||MsgBox('Button 4 pressed')} PIXEL ;
TOOLTIP 'Run Program #1'
DCADDBUTTON CAPTION '5' FONT '12.Arial Bold' ;
ACTION {||MsgBox('Button 5 pressed')} PIXEL ;
TOOLTIP 'Run Program #1'
DCADDBUTTON CAPTION '6' FONT '12.Arial Bold' ;
ACTION {||MsgBox('Button 6 pressed')} PIXEL ;
TOOLTIP 'Run Program #1'
DCADDBUTTON CAPTION '7' FONT '12.Arial Bold' ;
ACTION {||MsgBox('Button 6 pressed')} PIXEL ;
TOOLTIP 'Run Program #1'
DCADDBUTTON TYPE XBPSTATIC_TYPE_TEXT PIXEL SIZE 20,20
DCADDBUTTON CAPTION 'X' FONT '12.Arial Bold' ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)} PIXEL ;
TOOLTIP 'Close this ShortCut Bar'
DCSETPARENT TO
DCSUBMENU oSubMenu
DCMENUITEM CAPTION 'Top' PARENT oSubMenu ;
ACTION {||oShortCut:setPos({0,AppDesktop():currentSize()[2] - ;
oShortCut:currentSize()[2]}) }
DCMENUITEM CAPTION 'Bottom' PARENT oSubMenu ;
ACTION {||oShortCut:setPos({0,0}) }
@ 2, 9*20 + 20 DCSAY 'My ShortCut Bar' OBJECT oSay ;
COLOR GRA_CLR_BLUE FONT '12.Arial Italic' SAYSIZE 0 PIXEL ;
TOOLTIP 'Right-Click for Menu' ;
EVAL {|o|o:rbDown := bRbDown}
DCGETOPTIONS ;
WINDOWWIDTH AppDesktop():currentSize()[1] ;
WINDOWHEIGHT 30 ;
NOTRANSLATE ;
HIDE ;
NOESCAPEKEY ;
NOTITLEBAR ;
TOOLTIPCOLOR GRA_CLR_BLACK, GRA_CLR_YELLOW
DCREAD GUI ;
TITLE 'ShortCut Bar' ;
PARENT @oShortCut ;
OPTIONS GetOptions ;
EVAL {|o| o:setPos({0,AppDesktop():currentSize()[2] - ;
o:currentSize()[2]}), ;
o:drawingArea:rbDown := bRbDown, ;
o:show()}
RETURN nil
*** END OF EXAMPLE ***
* ----------------
STATIC FUNCTION XSample_124()
/* This sample shows how to use the built-in design
features to move and size objects and update the
the original source code */
LOCAL lOk, cText := '', GetList := {}, cCrLf := Chr(13)+Chr(10), ;
GetOptions
cText += '#include "dcdialog.ch"' + cCrLf
cText += '#include "appevent.ch"' + cCrLf
cText += 'FUNCTION XSample_Test()' + cCrLf
cText += 'LOCAL cMemo1 := "", cMemo2 := "", GetList :={}, GetOptions, lOk' + cCrLf
cText += "@ 0,0 DCSAY 'This dialog was created by saving some text'" + cCrLf
cText += "@ 1,0 DCSAY 'to a file named XSAMPLE.PRG, then compiling it'" + cCrLf
cText += "@ 2,0 DCSAY 'and loading it with DC_COMPILE() / DC_OBJLOAD().'" + cCrLf
cText += "@ 3,0 DCSAY 'Press the ALT-D key to enable design mode, then'" + cCrLf
cText += "@ 4,0 DCSAY 'move/size objects, press ESCAPE and save changes.'" + cCrLf
cText += "@ 6,0 DCMULTILINE cMemo1 SIZE 30,6" + cCrLf
cText += "@ 6,40 DCMULTILINE cMemo2 SIZE 30,6" + cCrLf
cText += cCrLf
cText += "DCGETOPTIONS DESIGN HOTKEY xbeK_ALT_D SOURCECODE 'XSAMPLE.PRG'" +cCrLf
cText += "DCREAD GUI FIT ADDBUTTONS MODAL ;" + cCrLf
cText += " OPTIONS GetOptions TITLE 'Design' TO lOk" + cCrLf
cText += "RETURN lOk" + cCrLf
MemoWrit('XSAMPLE.PRG',cText)
@ 0,0 DCSAY 'Clicking on RUN will run the below code with the interpreter.'
@ 1,0 DCSAY 'When the dialog starts, press ALT-D to enable design mode,'
@ 2,0 DCSAY 'Then move and size some objects, press ESCAPE and save the'
@ 3,0 DCSAY 'source code. When you return to this dialog the updated source'
@ 4,0 DCSAY 'will be loaded into the source window.'
@ 6,0 DCMULTILINE cText SIZE 80,10 FONT '8.Courier' EDITPROTECT {||.t.}
@17,0 DCPUSHBUTTON CAPTION '&Exit' SIZE 9,1.2 ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}
@17,11 DCPUSHBUTTON CAPTION '&Run' SIZE 9,1.2 ;
ACTION {||DC_Compile('XSAMPLE'), ;
DC_ObjLoad('XSAMPLE'), ;
DC_Do('XSample_Test()'), ;
cText := MemoRead('XSAMPLE.PRG'), ;
DC_GetRefresh(GetList) }
DCGETOPTIONS SAYFONT '12.Arial' SAYWIDTH 0
DCREAD GUI FIT TO lOk MODAL TITLE 'Design Example #1' OPTIONS GetOptions
RETURN nil
*** END OF EXAMPLE ***
* -----------------
STATIC FUNCTION XSample_125()
/* This is an example of DCSAY..GETs with various size fonts
demonstrating how the GET window is automatically sized. */
LOCAL GetList := {}, GetOptions, dGet, cGet, nGet, lGet, cVar := Space(15)
dGet := Date()
nGet := 12345.67
cGet := '01234567890123456789'
@ 1,1 DCSAY 'Date - GETSIZE 10' GET dGet GETSIZE 10
@ 3,1 DCSAY 'Date' GET dGet
@ 5,1 DCSAY 'Date Large Font' GET dGet GETFONT '12.Courier'
@ 7,1 DCSAY 'Date Large Font' GET dGet GETFONT '12.Courier' ;
POPUP {|d|DC_PopDate(d)}
@ 8,1 DCSAY 'String - GETSIZE 10' GET cGet GETSIZE 10
@ 9,1 DCSAY 'String' GET cGet
@11,1 DCSAY 'String Large Font' GET cGet GETFONT '18.Alaska Crt'
@13,1 DCSAY 'Numeric - GETSIZE 10' GET nGet GETSIZE 10
@15,1 DCSAY 'Numeric' GET nGet PICT '99999.99'
@17,1 DCSAY 'Numeric Large Font' GET nGet GETFONT '14.Courier New Bold'
@19,1 DCSAY 'Numeric Large Font' GET nGet GETFONT '14.Courier New Bold' ;
POPUP {|n|DC_PopCalc(n)}
DC_GetPopupCaption({'12.Alaska Crt',BITMAP_PICKLIST,1})
DCGETOPTIONS SAYRIGHT SAYWIDTH 150
DCREAD GUI FIT ADDBUTTONS OPTIONS GetOptions
RETURN nil
*** END OF EXAMPLE ***
* -----------------
STATIC FUNCTION XSample_126()
/* This is an example of how to use the DCGRUMPBROW command.
DCGRUMPBROW is an emulation of Greg Lief's GrumpBrow for
Clipper */
LOCAL GetList := {}, cBrowForm := '', lOk, cScreen, aWidths, i
LOCAL cOptions := SPACE(14), xcName, xcIndex1, xcIndex2
LOCAL nRow, nCol, nCount := 0, lPackForm, oScreen
LOCAL aExitKeys := { K_ESC, K_ENTER } // Grumpbrow Exit Triggers
LOCAL aFormlary := ;
{'NDC','COMPANY','GENERIC','BRAND_NAME','CODE_NAME','FORM','MEMO', ;
'STRENGTH','PERM_REQD','CAL_QTY','CAL_AMT','CAL_DISCNT','PRICE_UNIT', ;
'EFF_DATE', 'OLD_PRICE1','EFF_DATE1','OLD_PRICE2','EFF_DATE2', ;
'OLD_PRICE3', 'EFF_DATE3','NDC_N'}
LOCAL ahFormlary := ;
{'NDC Number','Manufacturer Name','Generic Name','Brand Name', ;
'Drug Code', 'Form','Memo','Strength','Permission Required', ;
'Calculation Quantity', 'Calculation Amount','Calculation Discount %', ;
'Price per Unit', 'Effective Date','Old Price 1', ;
'Effective Date for Old Price 1','Old Price 2',;
'Effective Date for Old Price 2','Old Price 3', ;
'Effective Date for Old Price 3', 'Numeric NDC Number'}
LOCAL apFormlary := ;
{'@R 99999-9999-99','','','@! XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',;
'@! NNN','@! NNNNN','','','','','$9,999.99','99','$999.99999',;
'@D','$999.99999','@D','$999.99999','@D','$999.99999','@D'}
LOCAL aiFormlary:={'NDC','Generic Name'}
LOCAL aEditCoords := {}
nRow := 1
nCol := 0
FOR i := 1 TO Len(aFormlary)
AAdd( aEditCoords, { nRow, nCol, 18, ;
XBPSTATIC_TEXT_RIGHT + XBPSTATIC_TEXT_VCENTER, ;
nRow, nCol + 19, nil } )
nCol += 35
IF nCol > 40
nCol := 0
nRow++
ENDIF
NEXT
SET DELETED OFF
dbeSetDefault('DBFNTX')
xcName := "formlary"
xcIndex1 := 'FRM_NDC.NTX'
xcIndex2 := 'FRM_GENR.NTX'
USE (xcName) ALIAS FORMLARY EXCLUSIVE
IF !FILE(xcIndex1) .or. !FILE(xcIndex2)
oScreen := DC_WAITON('Building Formulary Index')
index on Formlary->NDC to (xcIndex1)
index on Formlary->GENERIC to (xcIndex2)
DC_Impl(oScreen)
ENDIF
SET INDEX TO (xcIndex1), (xcIndex2)
lOk := .t.
DC_Gui(.t.)
DO WHILE lOk
@ 0,0 DCSAY 'Enter DCGRUMPBROW Options' GET cOptions PICT '@!' ;
SAYSIZE 0 GETFONT '8.Courier Bold' SAYRIGHTCENTER
DCREAD GUI FIT ADDBUTTONS TO lOk ;
TITLE 'Options are A E D P Q S V N C K I L F O' ;
ENTEREXIT MODAL
IF !lOk
EXIT
ENDIF
Set Order to 1 // Alpha NDC #
DC_DbGoTop()
IF DC_RecLock(5)
DCGRUMPBROW TO cBrowForm ;
SECURITY cOptions TOP 8 BOTTOM 20 LEFT 2 RIGHT 77 ;
EXITKEY aExitKeys ;
TITLE 'Formulary Maintenance';
FIELDS aFormlary ;
HEADINGS ahFormlary ;
PICTURES apFormlary ;
EDITCOORDS aEditCoords ;
WIDTHS aWidths
DC_MsgBox('Current Record # '+STR(RECNO()))
If 'D' $ cBrowForm // If a Drug was Deleted, Set Pack Flag
lPackForm := .T.
ENDIF
UnLock
ELSE
DC_WinAlert("Unable to lock FORMLARY file")
ENDIF
ENDDO
RETURN nil
*** END OF EXAMPLE ***
* -----------------
STATIC FUNCTION XSample_127()
/* This example shows how to create a GUI memo window
that pops up by pressing ALT_M when in a table
of text-based Gets. */
LOCAL GetList := {}, cMemo := '', GetOptions, oDlg, oMemo, oCrt
DC_SetKeyActive(.t.)
@ 0,0 DCMULTILINE cMemo SIZE 50,15 OBJECT oMemo
@17,0 DCPUSHBUTTON CAPTION 'Hide' SIZE 9,1.2 ;
ACTION {||oDlg:Hide(),DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList), ;
SetAppFocus(oCrt)}
DCGETOPTIONS HIDE
DCREAD GUI FIT PARENT @oDlg OPTIONS GetOptions EXIT SAVE ;
TITLE 'Memo Editor. Press ALT-M to Hide'
SetKey(K_ALT_M, {|x|DC_ClearEvents(), ;
x:=oDlg:IsVisible(), ;
IIF(x,oDlg:hide(),oDlg:show()), ;
IIF(x,SetAppFocus(oCrt),SetAppFocus(oMemo)),;
IIF(x,DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList), ;
DC_ReadGuiEventLoop(GetList,,,oDlg)) } )
_XSample127( @oCrt )
oDlg:Destroy()
SetKey(K_ALT_M,nil)
RETURN nil
* --------------
STATIC PROCEDURE _XSample127( oCrt )
LOCAL GetList := {}, cName := Space(20), cCity := Space(20), ;
cState := Space(5), cStreet := Space(30), oAppWindow
oCrt := XbpCrt():New ( AppDeskTop(), NIL, { 0, 0 }, 25, 80 )
oCrt:FontWidth := 8
oCrt:FontHeight := 16
oCrt:title := 'Hybrid example, Hidden Dialog'
oCrt:create()
oCrt:presSpace()
oCrt:show()
oAppWindow := SetAppWindow(oCrt)
CLS
SET CURSOR ON
@ 1,1 SAY 'Press ALT-M to toggle display of Memo Editor'
@ 3,1 SAY ' Name' GET cName
@ 4,1 SAY 'Street' GET cStreet
@ 5,1 SAY ' City' GET cCity
@ 6,1 SAY ' State' GET cState
READ
SetAppWindow(oAppWindow)
oCrt:Destroy()
RETURN
*** END OF EXAMPLE ***
* -----------------
STATIC FUNCTION XSample_128()
/* This example shows how to create browse columns
that will toggle through a set of values when the
mouse is double-clicked on a cell */
LOCAL GetList := {}, oBrowse, aCondition, aForSale, bFieldBlock
aForSale := {'Yes','No','Maybe'}
aCondition := {'Mint','Excellent','Good','Fair','Poor'}
CLOSE ALL
USE COLLECT VIA DBFNTX EXCL
@ 0,0 DCBROWSE oBrowse SIZE 48,10 ALIAS 'COLLECT' ;
DATALINK {||_XSample128(oBrowse,aForSale,aCondition)} ;
PRESENTATION DC_BrowPres()
DCBROWSECOL FIELD COLLECT->descrip PARENT oBrowse HEADER 'Description'
bFieldBlock := {||aForSale[COLLECT->for_sale+1]}
DCBROWSECOL DATA bFieldBlock PARENT oBrowse HEADER 'For Sale?'
bFieldBlock := {|n|n:=Ascan(aCondition,COLLECT->condition), ;
IIF(n=0,'????',aCondition[n])}
DCBROWSECOL DATA bFieldBlock PARENT oBrowse HEADER 'Condition'
bFieldBlock := {||IIF( COLLECT->original,'Yes','No')}
DCBROWSECOL DATA bFieldBlock PARENT oBrowse HEADER 'Orig Owner?'
DCREAD GUI FIT ADDBUTTONS MODAL TITLE 'Toggling Test'
RETURN nil
* --------------
STATIC FUNCTION _XSample128( oBrowse, aForSale,aCondition )
LOCAL nFound
IF oBrowse:colPos == 2
COLLECT->for_sale++
IF COLLECT->for_sale > 2
COLLECT->for_sale := 0
ENDIF
ELSEIF oBrowse:colPos = 3
nFound := Ascan(aCondition,COLLECT->condition)
IF nFound = Len(aCondition) .OR. nFound = 0
COLLECT->condition := Substr(aCondition[1],1,1)
ELSE
COLLECT->condition := Substr(aCondition[nFound+1],1,1)
ENDIF
ELSEIF oBrowse:colPos = 4
COLLECT->original := !COLLECT->original
ENDIF
oBrowse:refreshCurrent()
RETURN nil
*** END OF EXAMPLE ***
* ---------------
FUNCTION XSample_129()
/* This example shows how to create a one-to-many
browse of two browse windows browsing arrays. */
LOCAL GetList := {}, aDirectory, aFiles, oBrowDirs, oBrowFiles, ;
nPointer := 1, bItemMarked
aDirectory := Directory('*.','D')
aFiles := {}
_Files( aDirectory, aFiles, 1 )
bItemMarked := {||_Files(aDirectory,aFiles,nPointer,oBrowFiles)}
@ 0,0 DCBROWSE oBrowDirs DATA aDirectory SIZE 30,10 ;
EVAL {|o|o:itemMarked := ;
DC_MergeBlocks(o:itemMarked,bItemMarked) } ;
POINTER nPointer ;
PRESENTATION DC_BrowPres()
DCBROWSECOL DATA {||DC_GetColArray(nil,oBrowDirs)[1]} ;
HEADER 'Directory' WIDTH 20 PARENT oBrowDirs
@ 0,35 DCBROWSE oBrowFiles DATA aFiles SIZE 30,10 ;
PRESENTATION DC_BrowPres()
DCBROWSECOL ELEMENT 1 HEADER 'File Name' WIDTH 20 PARENT oBrowFiles
DCREAD GUI FIT ADDBUTTONS TITLE 'One-to-Many Directory Browse' ;
EVAL {|o|SetAppWindow(o)}
RETURN nil
* -------------------
STATIC FUNCTION _Files( aDirectory, aFiles, nPointer, oBrowFiles )
LOCAL i, cDirectory, cCurPath := DC_CurPath()
cDirectory := aDirectory[nPointer,1]
DC_ChDir( Alltrim(cDirectory) )
aFiles := Directory( '*.*')
DC_ChDir( cCurPath )
IF Valtype(oBrowFiles) = 'O'
DC_GetBrowArray( oBrowFiles, aFiles )
oBrowFiles:refreshAll()
ENDIF
RETURN nil
*** END OF EXAMPLE ***
* ---------------
STATIC FUNCTION XSample_130()
/* This example shows how to create a 3-tiered, one-to-many
browse of three relational databases in one dialog window. */
LOCAL GetList := {}, GetOptions, oBrowCust, oBrowInv, oBrowItems, ;
bInv, bItems
dbeSetDefault('DBFNTX')
USE CUSTOMER INDEX CUSTOMER
USE INVOICE INDEX INVOICE NEW
USE INVITEMS INDEX INVITEMS NEW
bInv := {|| INVOICE->(DC_SetScope(0,CUSTOMER->cust_nmbr)), ;
INVOICE->(DC_SetScope(1,CUSTOMER->cust_nmbr)), ;
INVOICE->(DC_DbGoTop()), ;
oBrowInv:refreshAll() }
bItems := {|| INVITEMS->(DC_SetScope(0,INVOICE->inv_nmbr)), ;
INVITEMS->(DC_SetScope(1,INVOICE->inv_nmbr)), ;
INVITEMS->(DC_DbGoTop()), ;
oBrowItems:refreshAll() }
@ 1,0 DCBROWSE oBrowCust ALIAS 'CUSTOMER' SIZE 40,10 ;
PRESENTATION DC_BrowPres() ;
NOSOFTTRACK ;
SCOPE ;
NOHSCROLL ;
ITEMMARKED {|| Eval(bInv), ;
Eval(bItems), ;
DC_GetRefresh(GetList,, ;
DCGETREFRESH_TYPE_EXCLUDE,{GETLIST_BROWSE}) }
DCSETPARENT oBrowCust
DCBROWSECOL FIELD CUSTOMER->cust_nmbr HEADER 'Cust #' WIDTH 4
DCBROWSECOL FIELD CUSTOMER->bill_name HEADER 'Billing Name' WIDTH 18
DCSETPARENT TO
@ 1,42 DCSAY {||CUSTOMER->bill_name} COLOR GRA_CLR_BLUE SIZE 45
@ 2,42 DCSAY {||CUSTOMER->bill_strt} COLOR GRA_CLR_BLUE SIZE 45
@ 3,42 DCSAY {||CUSTOMER->bill_city} COLOR GRA_CLR_BLUE SIZE 45
@ 4,42 DCSAY {||CUSTOMER->bill_state} COLOR GRA_CLR_BLUE SIZE 5
@ 4,53 DCSAY {||CUSTOMER->bill_zip} COLOR GRA_CLR_BLUE SIZE 25
@ 5,42 DCSAY {||CUSTOMER->phone} COLOR GRA_CLR_BLUE SIZE 25
@ 6,42 DCSAY {||CUSTOMER->fax} COLOR GRA_CLR_BLUE SIZE 25
@ 7,42 DCSAY {||CUSTOMER->contact} COLOR GRA_CLR_BLUE SIZE 35
@12,0 DCBROWSE oBrowInv ALIAS 'INVOICE' SIZE 40,10 ;
PRESENTATION DC_BrowPres() ;
NOSOFTTRACK ;
SCOPE ;
ITEMMARKED bItems
DCSETPARENT oBrowInv
DCBROWSECOL FIELD INVOICE->inv_nmbr HEADER 'Invoice #' WIDTH 4
DCBROWSECOL FIELD INVOICE->ship_date HEADER 'Inv Date' WIDTH 8
DCBROWSECOL FIELD INVOICE->balance HEADER 'Balance' WIDTH 8
DCSETPARENT TO
@12,42 DCBROWSE oBrowItems ALIAS 'INVITEMS' SIZE 40,10 ;
PRESENTATION DC_BrowPres() ;
NOSOFTTRACK ;
SCOPE
DCSETPARENT oBrowItems
DCBROWSECOL FIELD INVITEMS->part_nmbr HEADER 'Part Nmbr' WIDTH 10
DCBROWSECOL FIELD INVITEMS->desc HEADER 'Description' WIDTH 10
DCBROWSECOL FIELD INVITEMS->qty_ord HEADER 'Ord' WIDTH 4
DCBROWSECOL FIELD INVITEMS->qty_shp HEADER 'Ship' WIDTH 4
DCGETOPTIONS SAYFONT '10.Helv Bold' TABSTOP AUTORESIZE
DCREAD GUI ;
FIT ;
ADDBUTTONS ;
OPTIONS GetOptions ;
MODAL ;
TITLE 'Customer/Invoice/Items Browse' ;
EVAL {|o|SetAppFocus(oBrowCust:GetColumn(1))}
RETURN nil
*** END OF EXAMPLE ***
* --------------
STATIC FUNCTION XSample_131()
/* This example shows how to create a 3-tiered, one-to-many
browse of three relational databases on separate tab pages. */
LOCAL GetList := {}, GetOptions, oBrowCust, oBrowInv, oBrowItems, ;
bInv, bItems, oTabPage1, oTabPage2, oTabPage3
dbeSetDefault('DBFNTX')
USE CUSTOMER INDEX CUSTOMER
USE INVOICE INDEX INVOICE NEW
USE INVITEMS INDEX INVITEMS NEW
bInv := {|| INVOICE->(DC_SetScope(0,CUSTOMER->cust_nmbr)), ;
INVOICE->(DC_SetScope(1,CUSTOMER->cust_nmbr)), ;
INVOICE->(DC_DbGoTop()), ;
oBrowInv:refreshAll() }
bItems := {|| INVITEMS->(DC_SetScope(0,INVOICE->inv_nmbr)), ;
INVITEMS->(DC_SetScope(1,INVOICE->inv_nmbr)), ;
INVITEMS->(DC_DbGoTop()), ;
oBrowItems:refreshAll() }
@ 0,0 DCTABPAGE oTabPage1 SIZE 85,15 CAPTION 'Customers'
@ 2,2 DCBROWSE oBrowCust ALIAS 'CUSTOMER' SIZE 40,12 ;
PRESENTATION DC_BrowPres() ;
NOSOFTTRACK ;
SCOPE ;
NOHSCROLL ;
PARENT oTabPage1 ;
EVAL {|o|o:itemMarked := ;
{|| Eval(bInv), ;
Eval(bItems), ;
DC_GetRefresh(GetList,, ;
DCGETREFRESH_TYPE_EXCLUDE,{GETLIST_BROWSE}) } }
DCSETPARENT oBrowCust
DCBROWSECOL FIELD CUSTOMER->cust_nmbr HEADER 'Cust #' WIDTH 4
DCBROWSECOL FIELD CUSTOMER->bill_name HEADER 'Billing Name' WIDTH 20
DCSETPARENT TO oTabPage1
@ 3,43 DCSAY {||CUSTOMER->bill_name} COLOR GRA_CLR_BLUE SIZE 40
@ 4,43 DCSAY {||CUSTOMER->bill_strt} COLOR GRA_CLR_BLUE SIZE 40
@ 5,43 DCSAY {||CUSTOMER->bill_city} COLOR GRA_CLR_BLUE SIZE 40
@ 6,43 DCSAY {||CUSTOMER->bill_state} COLOR GRA_CLR_BLUE SIZE 5
@ 6,54 DCSAY {||CUSTOMER->bill_zip} COLOR GRA_CLR_BLUE SIZE 20
@ 7,43 DCSAY {||CUSTOMER->phone} COLOR GRA_CLR_BLUE SIZE 20
@ 8,43 DCSAY {||CUSTOMER->fax} COLOR GRA_CLR_BLUE SIZE 20
@ 9,43 DCSAY {||CUSTOMER->contact} COLOR GRA_CLR_BLUE SIZE 30
DCSETPARENT TO
@ 0,0 DCTABPAGE oTabPage2 RELATIVE oTabPage1 CAPTION 'Invoices'
@ 2,2 DCSAY {||CUSTOMER->cust_nmbr + ' : ' + CUSTOMER->bill_name} ;
COLOR GRA_CLR_BLUE FONT '12.Helv Bold' ;
SIZE 70 ;
PARENT oTabPage2
@ 4,2 DCBROWSE oBrowInv ALIAS 'INVOICE' SIZE 75,10 ;
PRESENTATION DC_BrowPres() ;
NOSOFTTRACK ;
PARENT oTabPage2 ;
SCOPE ;
EVAL {|o|o:itemMarked := bItems }
DCSETPARENT oBrowInv
DCBROWSECOL FIELD INVOICE->inv_nmbr HEADER 'Invoice #' WIDTH 4
DCBROWSECOL FIELD INVOICE->ship_date HEADER 'Inv Date' WIDTH 8
DCBROWSECOL FIELD INVOICE->balance HEADER 'Balance' WIDTH 8
DCBROWSECOL FIELD INVOICE->po_nmbr HEADER 'P.O. #' WIDTH 8
DCBROWSECOL FIELD INVOICE->terms HEADER 'Terms' WIDTH 8
DCBROWSECOL FIELD INVOICE->how_ship HEADER 'How Ship' WIDTH 8
DCSETPARENT TO
@ 0,0 DCTABPAGE oTabPage3 RELATIVE oTabPage2 CAPTION 'Inv. Items'
@ 2,2 DCSAY {||CUSTOMER->cust_nmbr + ' : ' + CUSTOMER->bill_name + ' : ' + ;
INVOICE->inv_nmbr} ;
COLOR GRA_CLR_BLUE FONT '12.Helv Bold' ;
SIZE 70 ;
PARENT oTabPage3
@ 4,2 DCBROWSE oBrowItems ALIAS 'INVITEMS' SIZE 75,10 ;
PRESENTATION DC_BrowPres() ;
NOSOFTTRACK ;
SCOPE ;
PARENT oTabPage3
DCSETPARENT oBrowItems
DCBROWSECOL FIELD INVITEMS->part_nmbr HEADER 'Part Nmbr' WIDTH 10
DCBROWSECOL FIELD INVITEMS->desc HEADER 'Description' WIDTH 20
DCBROWSECOL FIELD INVITEMS->qty_ord HEADER 'Ord' WIDTH 4
DCBROWSECOL FIELD INVITEMS->qty_shp HEADER 'Ship' WIDTH 4
DCBROWSECOL FIELD INVITEMS->qty_bo HEADER 'B/O' WIDTH 4
DCBROWSECOL FIELD INVITEMS->u_issue HEADER 'U/I' WIDTH 3
DCBROWSECOL FIELD INVITEMS->u_price HEADER 'U/Price' WIDTH 6
DCGETOPTIONS SAYFONT '9.Helv Bold' TABSTOP AUTORESIZE
DCREAD GUI ;
FIT ;
ADDBUTTONS ;
OPTIONS GetOptions ;
MODAL ;
TITLE 'Customer/Invoice/Items Browse' ;
EVAL {|o|SetAppFocus(oBrowCust:GetColumn(1))}
RETURN nil
*** END OF EXAMPLE ***
* --------------
STATIC FUNCTION XSample_132()
/* This example shows how to create a scrolling
window using the VSCROLL and HSCROLL clauses
of the DCSTATIC command */
LOCAL GetList := {}, oStatic1, oStatic2, oStatic3, i, aGets[20]
@ 0,0 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX SIZE 40,10 OBJECT oStatic1
@ .5,1 DCSTATIC TYPE XBPSTATIC_TYPE_TEXT SIZE 38,9 OBJECT oStatic2
@ 1,1 DCSTATIC TYPE XBPSTATIC_TYPE_TEXT SIZE 70,25 OBJECT oStatic3 ;
PARENT oStatic2 ;
FONT '12.Alaska Crt' ;
VSCROLL oStatic1 RANGE 0,500 ;
HSCROLL oStatic1 RANGE 0,500
FOR i := 1 TO 20
aGets[i] := i
@ i-1,1 DCSAY Str(i,2) + ;
' This................is.................Get ' + ;
Str(i,2) GET aGets[i] PICT '99999' ;
SAYSIZE 0 PARENT oStatic3
NEXT
DCREAD GUI FIT ADDBUTTONS TITLE 'Scrolling a Static Window'
RETURN nil
*** END OF EXAMPLE ***
* ----------------
#ifndef EXPRESS20
// FUNCTION DC_Dot()
// RETURN nil
#endif
* ----------------
#ifndef EXPRESS20
FUNCTION DC_Interpret()
RETURN nil
#endif
* ----------------
#ifndef EXPRESS20
FUNCTION DC_MenuEdit()
RETURN nil
#endif
* ----------------
#ifndef EXPRESS20
FUNCTION DC_Compile()
RETURN nil
#endif
* ----------------
#ifndef EXPRESS20
FUNCTION DC_ObjLoad()
RETURN nil
#endif
* ----------------
#ifndef EXPRESS20
FUNCTION DC_Translate()
RETURN nil
#endif
* ----------------
#ifndef EXPRESS20
FUNCTION DC_ProgPick()
RETURN nil
#endif
* ----------------
#ifndef EXPRESS20
FUNCTION DC_MenuLoad()
RETURN nil
#endif
* ----------------
#ifndef EXPRESS20
FUNCTION DC_MenuSource()
RETURN nil
#endif
* ----------------
#ifndef EXPRESS20
FUNCTION DC_MenuPick()
RETURN nil
#endif
* ----------------
#ifndef EXPRESS20
FUNCTION DC_MenuRun()
RETURN nil
#endif
* ----------------
#ifndef EXPRESS20
FUNCTION DC_ProgMaint()
RETURN nil
#endif
* ----------------
#ifndef EXPRESS20
FUNCTION DC_Program()
RETURN nil
#endif
* ----------------
#ifndef EXPRESS20
FUNCTION DC_MenuCompile()
RETURN nil
#endif
* ----------------
#ifndef EXPRESS20
FUNCTION DC_WorkTree()
RETURN nil
#endif
* ----------------
#ifndef EXPRESS20
FUNCTION DC_ErrorGUI()
RETURN nil
#endif