records in a set of Scoped Records
dc_dbskipunique()....Skip to the next unique record
dc_dbstru()..........Display the structure of the selected database
dc_dbstruct()........Get the structure of a database in various formats
dc_dbstruw().........Display the structure of the selected database (wide format)
dc_dbu().............A Gui Database Management Utility
dc_debugbrowse().....Send debug information to a browse-style debugging window
dc_debugbrowseenable()Enable debugging with an environment variable
dc_debuglogfile()....Set the name of the Debug Log file.
dc_debuglogout().....Send debug information to a debugging log file
dc_debugqout().......Send debug information to a debugging window
dc_debugqoutappendblock()Post a codeblock for information to append to debug window
dc_debugwindowbrowsefont()Sets font for the debug window
dc_dec2hex().........Returns a hexidecimal number from a numeric value
dc_dec2longint().....Converts Long Integer (32 bits) to binary character
dc_delete()..........Mark record(s) for deletion
dc_dimscreen().......Dim and disable a screen or the entire desktop.
dc_dir().............Display a directory of files or databases
dc_dispbegin().......Begin buffering screen output
dc_dispclear().......Clear the screen output buffers
dc_dispend().........End buffering screen output
dc_dispmem().........Display the contents of a memory file or current memory
dc_dlllist().........List all loaded dynamic .DLLs
dc_dllload().........Load a dynamic .DLL
dc_dllunload().......UnLoad a dynamic .DLL
dc_do()..............A handy method of creating a late-binding call to a function
dc_docase()..........Evaluate a list of expressions based on a CASE condition
dc_dot().............A Dot-Prompt Interpreter
dc_dotdoskey().......Set DC_Dot() command stack operation to Dos-Key emulation
dc_dothotkey().......Set the Dot-Prompt hot key
dc_dotsize().........Set the size of the Dot-Prompt command stack
dc_dotvar()..........Returns a pointer to an array of passed info to DC_Dot()
dc_dowhile().........Evaluate a list of expressions based on a CASE condition
dc_drag()............Drag window coordinates and return a coordinate array
dc_drive2unc().......Returns a UNC from a mapped drive letter
dc_editconfig()......Edit a source file
dc_editcontrollastfocus()Returns last edit control that had focus
dc_editprg().........Edit a source file
dc_enabletabpagecolors()Get-Set function for enabling/disabling tab page colors
dc_enterexitmode()...Get/Set behavior of ENTEREXIT clause
dc_envirrest().......Restore the environment from an array or file
dc_envirsave().......Save the entire environment to an array or file
dc_eof().............Is the record pointer at the end of the file?
dc_erase()...........Delete a file
dc_error2string()....Converts an Error() object to a string
dc_errormsg()........Display an array of error messages in a window
dc_excel2array().....Create a 2-dimensional array from an Excel file
dc_expandtree()......Expand all nodes of a TreeView branch
dc_expl()............Explode a Text or GUI dialogue window
dc_explmode()........Enable/Disable exploding windows
dc_explode().........Explode a window
dc_expressbuttonstyle()Get or Set the default style for eXpress++ push buttons
dc_fancybuttonmode().Enable or disable FANCY pushbuttons
dc_fielddel()........Delete a field group from the field group dictionary
dc_fieldedit().......Field Dictionary Editor
dc_fieldload().......Load a field Group Array from the Field Dictionary
dc_fieldpick().......Choose a field group or browse the field group dictionary
dc_fieldsave().......Save a Field Group Array to the Field Dictionary
dc_fieldvalidate()...Validate a value in a field during data entry
dc_fieldwblock().....A replacement for FieldWBlock() for debugging
dc_fieldwdebug().....Enable debug window for Get/Set field code blocks
dc_filearray().......Capture work area(s) to a file definition array
dc_filecompare().....Compares the contents of two files
dc_filecopy()........Copy or move a set of files to a common location
dc_filedel().........Delete a file group from the DCFILES.DBF dictionary
dc_fileedit()........A Database File / Work area Definition editor
dc_fileimp().........Import File Group(s) from the Import File Dictionary
dc_fileload()........Load a file group array from the file dictionary
dc_filenamedupe()....Returns the next file name in a series
dc_filepik().........Pick a file (work-area) group from the file dictionary
dc_filerest()........Restore work areas, indexes, relations, from dictionary
dc_filesave()........Save Work area definition array to dictionary
dc_filock()..........Lock the current file
dc_find()............GUI dialog for finding a record using an index
dc_findbrowse()......A browse-window find utility that uses AutoSeek
dc_findbrowsesort()..Set Sort Header options for DC_FindBrowse()
dc_fontcompoundname()Return the Font Compound name from a font object
dc_fontconfigure()...Configure a Font object from a Compound Name
dc_formatmemotowidth()Format a memo to fit within a specified area
dc_fornext().........Evaluate a list of expressions in a FOR..NEXT loop
dc_getactive().......Return the currently active GET object
dc_getactiveinfo()...Return the currently active GET object
dc_getanchorcb().....Create a codeblock to anchor local variables to the GetList
dc_getbitmap().......Create a bitmap object from any source
dc_getbrowarray()....Get or Store an array pointer from/to Array Browse
dc_getcargo()........Get and/or set the cargo of an object
dc_getcolarray().....Get Column array information from a DCBROWSE array browse
dc_getcomboimmediate()Changes behavior of @ DCGET .. COMBO
dc_getcombomode()....Set mouse mode for @..DCGET..COMBO
dc_getdestroy()......Destroy all objects in the Dialog Getlist
dc_getdevout().......A Replacement for DevPos()/DevOut() when writing @SAY..GETS
dc_getdisplay()......Display a GET on the screen if it falls in scroll region
dc_gethelpcode().....Return the Help Code of an object
dc_gethotkeylist()...Retrieve a list of hotkeys that have been set
dc_getiddefault()....Assign a default ID based on field/memvar name
dc_getlistobject()...Return a pointer to the DC_GetList() object from a GetList Array
dc_getlisttype().....Return the "define" name of a Get Object from it's type
dc_getlistvalidate().Validate all objects in GetList
dc_getnetname()......Returns the Network name of the workstation
dc_getobject().......Return a pointer to an object from an ID name
dc_getobjectid().....Return a the ID of an object
dc_getoptdefault()...Set the Default options for the GUI Reader
dc_getorigset()......Set the original values of the Dialog items in the Getlist
dc_getorigupdated()..Test the original values of the Dialog items in the Getlist
dc_getpopupautohide()A Get-Set function for hiding un-focused POPUP buttons
dc_getpopupcaption().Set the default caption for the POPUP pushbutton
dc_getpopupprotecthide()A Get-Set function for hiding protected POPUP buttons
dc_getprogress().....Update a Progress bar object
dc_getproperty().....Return the value of a Getlist property from an object
dc_getreadinsert()...a Get-Set function for establishing default Insert mode
dc_getrefresh()......Refresh the display of all objects in the Get List
dc_getrefreshblock().Post a code block for debugging DC_GetRefresh() problems
dc_gettitlebarheight()Get the height of Dialog Title Bars
dc_getvalidate().....Run validation logic in the GetList
dc_getvalidateonchange()A Get-Set function to determine Validation rule
dc_getvalidblock()...A Get-Set function for posting a default validation block
dc_getwhen().........Refresh the WHEN/HIDE status of object(s) in the GetList
dc_getwhenonbrowseitemmarked()Get-set function that enable DC_GetWhen() on item marked event
dc_getworkarea().....Get the actual working area of the Desktop
dc_gotoget().........Go directly to a desired GET
dc_gra2color().......Convert GUI compatible color to a color string
dc_graquerytextbox().Get the width and height of a text string based on a font
dc_groupboxfix().....A Get-Set function used to fix group box problem on XP
dc_gui().............Set the Dialogue mode to GUI or TEXT
dc_guiabrowse()......Browse a multi-dimensional array using Tree-View
dc_guiachoice()......A GUI replacement for ACHOICE()
dc_guialert()........A GUI replacement for ALERT()
dc_guialertcolor()...Preset the foreground/background color of DC_GuiAlert()
dc_guigrumpbrow()....An emulation of Greg Lief's GrumpBrow()
dc_guimemoedit().....A GUI replacement for MemoEdit()
dc_guipopcalc()......A popup, full-function calculator
dc_guipopdate()......A GUI pop-up calendar for selecting a date
dc_helphandler().....Event handler for processing Help Requests
dc_helpoptions().....Set Options for Help Window
dc_hexstring2array().Convert a hex string to a multi-dimensional array
dc_hexstringtovar()..Convert a Hex String to a Binary String
dc_hmacsha1()........Returns a hash that meets SHA1 spec for encrypted message authentication
dc_hourglassoff()....Turn off the HourGlass (wait) pointer
dc_hourglasson().....Turn on the HourGlass (wait) pointer
dc_htmlgetvar()......Get the value of a variable from a web app var array
dc_hunt()............Hunt for a record by search all indexes
dc_icondefault().....Set Default Icon for Dialog Windows
dc_ifelse()..........Evaluate a list of expressions based on a condition
dc_impl()............Implode a dialogue window created by dc_expl()
dc_implode().........Implode a window created by dc_explode()
dc_indexfilt().......Return the Conditional Index Expression
dc_indexkey()........Return the current index key expression
dc_iniload().........Load an array from a *.INI (initialization) file
dc_iniread().........Read a parameter from a *.INI (initialization) file
dc_inisave().........Save an array to a *.INI (initialization) file
dc_iniwrite()........Write a parameter to a *.INI (initialization) file
dc_inkey()...........Moused replacement for INKEY()
dc_inkeydsp()........Display Inkey() and AppEvent() values for pressed keys
dc_inkeyeval().......Post a code block for evaluation by DC_INKEY()
dc_inkeyrelease()....Require mouse to be released or positioned in specified area
dc_inspectobject()...An Xbase Parts Object Inspector
dc_inspectobject2array()Create an array containing iVar names and values of an object
dc_inspectobject2file()Create a file containing iVar names and values of an object
dc_inspectobjectevent()Set the event which will invoke the Object Inspector
dc_inspectthreads()..Pop up a browse with information about running threads
dc_interpret().......Interpret a command string
dc_isanum()..........Is a character alphanumeric?
dc_isanychr()........Is any Character in A string also in B string
dc_isapprunning()....Test if an application is running
dc_isblank().........Test to determine if all the fields in a record are empty
dc_isdescend().......Is the current index a Descending index?
dc_isdescendant()....Is an object a descendant of another object.
dc_isdir()...........Does a directory exist?
dc_ispath()..........Is a directory listed in an Environment string?
dc_isshared()........Is a work area opened in Shared mode?
dc_isstru()..........Verify the structure of a database
dc_isunique()........Is the current index a Unique index?
dc_jazzagekey()......A Get-Set function for posting the JazzAge Key
dc_jpgsize().........Returns the size of a JPEG file
dc_keycount()........Return the number of "active" records
dc_keyno()...........Return the ordinal position of the current record
dc_keystat().........Enable or disable scoping
DC_KeyString2Num()...Translate a key string to a numeric value
dc_keytran().........Translate AppEvent() keyboard value to Inkey() value
dc_langblock().......Post a code-block for language translator
dc_langmsg().........Translate a message by language
dc_langset().........Set the default language for eXPress++ messages
dc_lastfocus().......Store oXbp pointer for returning focus
dc_lockmaint().......Maintain the "Lock" definition database
dc_log().............Write system status to a log file
dc_memoedit..........A dual-mode replacement for MemoEdit()
dc_menu_p()..........A nested, moused pull-down menu-system
dc_menu_to().........A moused replacement for MENU TO (__menuto())
dc_menuaccel().......Process a menu Accelerator key
dc_menuarray().......Create an array of mouse buttons for a single-line menu bar
dc_menubar().........Paint a menu bar with key characters highlighted
dc_menucompile().....Compile a Menu Array
dc_menuedit()........A Complex Pull-Down Menu Editor
dc_menuload()........Load a menu from the Menu Dictionary
dc_menulock()........Lock all Menu items
dc_menumain()........An "integrated" menu system with a bar and pull-downs
dc_menuownerdrawdisable()Disable owner draw menus throughout application
dc_menuownerdrawset()Sets or resets the ownerdraw flag on menu items
dc_menupick()........Pop up a Pick list of all menus in the Menu Dictionary
dc_menupull()........A nested, moused pull-down menu-system
dc_menureversecolor()Changes the way the color of the selected menu item behaves
dc_menurun().........Run a menu
dc_menuto()..........A Moused replacement for MENU TO
dc_mergeblocks().....Merge two code blocks for later evaluation
dc_mergegetlists()...Merge two GetLists into one
dc_messageoff()......Display a blinking message in a GUI message box
dc_messageon().......Display a blinking message in a GUI message box
dc_messageoptions()..Set the default options for DC_MessageOn()
dc_messageparent()...Set the Parent object for DC_MessageOn()
dc_modstru().........Modify the structure of a database
dc_moubutton().......Test the status of the mouse buttons
dc_mouclick()........Set the mouse button double-click delay
dc_moucol()..........Get current screen column of mouse cursor
dc_moudisable()......Disable the mouse functions
dc_mouenable().......Enable the mouse functions
dc_mougetevent().....Get a mouse event from the Mouse Click buffer
dc_mougetpos().......Get the current row and column of the mouse
dc_mouhide().........Hide the mouse cursor
dc_mouinitialize()...Initialize the mouse functions
dc_moupresent()......Is a mouse present?
dc_mourow()..........Get current screen row of mouse cursor
dc_mousebutton().....Paint a mouse button on the screen
dc_mousekey()........Scan array of mouse buttons and stuff keyboard or evaluate
dc_mousetpos().......Set the current row and column of the mouse
dc_moushow().........Show the mouse at it's current screen position
dc_moustart()........Enable automatic keyboard stuffing on a Mouse Click
dc_moustop().........Turn off the Mouse Event driver
dc_mouvisible()......Is the mouse cursor visible?
dc_movecursortoobject()Move mouse cursor to the center of an object
dc_moveobject()......Move or resize an Xbase Parts object with the mouse
dc_moveparentwindow()Move a parent window by clicking mouse on child object
dc_msgbox()..........Display an array of messages in a window
DC_MsgBoxColor().....A Get-set function to set the default color for DCMSGBOX.
dc_msgboxescape()....Set the behavior of the ESC key when using DC_MsgBox()
dc_msgboxgui().......Force DC_MsgBox() to always display a GUI dialog
dc_msgboxtitle().....Set the default title for DC_MsgBox()
dc_num2bin().........Converts a Decimal number to a Binary String
dc_num2word()........Convert an integer number to a 2-byte word
dc_numincr().........Increment a numeric value within a string
dc_object2js().......Convert an object to JSON
dc_object2xml()......Convert an object to XML
dc_objload().........Dynamically load an Xbase++ compiled .OBJ for execution
dc_objpublic().......List .OBJ(s) that contain public function
dc_objsource().......Get the source code name from an .OBJ file
dc_objsourcelist()...Display a list of .OBJ/.PRG files containing PUBLIC proc
dc_odblock().........Get a Progress indicator code block to pass to dbeval()
dc_odometer()........Display a progress indicator for database/index operations
dc_odpercent().......Set numeric value for progress indicator percentage of update
dc_openindex().......Open a set of index files
dc_pack()............Pack the current database
dc_parent()..........Get the Alias name of the Parent database
dc_parentval().......Get the Alias name of the Parent database
dc_path()............Return the path or file name from a file specification string
dc_pathfound().......Return the directory name in which a file is found
dc_pause()...........Pause program execution for a specified amount of time
dc_pickcase()........A function that replaces CASE..ENDCASE statements
dc_pointerarrow()....Set the mouse pointer to an arrow
dc_pointerwait().....Set the mouse pointer to an hourglass
dc_popcalc().........A popup, full-function calculator
dc_popcolor()........A pop-up dialog for selecting Colors
dc_popdate().........A pop-up calendar for selecting a date
dc_popdatestart()....Select Monday or Sunday as start of week
dc_popdateweek().....Set the suffix to use when displaying the calendar week
dc_popdir()..........A dialog for choosing a directory
dc_popfile().........A dialog for choosing a file
dc_popfont().........A pop-up dialog for selecting a Font name
dc_poppresalign()....A popup dialog for selection Presentation Alignment
dc_poppresborder()...A popup dialog for selection Presentation Border
dc_poppreslayout()...A popup dialog for selection Presentation Layout
dc_poppressep()......A popup dialog for selection Presentation Separator
dc_popscrn().........Restore a screen area from the screen stack
dc_poptime().........A pop-up browse for selecting a time
dc_popupbuttonstyle()Get or Set the default style for DCGET popup buttons
dc_presadd().........Add Presentation Parameters to a PP Array
dc_presedit()........A GUI Editor for a Presentation Parameters Array
dc_printbrowse().....Print the contents of a Browse object
dc_printclipboard()..Print the contents of the ClipBoard (BitMap Only)
dc_printercol()......Returns the current Printer Column position
dc_printerdialog()...A Printer Dialog for setting up printing options
dc_printername().....Retrieve the last printer name selected by user.
dc_printerobject()...Return a reference to the static printer object
dc_printeroff()......Destroy a printer object
dc_printerok().......Test whether or not the user aborted the Print process
dc_printeron().......Create a printer class object for @..SAY style printing
dc_printerporttoname()Returns name of a Printer that is assigned to a specified Port.
dc_printerrow()......Returns the current Printer Row position
dc_printfile().......Print an ASCII file using Windows Print Driver
dc_printimage()......WYSIWIG print of a selected GUI object
dc_printpreviewacrobat()A print previewer that uses the Acrobat Reader
dc_printpreviewacrobatopt()Sets the options for the Acrobat previewer
dc_printpreviewimagewriteropt(Sets the options for the Image Writer previewer
dc_printpreviewxpswriter()A print previewer that uses the Microsoft XPS Document Writer
dc_printpreviewxpswriteropt()Sets the options for the XPS Document Writer previewer
dc_progload()........Load a Program from the Program Dictionary to an Array
dc_progmaint().......Maintain the DCPROG.DBF Program Dictionary File
dc_program().........Run a Program from the Program Dictionary
dc_progress()........Display a Progress bar
dc_purge()...........Purge duplicate records from a database
dc_pushbuttonstyle().Get or Set the default style for legacy push buttons
dc_putkey()..........Stuff any keyboard value into Keyboard Buffer
dc_qout()............Send data to the default CRT window
dc_qoutwindow()......Establish or Create a CRT window for debugging GUI apps
dc_random()..........Return a random number between 0 and 255
dc_rddsel()..........Select a database driver
dc_readalt().........Establish alternate usage of Ctrl-END in table of Gets
dc_readapick().......Pops up array pick-list if GET not valid or double-clicked
dc_readbox().........Create a modal dialog box and Mouse Buttons for DC_ReadModal()
dc_readcapfirst()....Capitalize all first letters of all words in all GETs
dc_readclick().......Evaluate code-block if mouse is double-clicked in a GET
dc_readcolor().......A function for validating color strings in a GET
dc_readcua().........Set CUA-Compliance for Navigating Gets
dc_readcut().........Establish the keys to use for cutting and pasting Gets
dc_readdpick().......Pops up database or array pick-list in a GET
dc_readempty().......Validate that a GET is not empty or display message
dc_reader()..........A Replacement for GetReader() that works with mouse
dc_readgets()........Process the Getlist array with the Text or GUI reader
dc_readgui().........Process the Getlist array with the GUI reader
dc_readguidebug()....Enable/Disable DEBUG mode in the GUI reader
dc_readguieval().....Post a code block for later evaluating in DC_ReadGui()
dc_readguievent()....Create an event to control the GUI reader
dc_readguieventloop()Start up an event loop that is compatible with GetList
dc_readguihandler()..Post a "default" event handler for DC_ReadGui()
dc_readguilastkey()..Process the Getlist array with the GUI reader
dc_readguimenuaccess()Assign a set of keys to open menu or tree locks
dc_readguitypeahead()Enable Keyboard typeahead buffer in GUI dialogs
dc_readhelp()........Post a code-block for F1 help when using DC_ReadGets()
dc_readhtml()........Read the DIALOG GetList with the HTML reader
dc_readincr()........A "VALID" function for incrementing a GET value with the mous
dc_readkill()........Return, and/or set, whether current READ should be exited
dc_readmodal().......A moused and robust replacement for ReadModal()
dc_readmodalsize()...Set the size of the static array for DC_ReadModal()
dc_readnav().........Enable an alternative navigation method for GETS
dc_readvar().........Update a check box or Radio Button GET
dc_readwindow()......Establish scroll-region for DC_ReadModal() GETS
dc_recall()..........Recall record(s) that were previously marked for deletion
dc_reclock().........Lock the current record
dc_rectag()..........Build or add to a Record Tag Array
dc_rectagarray().....Gets or Sets the array to be used for Record Tagging
dc_rectagclear().....Clear the Record Tag Array
dc_rectagtoggle()....Toggle the Record Tag on the current record
dc_regdelete().......Delete a key from the Windows Registry
dc_regdeletevalue()..Delete a value from the Windows Registry
dc_regionarray().....Return an array of region coordinates for a dialog
dc_regquery()........Read a parameter from the Windows Registry
dc_regqueryautorestore()displays a dialog that lists all item in the registry defined by DC_AutoRestoreWindow()
dc_regquerybranch()..Returns all the values of a registry branch into an array.
dc_regquerybranch()..Returns all the values of a registry branch into an array.
dc_regwrite()........Write a parameter to the Windows Registry
dc_replace().........Assign new values to field variables using GUI dialog
dc_restoreevents()...Restore all events in the event queue from an array
dc_restset().........Restore all SETs from an array
dc_reuseexclusive()..Re-Use a database Exclusive
dc_saveevents()......Clear all events out of the Event Queue
dc_saveset().........Save all SETs to an array
dc_say().............Perform @..SAYs relative to coordinates in dc_expl() window
dc_saycenter().......Write a string in the center of an area of the screen
dc_scopeexpress......Use eXPress++ scoping system in lieu of Xbase++
dc_scrldata()........Display a database vertical scroll bar
dc_scrldmou()........Return a record pointer from database scroll-bar mouse-click
dc_scrldthumb()......Enable display of database vertical scroll bar thumb
dc_scrlhbar()........Display a horizontal scroll bar
dc_scrlhmou()........Return an array pointer from horizontal scroll-bar mouse-click
dc_scrlvbar()........Display a vertical scroll bar
dc_scrlvmou()........Return an array pointer from vertical scroll-bar mouse-click
dc_scrn2clipboard()..Capture current dialog screen to the ClipBoard
dc_search()..........Search all fields in a set of databases for a value
dc_seeklast()........Seek the last occurence of a key in the current index
dc_sendmailtodefault()Send an email using the default Mail Client
dc_setappfocus().....Set Focus to a specified object
dc_setcpu()..........Sets the next CPU to use on a multi-processor computer
dc_setdaterange()....Set the valid date range for all Date GETS
dc_setdclip()........Set the directory to use for dCLIP data-dictionary files
dc_setdefault()......Set the DEFAULT directory the right way
dc_setedit().........Pop up an editing screen for all SET environment variables
dc_setkeyactive()....Force DCREAD GUI dialogs to evaluate SET KEY code blocks
dc_setpointertree()..Set the mouse pointer on all objects in a tree
dc_setpopkey().......Set or the return the value of the POPUP hot key
dc_setproperty().....Set the property of a Getlist item associated with an object
dc_setregion().......Crop a Dialog window to a specified shape
dc_setregionellipse()Crop a Dialog window to an ellipse/circle shape
dc_setrelation().....Set a relation with a child scope
dc_setrest().........Restore the SET environment from a file
dc_setroundrectregion()Crop a Dialog window to round the corners to a specified radius
dc_setsave().........Save the SET environment to a file
dc_setscope()........Set a scoping value for the current work area
dc_setscopearray()...Set a scoping value for the current work area using an array
dc_spawnurl()........Spawn the program associated with a file name or URL
dc_sqlconnection()...Make a SQL connection via SQLexpress
dc_sqlconnectstring()Get or Set a SQL connection string
dc_sqlcursor().......Create a SQL cursor via SQLexpress
dc_sqldataset()......Create a data subset from an existing SQL cursor
dc_sqlfieldblock()...Create a code block for browsing an SQL field
dc_sqlgetsetblock()..Create a code block for editing an SQL field
dc_sqlsortblock()....Create a code block for sorting an SQL column
dc_status()..........Display System status window
dc_str2ar()..........Convert a string to a multidimensional array
dc_struupdate()......Modify the structure of a database
dc_strwrap().........Convert a string to a text array and specify line length
dc_sum().............Sum numeric fields in selected database
dc_tabactivate().....Activate a Tab Page
dc_tabpagecolor()....Set the default tabpage minimized and maximized colors
dc_tagallcreate()....Create index tags for all fields in a database
dc_tagdelete().......Delete a tag from a combined index
dc_tagrecord().......Tag the current record or record group in a Browse
dc_tbinkey().........A special version of INKEY() for adding mouse to Tbrowse system
dc_testbof().........Test if record pointer is at top of file
dc_testeof().........Test if record pointer is at bottom of file
dc_testlockenable()..A Get-set function to enable testing a lock when using DC_RecLock()
dc_timetosec().......Convert a time string to seconds
dc_token()...........Extract a token from a string
dc_tokenarray()......Parse all tokens in a string to an Array
dc_tokenjustify()....Perform text-justfication of tokens in a string
dc_tokennum()........Determine the number of tokens in a string
dc_tooltipenable()...Enable or Disable Tooltip threads
dc_tooltiptimeout()..Sets the timeout period for tooltips
dc_translate().......Translate a command line to an array of Functions
dc_txtclose()........Close text file
dc_txtcount()........Return the number of lines in an open text file
dc_txteof()..........Is file pointer at end of text file?
dc_txtfind().........Fast text search for a string within a text file
dc_txtgoto().........Goto a specified line in a text file
dc_txtline().........Read the current line of a text file
dc_txtlno()..........Report the current line pointer of an open text file
dc_txtopen().........Open a text file for use with Text file functions
dc_txtsize().........Return the size in bytes of an open text file
dc_txtskip().........Skip a specified number of lines in a text file
dc_txtword().........Return value of a word in a String by specifying position
dc_unc2drive().......Converts a UNC path to a local mapped path
dc_updated().........Determine whether a GET changed during a READ
dc_usearea().........Open a database file in a work area
dc_usedbfprotect()...A Get/Set function for establishing data protection mode
dc_useraccess()......Determine if Logged-On user has access to a lock
dc_userfree()........Free the lock on the the User file to allow user access
dc_userinfo()........Get or Set information about Logged-On User
dc_userlock()........Lock or attempt to lock all users out of the system
dc_userlogin().......Login to application to establish user rights
dc_usermaint().......Maintain the DCUSERS.DBF User Database
dc_userset().........stablish the Logged-On user from the User Database
dc_util()............A menu of database utilities
dc_validateblock()...Validate a code block string
dc_valtype().........Validate input parameters and set default values
dc_var2hexstring()...Convert a binary string to a Hex String
dc_var2sql().........Convert Xbase++ value to SQL value
dc_varfromlistbox()..Store List box choices into memory variable array
dc_vartolistbox()....Store memory variable array into ListBox
dc_versionexpress()..Returns the current eXPress++ version
dc_virtcapt()........Capture the current record to a Virtual record array
dc_virtrepl()........Replace the current record contents with Virtual record arra
dc_virtrest()........Restore the virtual record contents to an array
dc_virtsave()........Save the current record to the virtual record file
dc_wait()............3 Dual-Mode replacement for the WAIT command
dc_waiton()..........A Dual-Mode dialog for "Work in Progress"
dc_webserverdomainname()Set the Web Server domain name for web applications
dc_wildcardmatch()...Test if a string matches a wildcard
dc_winalert()........Popup a GUI alert box
dc_windowlist()......Pop up a list of open windows
dc_winmenudestroymode()A Get-Set function for setting AUTOWINMENU destroy mode
dc_word2num()........Convert a 2-byte word to an integer number
dc_workarea2csv()....Exports the data in the current work area to a CSV file
dc_workarea2excel()..Create an Excel Spreadsheet from data in a Work Area
dc_workarea2xml()....Export a workarea to an XML file
dc_working().........Display a "Working in Progress" bar
DC_WtfEnable().......Get-Set to enable or disable WTF output
dc_xbpgetlbclick()...Post code block to evaluate when mouse in clicked in any DCGET
dc_xbpgetpres()......Set the default presentation parameters for the DC_XbpGet() class
dc_xbpmenuconfig()...A Get-Set function for configuring OwnerDraw menus
dc_xbpmenushift()....Get-Set to post a codeblock to call when shift key held down on a menu
dc_xbppushbuttonxpdefault()Get or Set the default style for DC_XbpPushButtonXP() push buttons
dc_xbptohtmlcolor()..Convert XBP colors to HTML colors
dc_xcarray().........Return an Array Template for X2CLIP interface
dc_xccall()..........Send a message to X2CLIP to perform an operation
dc_xcclose().........Close an X2CLIP session
dc_xcopen()..........Open an X2CLIP session for database operations
dc_xcreturn()........Return data from the X2CLIP program
dc_xcupdate()........Update pointers in the X2CLIP program
dc_xml2objecttree()..Create an object tree from an XML file or stream
dc_xorbits().........A logical EXCLUSIVE OR of two numbers
dc_xorbitslong().....Exclusive OR on 2 long integer (32 bit values) values
dc_xorstrings()......An Exclusive OR (XOR) of 2 input strings of equal length
dc_xpftoarray()......Load the contents of an .XPF memory file to an array
dc_xtoc()............Converts any variable type to a String
dc_zap().............Zap the database
dc_zoomtransparent().Zoom a Dialog Window from 0% to 100% Transparency
dc_csv2array()
Export an array to a comma-delimted CSV file
Syntax:
DC_Csv2Array( < cCsvFileName > ) - > aArray
Arguments:
< cCsvFileName > is the name of the file to import.
Returns:
A 2-dimensional array.
Description:
DC_Csv2Array() imports a comma-delimited CSV file into a
2-dimensional array.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_array2csv()
OVERVIEW_DUAL_FUNC
Dual-Mode Functions
Description:
DUAL-Mode functions have been designed to work in either
TEXT mode or GUI mode. Text mode is selected by calling
DC_GUI(.f.) and GUI mode is selected by calling DC_GUI(.t.).
Functions in the DCLIPX.DLL dynamic-link library all start
with the prefix DC_. The DCLIPX.DLL file is one of the
libraries that are included with the dCLIP++ Application
Development System, and your eXPress++ system is fully
compatible with dCLIP++ in the event that at some time you
wish to upgrade and utilize the dCLIP++ design tools.
OVERVIEW_GENERAL
General Functions
Description:
General functions are those which have been designed to work
identically in either TEXT mode or GUI mode. These functions
do not create any output to the screen in either mode,
therefore they can be used freely without regard to the
screen mode, DC_GUI().
Functions in the DCLIPX.DLL dynamic-link library all start
with the prefix DC_. The DCLIPX.DLL file is one of the
libraries that are included with the dCLIP++ Application
Development System, and your eXPress++ system is fully
compatible with dCLIP++ in the event that at some time you
wish to upgrade and utilize the dCLIP++ design tools.
OVERVIEW_GUI_FUNC
GUI Functions/Classes
Description:
GUI functions are designed to work only in GUI mode. When any of
these functions are used they ignore the setting of the DC_Gui()
flag.
OVERVIEW_TEXT_FUNC
Text Mode Functions/Classes
Description:
Text-Mode functions are designed to work only in TEXT mode.
When any of these functions are used they ignore the setting of
the DC_Gui() flag and require that the SetAppWindow() be a CRT
window (XbpCrt Class).
dc_dbrecord()
Create a Database Record Object
Syntax:
DC_DbRecord():new() - > < oRecord >
Arguments:
None.
Returns:
A record object created from the currently used database.
Description:
DC_DbRecord() is a class that is used to create a data object
for storing a database record.
The record object is created from a dynamic class which will have
the name DATA_<þaliasþ>.
Each field name in <þaliasþ> will be added to the object as an
iVar.
Two additional iVars are created:
RECORD_NUMBER - A numeric container for the current record number that
is set when DC_DbScatter() is used.
RECORD_DELETED - A logical container for the Deleted() flag is
set when DC_DbScatter() is used.
Examples:
FUNCTION XTest()
LOCAL oRecord
USE COLLECT
oRecord := COLLECT->(DC_DbRecord():new())
COLLECT->(DC_DbScatter(oRecord))
@ 1,1 DCSAY 'Description' GET oRecord:descript
@ 2,1 DCSAY 'Type' GET oRecord:type
@ 3,1 DCSAY 'Sub-Type' GET oRecord:subtype
DCREAD GUI
COLLECT->(DC_DbGather(oRecord))
RETURN nil
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_dbscatter()
dc_dbgather()
dc_dbrecordcompare()
dc_dbrecordcopy()
dc_abigelem()
Return element of longest string in an array
Syntax:
DC_ABigElem ( < aArray >, ;
[@< nLength >] ) - > nElement
Arguments:
< aArray > is the name of any single-dimensional array that is
fill with character strings.
@< nLength > is the name of a variable to place the length
of the item returned.
Returns:
A number equivalent to the element of the array with the
longest string.
Description:
DC_ABIGELEM() will return the element number of the longest
string in a single-dimensional array.
Examples:
. nLength := 0
. aTest := { 'abc','abcdef','abcde','abcd' }
. ? DC_ABIGELEM( aTest, @nLength )
2
. ? nLength
6
Source/Library:
_DCARRAY.PRG, DCLIP1.DLL
dc_achoice()
A Dual-Mode replacement for ACHOICE()
Syntax:
DC_AChoice ( < nTop >, < nLeft >, < nBottom >,
< nRight >, ;
< aMenuItems >, ;
[< aSelItems >], ;
[< cUserFunc > | < bUserFunc >], ;
[< nInitialItem >], ;
[< nWindowRow >], ;
[< aButtons >], ;
[< aOptions >], ;
[< aHelpCodes >], ;
[< aMenu >], ;
[< lAttachMenu >] ) - > nPosition
Arguments:
< nTop >, < nLeft >, < nBottom >, < nRight >
are the screen
coordinates.
< aMenuItems > is an array of character strings to include
in the pick-list.
< aSelItems > is an array of logical values. There is one
element in this optional array for each element in
< aMenuItems >. Each element in < aSelItems > that is a
.TRUE. will make the item in the window a "selectable"
item, otherwise it will be a non-selectable item and will
be displayed in "grayed" form.
< cUserFunc > | < bUserFunc > is the name of an optional
User-Defined
function to call on exception keystrokes. See the Clipper
documentation of ACHOICE() for more information on how to use
a UDF. If the parameter is passed as a character string then
the function must be a PUBLIC, not STATIC function.
< nInitialItem > is the item to high-light in the window on
startup.
< nWindowRow > is the item to display as the first item in
the pick-list.
< aButtons > is an array of mouse-keys that conforms to the
specification for DC_MOUSEKEY(). See DC_MOUSEKEY() for
more information.
< aOptions > is a multi-dimensional array of the following
options:
Element Type Description
------- ---- ----------------------------------------------
[1] L If .TRUE. will display a scrollbar and box
around the menu items.
[2] A A sub-array of colors to use if element [1] is
.FALSE. If passed as a NIL then the Clipper
default colors will be used.
Element Type Description
------- ---- ----------------------------
[1] C Menu items color
[2] C Select bar color
[3] C Frame/scrollbar color
[4] C Spare
[5] C Unselectable items color
[3] C Title on top of box. Default is none.
[4] L If .TRUE. then the operator will be allowed to
drag the box with the mouse. Default is .FALSE.
[5] L If .TRUE. then the display will be restored
upon exit, otherwise it will remain.
[6] L If .TRUE. then the frame, scroll-bar and title
will be painted, otherwise only the items will
be painted.
[7] L If .TRUE. then after painting the scroll-bar,
items and frame, DC_ACHOICE() will exit without
waiting for a key or mouse-click.
< aHelpCodes > is an array of character string HELP CODES.
There is one element in this optional array for each element in
< aMenuItems >. The HELP CODE will be passed on to the
DC_HelpF1() function for context-specific help if the operator
presses F1 on a selected item.
< aMenu > is an array defining a Top-Bar/Pull-Down menu. This
array must conform to the specification for the array passed
to the DC_MENUMAIN() function. This Top-Bar menu will be
painted at the screen coordinates defined in the menu if
< lAttachMenu > is .FALSE. or directly attached to the top of
the pick-list window if < lAttachMenu > is .FALSE. (default).
The menu will be energized if the operator presses a key
matching one of the hightlighted characters in the menu, or
if the mouse is clicked on one of the top-bar menu items.
The menu array must contain code-blocks for each menu item
to execute functions based on the menu selection. See
DC_MENUMAIN() for more information.
Description:
DC_ACHOICE() is a Dual-mode replacement for AChoice(). When
the GUI flag is ON, DC_ACHOICE() functions similiar to
AChoice() except that it is displayed in GUI mode. When the
GUI flag is OFF, DC_ACHOICE() functions identical to ACHOICE()
except it is also activated by a mouse. The left button of the
mouse is used to select the item in the window. The right button
or double-clicking works identical to the ENTER key.
In TEXT mode, Hot keys can be activated by passing an array of
screen coordinates (mouse-buttons) and key definitions.
In TEXT mode, an options array is used to define scroll-bars,
colors, exit options, title, drag options, etc.
An optional array of Help-Codes may be passed for context-
specific help on any selected item with the F1 key.
Examples:
local nChoice
local aButtons := { { 17,13,17,18,'C'},;
{ 18,13,18,18,'D'},;
{ 19,13,19,18,'M'} }
local aDir := directory()
set key asc('C') to myfunc
set key asc('D') to myfunc
set key asc('M') to myfunc
cls
@5,10 to 20,30
@16,11 to 16,29
@17,13 say 'Copy'
@18,13 say 'Delete'
@19,13 say 'Move'
aDir := dc_aconvert( aDir )
nChoice := DC_ACHOICE( 6,11,15,29,aDir[1],,,,,aButtons )
set key asc('C') to
set key asc('D') to
set key asc('M') to
return
function myfunc
@ 22,10 say ''
do case
case lastkey() = asc('C')
?? 'C button pressed'
case lastkey() = asc('D')
?? 'D button pressed'
case lastkey() = asc('M')
?? 'M button pressed'
endcase
return nil
Source/Library:
_DCACHOI.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_dbchoice()
dc_readapick()
dc_apick()
dc_acompare()
Compare two arrays
Syntax:
DC_ACompare ( < aArray1 >, ;
< aArray2 > ) - > lStatus
Arguments:
< aArray1 > and < aArray2 > are the arrays to compare.
Returns:
A logical .TRUE. if the arrays are identical, .FALSE. otherwise.
Description:
DC_ACOMPARE() is used to test the contents of two arrays to
determine if they are identical.
Examples:
PROCEDURE Xtest()
LOCAL aArray1, aArray2, aArray3
aArray1 := { 1,2,3 }
aArray2 := { '1',2,3, }
aArray3 := { 1,2,3 }
DC_Gui(.t.)
DC_MsgBox( { 'Is aArray1 equal to aArray2?', ;
'',;
DC_ACOMPARE(aArray1,aArray2) } )
DC_MsgBox( { 'Is aArray1 equal to aArray3?', ;
'',;
DC_ACOMPARE(aArray1,aArray3) } )
RETURN
Source/Library:
_DCARRAY.PRG/.OBJ, DCLIPX.LIB
dc_aconvert()
Convert a Ragged array to a Parallel array and vice-versa
Syntax:
DC_AConvert ( < aInput > ) - > aOutput
Arguments:
< aInput > is a Parallel Symmetrical array or Ragged Symmetrical
array.
Example of a "Parallel Symmetrical array":
Type Contents
aStru[1] A
aStru[1,1] C CUST_NAME
aStru[1,2] C SHIP_DATE
aStru[1,3] C BALANCE
aStru[1,4] C PRINT_FLAG
aStru[2] A
aStru[2,1] C C
aStru[2,2] C D
aStru[2,3] C N
aStru[2,4] C L
aStru[3] A
aStru[3,1] C 25
aStru[3,2] C 8
aStru[3,3] C 9
aStru[3,4] C 1
aStru[4] A
aStru[4,1] N 0
aStru[4,2] N 0
aStru[4,3] N 2
aStru[4,4] N 0
Example of a "Ragged Symmetrical array":
Type Contents
aStru[1] A
aStru[1,1] C CUST_NAME
aStru[1,2] C C
aStru[1,3] C 25
aStru[1,4] N 0
aStru[2] A
aStru[2,1] C SHIP_DATE
aStru[2,2] C D
aStru[2,3] C 8
aStru[2,4] N 0
aStru[3] A
aStru[3,1] C BALANCE
aStru[3,2] C N
aStru[3,3] C 9
aStru[3,4] N 2
aStru[4] A
aStru[4,1] C PRINT_FLAG
aStru[4,2] C L
aStru[4,3] C 1
aStru[4, ] N 0
Returns:
An array whose elements contain the same information as the
input array but are in "inverted" order.
Description:
DC_ACONVERT() is used to changed the format of a symmetrical
array from "Ragged" to "Parallel" or vice-versa. This function
is handy when information in an array may not be stored in a
required format. For example, it is not easy to perform
"pick-list" operations from "Ragged" arrays or to AEVAL()
"Parallel" arrays.
Examples:
PROCEDURE XTest()
LOCAL aRaggedDir, aParallelDir, nChoice
// Converting a Ragged array to a Parallel array
aRaggedDir := Directory()
aParallelDir := DC_ACONVERT( aRaggedDir )
DC_Gui(.t.)
nChoice := DC_Achoice( 10,10,20,40, aParallelDir[1] )
DC_MsgBox( 'The size of ' + aParallelDir[1,nChoice] + ' is ' + ;
Str( aParallelDir[2,nChoice] ) )
RETURN
Source/Library:
_DCARRAY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_areverse()
dc_addbuttonconfig()
Configure buttons added to dialogs by DCREAD GUI
Syntax:
DC_AddButtonConfig( < nButton > | < aConfig >, ;
[< xCaption >], ;
[< nWidth >], ;
[< nHeight >], ;
[< oBitmap >], ;
[< cFont >] ) - > aConfig
Arguments:
< nButton > is the button to configure. This is a manifest constant
from the DCGUI_BUTTON_* definitions in DCDIALOG.CH.
DCGUI_BUTTON_OK - Configures the OK button
DCGUI_BUTTON_CANCEL - Configures the CANCEL button
DCGUI_BUTTON_EXIT - Configures the EXIT button
DCGUI_BUTTON_HELP - Configures the HELP button
DCGUI_BUTTON_YES - Configures the YES button
DCGUI_BUTTON_NO - Configures the NO button
or < aConfig > is a 4 element array containing the numeric value
of the button to configure, the caption, the width and the height.
< xCaption > is the caption of the button. This may be a character
string, a numeric resource value that has been linked into the
application, an XbpBitMap() object, or a string containing the
name of a .BMP, .JPG or .GIF file. It may also be a code block
that returns one of the above values.
< nWidth > is the width of the button in pixels.
< nHeight > is the height of the button in pixels.
< oBitmap > is an XbpBitMap() object to use on the button.
< cFont > is the font compound name.
Returns:
An array of 4 elements containing the previous configuration of
the button.
Element Type Description
------- ----- -----------------------------------------------
[1] N Numeric value of button (DCGUI_BUTTON_*)
[2] X Caption of button
[3] N Width of button in pixels
[4] N Height of button in pixels
Description:
DC_AddButtonConfig() is a Get-Set function which is used to
configure the caption and size of buttons which are added to
a dialog by the ADDBUTTONS or BUTTONS clause of DCREAD GUI.
Examples:
#include "dcdialog.ch"
#include "dcbitmap.ch"
FUNCTION XTest()
LOCAL GetList[0], GetOptions, cUserID, cPassword, aOkConfig, aCancelConfig
cUserId := Space(10)
cPassword := Space(10)
aOkConfig := DC_AddButtonConfig(DCGUI_BUTTON_OK,BITMAP_OK_1,80,30)
aCancelConfig := DC_AddButtonConfig(DCGUI_BUTTON_CANCEL,BITMAP_CANCEL_1,80,30)
@ 1,1 DCSAY ' User ID' GET cUserID
@ 3,1 DCSAY 'Password' GET cPassword PASSWORD
DCGETOPTIONS ;
BUTTONALIGN DCGUI_BUTTONALIGN_CENTER
DCREAD GUI FIT ADDBUTTONS TITLE 'Please Login' ;
OPTIONS GetOptions
DC_AddButtonConfig(aOkConfig) // restore old configuration
DC_AddButtonConfig(aCancelConfig) // restore old configuration
RETURN nil
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
See Also:
DCREAD GUI
DCGETOPTIONS
dc_addcargo()
Add cargo to the GetList
Syntax:
DC_AddCargo ( < GetList >, ;
< xCargo > ) - > GetList
Arguments:
< GetList > is the GetList array.
< xCargo > can be one of several numeric values or an array.
xCargo Description
------ ----------------------------------------
101 Force this GET to validate
102 Display Pick-list pointer icon (arrow)
{103,bBlock} Pre-Evaluate Code-Block
{104,bBlock} Post-Evaluate Code-Block
{105,aMsg} Message to display on screen
106 Protect this GET from editing
107 Capitalize first character of each word
{108,aData} SAY prompt and coordinates
Returns:
A pointer to the <þGetListþ> passed to DC_ADDCARGO().
Description:
DC_ADDCARGO() is used to add cargo to the an array that
is contained in the CARGO instance variable of the last
GET in a GetList array.
DC_READMODAL() automatically looks at the information in
CARGO to give added functionality to the GET system.
CARGO is used to store array pointers, screen SAY
information and other GET options.
Examples:
#include "dcget.ch"
LOCAL GetList := {}, aData, i
use <cDataFile>
aData := Array(Fcount())
FOR i := 1 TO LEN( aData )
aData[i] := FieldGet(i)
NEXT
DC_ReadWindow( { 10, 10, 20, 60 } )
FOR i := 1 TO LEN(aData)
DC_GetDevOut( i, 12, PadL(Field(i),10), )
SetPos( Row(), Col()+1 )
AAdd( GetList,_GET_(aData[i],"aData[i]",,,) )
DC_GetDisplay( GetList )
/* -- Add array element pointer -- */
GetList := DC_ADDCARGO(GetList,-1*i)
/* -- Add SAY Prompt and location -- */
GetList := ;
DC_ADDCARGO(GetList,{ 108, { i, 12, PadL(Field(i),10) }})
/* -- Add CAPFIRST flag -- */
GetList := DC_ADDCARGO(GetList,107)
NEXT
DC_ReadModal( GetList,,aReadArea )
RETURN nil
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readbox()
dc_addrec()
Append a new record and lock the record
Syntax:
DC_AddRec ( [< nWaitTime >], ;
[< lDisplayError >], ;
[< nAppendMode >] ) - > lStatus
Arguments:
< nWaitTime > is the number of seconds to wait for the system to
return a lock before returning the status or the error message.
(0 = wait forever).
< lDisplayError > if .true. will display an operator error
message if the record cannot be locked. (default) or if .false.
will not display an error message to the operator.
< nAppendMode > is a number from 0 to 2 (0 is the default) to
establish the mode for reusing deleted or blank records, if
they exist, or appending a new record. See DC_APPENDMODE().
Returns:
A logical .TRUE. if the record is successfully locked.
Description:
The function of DC_ADDREC() is dependent on the APPEND MODE of
operation that was previously selected by the DC_APPENDMODE()
function.
If the Append Mode is 0 (default), then DC_ADDREC() will always
append a Blank record.
If the Append Mode is 1, then DC_ADDREC() will first try to
locate any existing Blank record in the database. If a Blank
record is found, the record pointer will be set to the found
record and the record will be locked. This mode functions
differently based on whether or not the current work area
has an index selected. If an index is selected, then it is
assumed that blank records will always appear at the TOP of
the database so only the first record is tested, otherwise
the entire database will be search for a blank record.
If the Append Mode is 2, then DC_ADDREC() will first try to
locate any existing record that is marked for deletion. If
a deleted record is found, the record pointer will be set
to the found record, the record will be recalled (undeleted),
all fields will be blanked, and the record will be locked.
Examples:
dc_appendmode(1) // reuse blank records
use sales
if DC_ADDREC()
replace date with date()
else
break
endif
Source/Library:
_DCLOCK.PRG, DCLIPX.DLL
See Also:
dc_reclock()
dc_filock()
dc_appendmode()
APPEND
UNLOCK
dc_addsetkeys()
Convert all SET KEYS to DCHOTKEY commands
Syntax:
DC_AddSetKeys( < aGetList > ) - > aGetList
Arguments:
< aGetList > is the GetList array that will be passed to DC_ReadGUI().
Returns:
A GetList array with all hotkeys added.
Description:
DC_ADDSETKEYS is used to read the current SET KEYS and add them
to the GetList as DCHOTKEY commands.
Examples:
FUNCTION XTest()
LOCAL GetList := {}, dDate := Date(), nNumber := 0
SET KEY -2 TO DC_PopDate()
SET KEY -3 TO DC_PopCalc()
@ 1,1 DCSAY ' Enter a Date' GET dDate
@ 3,1 DCSAY 'Enter a Number' Get nNumber
@ 5,1 DCSAY 'Press F3 for a Calendar' SAYSIZE 30
@ 6,1 DCSAY 'Press F4 for a Calculator' SAYSIZE 30
DC_ADDSETKEYS(GetList)
DCREAD GUI FIT ADDBUTTONS
RETURN nil
Source/Library:
_DCFUNCT.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readgui()
DCHOTKEY
DC_AdsCursor2Excel()
Create Excel spread sheet from an Ads Cursor handle
Syntax:
DC_AdsCursor2Excel( < nCursorHandle >, ;
[< cExcelFile >], ;
[< nOrientation >], ;
[< lDisplayAlerts >], ;
[< lVisible >], ;
[< lAutoFit >] ) - > nil
Arguments:
< cExcelFile > is the name of the excel file (*.XLS) to be created.
If this parameter is not passed, the file will be created in the
same directory as the application .exe and will be named WORKSHEET.XLS.
< nOrientation > is the orientation of the spreadsheet. A value of
1 creates a "portrait" orientation. A value of 2 creates a
"landscape" orientation (default).
< lDisplayAlerts > will prompt the user if the file being created
will be overwritten. The default is .f.
< lVisible > will display the spreadsheet while the cells are being
filled. Default is .f.
< lAutoFit > will optimize the columns of the spreadsheet to fit
the data to it's optimum width, otherwise the columns will be
the width of the database field. Default is .t.
Description:
DC_AdsCursor2Excel() is used to create an Excel spread sheet from
an Ads Cursor handle.
Examples:
FUNCTION Xtest()
LOCAL nHandle, cServer := CurDrive()+':', nStatementHandle, ;
cStatement
cStatement := "SELECT PART_NO, ON_HAND, COST FROM PARTS WHERE ON_HAND >
100"
AdsConnect( cServer, @nHandle )
nStatementHandle := 0
AdsCreateSQLStatement( nHandle, @nStatementHandle )
nCursorHandle := 0
AdsExecuteSQLDirect( nStatementHandle, cSelect, @nCursorHandle )
DC_AdsCursor2Excel( nCursorHandle )
RETURN nil
Source/Library:
_DCADS.PRG
See Also:
DC_WorkArea2Excel()
DC_Array2Excel()
dc_adscursor2xml()
Export an ADS cursor to an XML file or string
Description:
DC_AdsCursor2Xml() will export an ADS cursor to an XML file,
or string, that will contain structure and data. Look at the
example in .\samples\xml.
Source/Library:
_dcfunct.prg, dclipx.dll
See Also:
dc_adscursor2excel()
dc_adsfieldblock()
Create a Get/Set code block for an ADS SQL cursor field
Syntax:
DC_AdsFieldBlock( < nCursor > , ;
< cFieldName >, ;
[< bFormat >] ) - > bGetSet
Arguments:
< nCursor > is a numeric cursor returned by an ADS SQL statement.
< cFieldName > is a name of a field in the ADS SQL cursor.
< bFormat > is a code block to format the returned data. The code
block receives the data in for form of a string.
Returns:
A code block.
Description:
DC_AdsFieldBlock() is used to create a Get/Set code block for
a field in an ADS SQL cursor.
Examples:
nCursorHandle := 0
AdsExecuteSQLDirect( nStatementHandle, cSelect, @nCursorHandle )
nNumFields := 0
AdsGetNumFields( nCursorHandle, @nNumFields )
bDataSource := {||nCursorHandle}
@ 0,0 DCBROWSE oBrowse ;
DATA bDataSource ;
SIZE 100,20 ;
PRESENTATION DC_BrowPres()
FOR i := 1 TO nNumFields
cFieldName := Space(20)
nLength := 20
AdsGetFieldName( nCursorHandle, i, @cFieldName, @nLength )
cFieldName := Pad(cFieldName,nLength)
bGetSet := Adsfieldblock( nCursorHandle, cFieldname )
DCBROWSECOL DATA bGetSet PARENT oBrowse HEADER cFieldName ;
WIDTH 20
NEXT
Source/Library:
_DCADS.PRG, DCLIPX.DLL
See Also:
DC_AdsSQLQuery()
dc_adsgoposition()
Moves the row pointer to a percent position in a ADS SQL cursor
Syntax:
DC_AdsSkipper( < nAdsSQLcursor >, ;
< nPercent > ) - > Nil
Arguments:
< nAdsSQLcursor > is an ADS SQL cursor.
< nPercent > is a numeric value in the range between 0 and 100.
Zero is equivalent to the first row and 100 indicates the last
row in a SQL cursor.
Returns:
A numeric value equal to the actual number of rows skipped.
Description:
DC_AdsGoPosition() moves the row pointer in an ADS SQL cursor
based on a percent value.
Examples:
oBrowse:GoPosBlock := {|n|DC_AdsGoPosition(nAdsSQLcursor,n)}
Source/Library:
_DCADS.PRG, DCLIPX.DLL
See Also:
dc_adsfieldblock()
dc_adsskipper()
dc_adsposition()
Returns the position of the ADS SQL cursor row as a percent value
Syntax:
DC_AdsSkipper( < nAdsSQLcursor > ) - > nPercent
Arguments:
< nAdsSQLcursor > is an ADS SQL cursor.
Returns:
A numeric value equal to the position of the row in percent.
Description:
DC_AdsPosition() returns a numeric value in the range between
0 and 100. It indicates the position of the row pointer of an
ADS SQL cursor in percent.
Examples:
oBrowse:PosBlock := {|n|DC_AdsPosition(nAdsSQLcursor)}
Source/Library:
_DCADS.PRG, DCLIPX.DLL
See Also:
dc_adsfieldblock()
dc_adsskipper()
dc_adsrunsql()
Execute a SQL statement in a new work area
Syntax:
DC_AdsRunSQL( < cSQLStatement >, ;
[< cAlias >] ) - > lStatus
Arguments:
< cSQLstatement > is an SQL SELECT statement that references tables
in an ADS data-dictionary.
Returns:
A logical .TRUE. if the statement executed successfully, .FALSE.
otherwise.
Description:
DC_AdsRunSql() will execute a SQL SELECT statement and return the
results in a work area which can be navigated with standard
Xbase++ navigation functions such as dbSkip(), dbGoTop(), etc.
This requires Xbase++ 1.9 or later and ADSDBE 1.9 or later.
Before using this function, a connection must be made to ADS server
and a data-dictionary file. See DC_AdsSession().
Examples:
cServer := DC_Path(AppName(.t.)) + 'sample.add'
oSession := DC_AdsSession( cServer )
TEXT INTO cStatement
SELECT * FROM XTEST
ENDTEXT
DC_AdsRunSql( cStatement, 'XTEST' )
Browse()
Source/Library:
_DCADS.PRG, DCLIPX.DLL
See Also:
dc_adsstatement()
dc_adssession()
dc_adssession()
Create or return Ads DacSession for current thread
Syntax:
DC_AdsSession( [< ocSession >], ;
[< nWhich >], ;
[< lReturnAll >] ) - > oDacSession
Arguments:
< ocSession > may be a connect string or a DacSession() object.
If it is a character string then it must be a valid connection
string to send to ADS. It may be the drive/path where the databases
reside or the drive path of an ADS data-dictionary file. A connect
string will cause a new ADS connect to be created.
If it is a DacSession() object, then no new connection will be
created and the passed object will be stored in the connection
array.
< nWhich > is the number of the session to store for the current
thread. The default is 1. For example, each thread could have
2 Ads Session objects stored, 1 for Free Table connections, and
another for Data-Dictionary connections.
< lReturnAll > if .TRUE. will return the entire multi-dimensional
array.
Returns:
A DacSession() object.
Description:
DC_AdsSession is used to create an ADSDBE DacSession for the
current thread to be later used by DC_AdsStatement() or a
regular dbUseArea().
All sessions for all threads are stored in a static multi-dimensional
array.
Notes:
The ADSDBE must be loaded before calling this function.
Examples:
FUNCTION Xtest()
LoadDbes()
cServer := DC_Path(AppName(.t.)) + 'sample.add'
oSession := DC_AdsSession( cServer )
TEXT INTO cStatement
SELECT * FROM XTEST
ENDTEXT
oStatement := DC_AdsStatement():new(cStatement)
cAlias := oStatement:execute()
Browse()
oStatement:close()
oSession:disConnect()
RETURN nil
* -----------------
FUNCTION LoadDbes()
LOCAL cSession, aDbeList := dbeList()
IF ! DbeLoad( "ADSDBE" )
DC_WinAlert( "Unable to load ADSDBE", "ADS Server",, ;
XBPMB_WARNING + XBPMB_APPMODAL )
ELSE
DbeSetDefault( "ADSDBE" )
DbeInfo( COMPONENT_DATA, ADSDBE_TBL_MODE, ADSDBE_CDX )
DbeInfo( COMPONENT_ORDER, ADSDBE_TBL_MODE, ADSDBE_CDX )
DbeInfo( COMPONENT_DATA, ADSDBE_LOCK_MODE, ADSDBE_PROPRIETARY_LOCKING )
cSession := "DBE=ADSDBE;SERVER=" + scDictServer
soAdsSessionDict := DacSession():new(cSession)
IF !soAdsSessionDict:isConnected()
MsgBox( "Unable to establish DICTIONARY connection to ADS Server" + Chr(13)
+ ;
cSession + Chr(13) + ;
"Error Code: " + Alltrim(Str(soAdsSessionDict:getLastError())) +
Chr(13) + ;
soAdsSessionDict:getLastMessage() )
ELSE
DC_AdsSession( soAdsSessionDict,1 )
ENDIF
cSession := "DBE=ADSDBE;SERVER=" + scFreeServer
soAdsSessionFree := DacSession():new(cSession)
IF !soAdsSessionFree:isConnected()
MsgBox( "Unable to establish FREE connection to ADS Server" + Chr(13) + ;
cSession + Chr(13) + ;
"Error Code: " + Alltrim(Str(soAdsSessionFree:getLastError())) +
Chr(13) + ;
soAdsSessionFree:getLastMessage() )
ELSE
DC_AdsSession( soAdsSessionFree, 2 )
ENDIF
ENDIF
RETURN nil
Source/Library:
_DCADS.PRG, DCLIPX.DLL
See Also:
dc_adsstatement()
dc_adsskipper()
A skipper for ADS SQL cursors
Syntax:
DC_AdsSkipper( < nAdsSQLcursor >, ;
< nWantSkip > ) - > nDidSkip
Arguments:
< nAdsSQLcursor > is an ADS SQL cursor.
< nWantSkip > is the number of rows to skip.
Returns:
A numeric value equal to the actual number of rows skipped.
Description:
DC_AdsSkipper() is a Skipper function to be used in navigation
code blocks for a browse.
Examples:
oBrowse:skipBlock := {|n|DC_AdsSkipper(nAdsSQLcursor,n)}
Source/Library:
_DCADS.PRG, DCLIPX.DLL
See Also:
dc_adsfieldblock()
dc_adssqlquery()
A SQL Query window for ADS
Syntax:
DC_AdsSQLQuery( [< cServer >], ;
[< cUserName >], ;
[< cPassword >], ;
[< cDataPath >], ;
[@< cBrowseObjectName >], ;
[< oParent >], ;
[< nIndexMode >, ;
[< nLockingMode >, ;
[< cDbe >] ) - > nil
Arguments:
< cServer > is either a path to a set of .DBF / .CDX databases or
the name of an ADS data-dictionary file. If this parameter is
not passed then it will default to < cDataPath >.
< cUserName > and < cPassword > are used only if
< cServer > is a
data-dictionary file. This is a valid user and password to allow
access to the data-dictionary.
< cDataPath > is the directory where the ADSSQL.DBF file is to
be opened or created. ADSSQL.DBF is used to save SQL queries.
< oParent > is a pointer to a parent object for the new dialog.
If < oParent > is empty, then the parent will be the AppDeskTop().
< nIndexMode > is the type of index files to be used with the DBF
databases. The default is ADS_CDX (defined in DCADS.CH).
< nLockingMode > is the type of record locking scheme to use.
The default is ADS_COMPATIBLE_LOCKING (defined in DCADS.CH).
< cDbe > is the DBE to use for the ADSSQL.DBF database. The default
is 'DBFNTX'.
Returns:
Nil.
Description:
DC_AdsSQLQuery() is a SQL query system based on the SQL functions
in ACE32.DLL.
SQL statements are entered in a text window and then executed
with the push of a button. A SQL cursor is returned and the
results are displayed in a columnar browse window.
SQL statements may be saved to a database named ADSSQL.DBF for
later retrieval.
Source/Library:
_DCADS.PRG, DCLIPX.DLL
dc_alert()
A Dual-Mode replacement for Clipper's ALERT() function
Syntax:
DC_Alert ( < cText >, ;
< aMenuItems >, ;
[< cColorString >], ;
[< lJustify >], ;
[< aMenuId >], ;
[< cMenuName >], ;
[< nChoice >], ;
[@< aDlgPos >], ;
[< aFonts >] ) - > nChoice
Arguments:
< cText > is the message to place in the alert box. Use
semicolons in the text to separate lines of text.
< aMenuItems > is an array of menu choices. The character
following the '~' character will be highlighted.
< cColorString > is an optional color string containing
exactly 4 colors separated by commas:
(1) box and message.
(2) unselected menu items.
(3) hot-key character of each unselected menu item
(4) selected menu item
< lJustify > if .TRUE. will left-justify the message items.
Default is .FALSE.
< aMenuId > - An optional array of unique Menu ID codes (up to 8
characters) for each menu item in < aItems >. This array is
needed to enable the PERSISTENT MENU SELECTION feature. See
DC_MenuPull() for more information.
< cMenuName > - An optional parameter with a "unique" name for
this menu. This name is needed to enable the PERSISTENT MENU
SELECTION feature. See DC_MenuPull() for more information.
< nChoice > is the default menu selection.
@< aDlgPos > is a numeric variable to store a two-element array
of coordinates which will be returned when the user exists the
alert window. These coordinates are the screen coordinates of
the dialog before it was destroyed. These coordinates may be
passed to DG_GUIALERT() again later to paint the dialog window
in the same location.
< aFonts > is a 2-element array containing the Font Compound Name
for the buttons and the text. Element 1 is the button font and
element 2 is the text font. This parameter is used in GUI mode
only.
Returns:
A number equal to the menu choice. Returns 0 if user
presses ESCape.
Description:
DC_ALERT() is a Dual-mode replacement for Alert(). When
the GUI flag is ON, DC_ALERT() functions similiar to
Alert() except that it is displayed in GUI mode. When the
GUI flag is OFF, DC_ALERT() functions identical to Alert()
except it is also activated by a mouse. The left button of the
mouse is used to select the item in the window.
Notes:
The foreground and background color of the GUI alert box is
preset by the function DC_AlertColor().
Examples:
PROCEDURE XTest()
LOCAL nChoice
DC_Gui(.t.)
nChoice := DC_ALERT( "The printer is not ready",;
{ 'Retry','Abort','Output to a file' } )
DC_MsgBox( 'You chose ' + Str(nChoice) )
RETURN
Source/Library:
_DCMENU2.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_msgbox()
dc_guialert()
dc_andbits()
A logical AND of two bytes
Syntax:
DC_AndBits( < nNum1 >, ;
< nNum2 > ) - >nResult
Arguments:
< nNum1 > and < nNum2 > are numeric values from 0 to 255.
Returns:
A numeric value from 0 - 255
Description:
DC_ANDBITS() will produce the result of logically ANDing two bytes.
Source/Library:
_DCAND.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_bittest()
dc_xorbits()
dc_apick()
A dialogue for choosing a item from an array pick list.
Syntax:
DC_APick ( [< nTop >], [< nLeft >], < nWidth >,
< nHeight >, ;
< aMenuItems >, ;
[< acHeader >], ;
[< anWidth >], ;
[< cTitle >], ;
[< anTag >], ;
[< aTagColor >], ;
[< bHandler >], ;
[< nStart >], ;
[< cFontName >], ;
[< oParent >], ;
[< oOwner >], ;
[< lCenter >], ;
[< lMenu >], ;
[< lNoVScroll >], ;
[< lNoHScroll >], ;
[< aPres >], ;
[< cHelpCode >], ;
[< cAutoSeekPicture >], ;
[< lNoRestore >] ) - > nChoice
Arguments:
< nTop >, < nLeft > are the starting coordinates. These are
text-
base coordinates. These parameters are not required if the
< lCenter > parameter is used.
< nWidth > and < nHeight > are the width and height of the
window
in text-based coordinates.
< aMenuItems > is an array of character strings to include
in the pick-list. This may be a single-dimension array or a
multi-dimension array.
< acHeader > is the heading to place above each column. If
< aMenuItems > is a single-dimension array, then there is only 1
header, so < acHeader > is a character string. If
< aMenuItems >
is a multi-dimension array, then < acHeader > is an array of
character strings, 1 for each column.
< anWidth > is the width of the column(s). If aMenuItems > is a
single-dimension array, then there is only 1 width, so < anWidth >
is a numeric value. If < aMenuItems > is a multi-dimension array,
then < anWidth > is an array of numeric values, 1 for each column.
< cTitle > is the title to place at the top of the window.
< anTag > is an array of logical elements or a single numeric
value. If < anTag > is an array, it must be the same length as
the array being browsed and must contain logical values. When
the user double-clicks a browse row, the corresponding element
of < anTag > will be toggled. If < anTag > is a numeric value,
then
it is a pointer to the column of < aMenuItems > that contains
logical tags.
< aTagColor > is used in conjunction with < anTag > to select
the
color for the rows that are tagged. This is a 2-element array
consisting of a foreground and background color. The default
is { GRA_CLR_WHITE, GRA_CLR_BLUE }.
< bHandler > is a SPARE.
< nStart > is the starting element in the browse.
< cFontName > is the font to use for the browse.
< oParent > is the parent object to create the browse. If no
parameter is passed, a dialog window will be created.
< oOwner > is the owner object of the browse. If no parameter is
passed, the owner will be the same as the parent.
< lCenter > if .TRUE. will center the browse dialog on the desktop.
< lMenu > if .TRUE. will enable "menu mode". This allows the
operator to press keyboard keys that match the first letter of
each array item to select the item.
< lNoVScroll > if .TRUE. will suppress the vertical scroll bar.
The default is .FALSE.
< lNoHScroll > if .TRUE. will suppress the horizontal scroll bar.
The default is .FALSE.
< aPres > is an array of presentation parameters that must conform
to the presParam specifications for the XbpBrowse() class.
< cHelpCode > is a help code.
< cAutoSeekPicture > if passed will cause an autoseek GET to be
created above the browse window. The value entered into the
get will be passed to DC_BrowseAutoSeek() to seek to a value.
< cAutoSeekPicture > establishes the picture clause for the Get.
< lNoRestore > if .TRUE. will override DC_AutoRestoreWindow() and
insure that the window coordinates and size are never saved and
restored. The default is .FALSE.
Returns:
A Numeric Value equivalent to the selected row.
Description:
DC_APick() is used to display a browse-style picklist of an
array.
Examples:
FUNCTION XTest()
LOCAL aDir := Directory(), i, aHeaders, aWidths
FOR i := 1 TO Len(aDir)
ASize(aDir[i],5)
aDir[i,5] := .f.
NEXT
aHeaders := { 'File Name', 'File Size', 'File Date', 'File Time' }
aWidths := { 10,10,10,10 }
nChoice := DC_APick ( , , 50, 10, aDir, ;
aHeaders, aWidths, 'Disk Directory', 5, ;
{ GRA_CLR_WHITE, GRA_CLR_RED }, ;
nil, nil, '8.Terminal', nil, nil, .t. )
RETURN nChoice
Source/Library:
_DCACHOI.PRG/.OBJ, DCLIPX.LIB
See Also:
DCAPICK
dc_achoice()
dc_appendmode()
Set the default mode of operation for DC_AddRec()
Syntax:
DC_AppendMode ( < nMode > ) - > nOldMode
Arguments:
< nMode > is a number designating the desired append mode.
If the Append Mode is 0 (default), then DC_ADDREC() will always
append a Blank record.
If the Append Mode is 1, then DC_ADDREC() will first try to
locate any existing Blank record in the database. If a Blank
record is found, the record pointer will be set to the found
record and the record will be locked. This mode functions
differently based on whether or not the current work area
has an index selected. If an index is selected, then it is
assumed that blank records will always appear at the TOP of
the database so only the first record is tested, otherwise
the entire database will be search for a blank record.
If the Append Mode is 2, then DC_ADDREC() will first try to
locate any existing record that is marked for deletion. If
a deleted record is found, the record pointer will be set
to the found record, the record will be recalled (undeleted),
all fields will be blanked, and the record will be locked.
Returns:
A numeric value representing the current append mode.
Description:
DC_APPENDMODE() is used to establish the default operation of
the DC_ADDREC() function. Depending on the mode selected
DC_ADDREC() will attempt to reuse blank records or deleted
before appending a new, blank record.
Examples:
use sales
set index to month
DC_APPENDMODE(1) // re-use blank records
if dc_addrec()
replace date with date()
else
break
endif
Source/Library:
_DCLOCK.PRG, DCLIP1.DLL
See Also:
dc_addrec()
dc_appevent()
Post an Event Loop
Syntax:
DC_AppEvent( @< lOk >, ;
< nExitEvent >, ;
< nDelay > ) - > nLastEvent
Arguments:
@< lOk > is an optional logical value (passed by reference).
DC_AppEvent() will exit and return when this value is set to
.FALSE.
< nExitEvent > is an optional numeric value. DC_AppEvent() will
exit and return when the next event in the event queue is
equal to this value. < nExitEvent > defaults to 0, meaning that
the loop will exit when no more events are in the event queue.
< nDelay > is the amount of delay to use when DC_AppEvent() calls
the AppEvent() function. This defaults to 0, meaning that
event loop will not exit until an event occurs. If < nDelay >
is any value greater than 0, then this is amount of delay before
the AppEvent() function exits. < nDelay > should usually be set
to a value of .01 when using DC_AppEvent() to process events
while still processing other code. See the example.
Returns:
A numeric value equal to the last event processed in the loop.
Description:
DC_APPEVENT() is a handy function that creates an event loop for
processing events. Unlike the Xbase++ AppEvent() function,
DC_APPEVENT() contains a DO..WHILE loop that processes events as
a single function call.
Examples:
/*
This example uses DC_APPEVENT() to abort a COPY TO process.
*/
#include 'dcdialog.ch'
FUNCTION XTest()
LOCAL Getlist := {}, oProgress, oDialog, lOk := .t., oButton, ;
nEvent, mp1, mp2, oXbp
USE COLLECT VIA DBFNTX NEW SHARED
@ 2,5 DCSAY 'Exporting Data to JUNK.DBF'
@ 4,5 DCPROGRESS oProgress ;
SIZE 55,1.5 ;
MAXCOUNT RecCount() COLOR GRA_CLR_BLUE
@ 4,65 DCPUSHBUTTON CAPTION '&Cancel' ;
ACTION {||lOk:=.f.} OBJECT oButton ;
SIZE 8,1.5
DCREAD GUI TITLE 'My Test Dialog' ;
PARENT @oDialog ;
FIT ;
EXIT
oDialog:show()
COPY TO junk WHILE _Progress( oProgress, @lOk )
oButton:SetCaption('&Ok')
DC_APPEVENT( @lOk )
oDialog:Destroy()
CLOSE ALL
RETURN nil
/* ----------------- */
STATIC FUNCTION _Progress ( oProgress, lOk )
DC_GetProgress( oProgress, COLLECT->(RecNo()) )
DC_Pause(.3)
DC_APPEVENT( @lOk, 0, .01 )
RETURN lOk
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
dc_appeventdefine()
Translate AppEvent() value to DEFINE value
Syntax:
DC_AppEventDefine( < nEvent > ) - > cDefinition
Arguments:
< nEvent > is the AppEvent() to translate.
Returns:
A Character string.
Description:
DC_APPEVENTDEFINE() returns a character string that contains
the DEFINITION name for the AppEvent() value. These defines are
contained in APPEVENT.CH.
This is a handy debugging function that can be used in event
loops to display events as they are occurring like so:
DO WHILE nEvent # xbeP_None
nEvent := AppEvent( @mp1, @mp2, @oXbp )
? DC_APPEVENTDEFINE( nEvent )
oXbp:HandleEvent( nEvent, mp1, mp2 )
ENDDO
Examples:
#include 'appevent.ch'
PROCEDURE XTest()
DC_Gui(.t.)
DC_MsgBox( { DC_APPEVENTDEFINE( xbeP_Close ), ;
DC_APPEVENTDEFINE( xbeP_Resize ), ;
DC_APPEVENTDEFINE( xbeP_Activate ) } )
RETURN
Source/Library:
_DCPUTK.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_keytran()
dc_appkeydefine()
dc_appkeydefine()
Translate AppEvent() keyboard value to DEFINE value
Syntax:
DC_AppKeyDefine( < nKey > ) - > cDefinition
Arguments:
< nKey > is the AppEvent() value of the key to translate.
Returns:
A Character string.
Description:
DC_APPKEYDEFINE() returns a character string that contains the
DEFINITION name for the AppEvent() a keyboard value. These
defines are contained in APPEVENT.CH.
This is a handy debugging function that can be used in event
loops to display events as they are occurring like so:
DO WHILE nEvent # xbeP_None
nEvent := AppEvent( @mp1, @mp2, @oXbp )
IF nEvent = xbeP_Keyboard
? DC_APPKEYDEFINE( mp1 )
ENDIF
oXbp:HandleEvent( nEvent, mp1, mp2 )
ENDDO
Examples:
#include 'appevent.ch'
PROCEDURE XTest()
DC_Gui(.t.)
DC_MsgBox( { DC_APPKEYDEFINE( xbeK_ALT_M ), ;
DC_APPKEYDEFINE( xbeK_ENTER ), ;
DC_APPKEYDEFINE( xbeK_INS ) } )
RETURN
Source/Library:
_DCPUTK.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_keytran()
dc_appeventdefine()
dc_applysqlparams()
Apply SQL parameters to a SQL statement.
Syntax:
DC_ApplySQLparams( < cSQLstatement >, ;
< aParams > ) - > < cSQLstatement >
Arguments:
< cSQLstatement > is a SQL statement that contains one ? character
for each parameter in < aParams >.
< aParams > is an array of values to plug into the SQL statement.
If a parameter is enclosed in brackets, then the value in the
brackets is considered "literal" and is stuffed into the SQL command
as is without the brackets.
Returns:
A character string.
Description:
DC_ApplySQLParams() is use to pass parameters into a SQL statement.
The parameters may be type C, L, M, N, or D. Each ? in the
statement will be replaced by each passed parameter, sequentially,
Each parameter is converted to a character string value which is
compatible with SQL.
Examples:
cSQL := 'SELECT * FROM customers WHERE name=? AND zip=?'
cSQL := DC_ApplySQLParams( cSQL, {'Donnay', '83706'})
Source/Library:
_DCADS.PRG, DCLIPX.DLL
See Also:
dc_adsstatement()
dc_var2sql()
dc_ar2str()
Convert a multidimensional array to a string
Syntax:
DC_Ar2Str ( < aArray > ) - > cString
Arguments:
< aArray > is any multidimenstional array.
Returns:
A character string.
Description:
DC_Ar2Str() will convert the contents of any multi-dimensional
array to a string for later restoring with DC_Str2Ar(). The
string may then be saved to a file or to a character or memo
type database field. This set of functions is an alternative
to using the Xbase++ functions Var2Bin() and Bin2Var() because
they will create a runtime error if the array contains code
blocks with non-persistent data.
If the array contains code blocks, the code blocks will be
saved and restored provide that they contain persistent data.
Any code block that contains non-persistent data will be
saved as a NIL.
If the array contains pointers to objects, they pointers will
be saved as a NIL.
Examples:
PROCEDURE XTest()
LOCAL aDir
aDir := Directory()
USE dirs
APPEND BLANK
REPL DIRS->array WITH DC_Ar2Str(aDir)
aDir := DC_Str2Ar(DIRS->array)
DC_ArrayView(aDir)
RETURN
Source/Library:
_DCASAVE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_str2ar()
dc_asave()
dc_arestore()
Restore a multidimensional array from a binary file
Syntax:
DC_ARestore ( < cFileName > ) - > aArray
Arguments:
< cFileName > is the name of the binary file that was previously
created with DC_ASAVE().
Returns:
A multidimensional array if the array file was a valid file,
otherwise returns a NIL.
Description:
DC_ARESTORE() will create an multidimensional array from the
contents of a binary file that was created with DC_ASAVE().
If the array contains code blocks, the code blocks will be
saved and restored provide that they contain persistent data.
Any code block that contains non-persistent data will be
restored as a NIL.
If the array contains pointers to objects, they pointers will
be restored as a NIL.
Examples:
PROCEDURE XTest()
LOCAL aDir1, aDir2
DC_Gui(.t.)
aDir1 := Directory()
dc_asave( aDir1, 'ADIR.ARX' )
aDir2 := DC_ARESTORE( 'ADIR.ARX' )
DC_Achoice( 5,10,20,30, DC_AConvert( aDir2 )[1] )
RETURN
Source/Library:
_DCASAVE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_asave()
dc_areverse()
Reverse all elements in an array
Syntax:
DC_AReverse ( < aArray > ) - > aNewArray
Arguments:
< aArray > is the name of the array to reverse.
Returns:
An array of the same length as the original array.
Description:
DC_AREVERSE() is used to sort all the elements of an array
in reverse order from the original array.
Examples:
myArray := { 1, 2, 'test', .t. }
outArray := DC_AREVERSE( myArray )
// contents of outArray : { .t., 'test', 2, 1 }
Source/Library:
_DCARRAY.PRG, DCLIP1.DLL
See Also:
dc_aconvert()
dc_array_r()
Create a multi-dimensional array from an array text file
Syntax:
DC_Array_Read ( < cArrayFile > ) - > aArray
Arguments:
< cArrayFile > is the name of the array text file to read.
Returns:
A multi-dimensional array built from the contents of <þcArrayFileþ>.
Description:
DC_ARRAY_R() is used to create a multi-dimensional array
from the contents of an array text file. Only elements of the
type L (logical), N (numeric), C (character), D (date), A
(array) can be saved and restored.
Examples:
PROCEDURE XTest()
LOCAL aDir1, aDir2, cScrn
DC_Gui(.t.)
cScrn := DC_WaitOn()
aDir1 := directory()
dc_array_w( aDir1, "DIR.AR" )
aDir2 := DC_ARRAY_R( "DIR.AR" )
DC_Impl(cScrn)
DC_Achoice( 5,10,20,30, DC_AConvert( aDir2 )[1] )
RETURN
Source/Library:
_DCARRAY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_array_w()
dc_array_w()
Write contents of a multi-dimensional array to file
Syntax:
DC_Array_Write ( < aArray >, ;
< cArrayFile > ) - > lStatus
Arguments:
< aArray > is the name of the multi-dimensional array to save.
< cArrayFile > is the name of the array text file to write.
Returns:
.TRUE. if the array file was created, .FALSE. otherwise.
Description:
DC_ARRAY_W() is used to save a multi-dimensional array to
an array text file for later restoring with the DC_ARRAY_R()
function for RESTORE ARRAY command. Only elements of the type
L (logical), N (numeric), C (character), D (date), A (array)
can be saved and restored.
Examples:
PROCEDURE XTest()
LOCAL aDir1, aDir2, cScrn
DC_Gui(.t.)
cScrn := DC_WaitOn()
aDir1 := directory()
DC_ARRAY_W( aDir1, "DIR.AR" )
aDir2 := dc_array_r( "DIR.AR" )
DC_Impl(cScrn)
DC_Achoice( 5,10,20,30, DC_AConvert( aDir2 )[1] )
RETURN
Source/Library:
_DCARRAY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_array_r()
dc_array2csv()
Create a comma-delimeted CSV file from data in an array
Syntax:
DC_Array2CSV( < cCsvFile >, ;
< aData >, ;
[< aHeader >] ) - > lStatus
Arguments:
< cCsvFile > is the name of the comma-delimted file (*.CSV) to be
created.
< aData > is a 2-dimensional array containing the data.
< aHeader > is a 1-dimensional array with header information.
Returns:
A logical .true. if the file could be created, .false. otherwise.
Description:
DC_Array2CSV() is use to create a comma-delimited (*.CSV)
file from the data in a 2-dimensional array.
Examples:
aDir := Directory()
aHeader := { 'File Name', 'File Size', 'File Date' ,'File Time' }
DC_Array2CSV('DIRECTORY.CSV',aHeader)
DC_SpawnUrl('DIRECTORY.CSV')
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL, DCLIPX.LIB
dc_array2excel()
Create an Excel Spreadsheet from data in an array
Syntax:
DC_Array2Excel( [< cExcelFile >], ;
< aData >, ;
[< nOrientation >], ;
[< lDisplayAlerts >], ;
[< lVisible >], ;
[< lAutoFit >], ;
[< lTrimNilColumns >], ;
[< lCombineSheets >], ;
[< cPassWord >], ;
[< lFreezeRow1 >], ;
[< lCSVFallBack >] ) - > lStatus
Arguments:
< cExcelFile > is the name of the excel file (*.XLS) to be created.
If this parameter is not passed, the file will be created in the
same directory as the application .exe and will be named WORKSHEET.XLS.
< aData > is the array containing the data. This must be an array
of 2-dimensional sub-arrays (one for each Excel sheet).
< nOrientation > is the orientation of the spreadsheet. A value of
1 creates a "portrait" orientation. A value of 2 creates a
"landscape" orientation (default).
< lDisplayAlerts > will prompt the user if the file being created
will be overwritten. The default is .f.
< lVisible > will display the spreadsheet while the cells are being
filled. Default is .f.
< lAutoFit > will optimize the columns of the spreadsheet to fit
the data to it's optimum width, otherwise the columns will be
the width of the database field. Default is .t.
< lTrimArray > will remove all columns and rows from the array that
contain all NIL values to optimize the resultant spreadsheet. The
default is .f.
< lCombineSheets > will create a single Excel sheet from the data
in all subarrays. Instead of writing the data to separate sheets
the data from each sheet will be added as additional rows to
the first sheet. The default is .f.
< cPassWord > is an optional password to assign to the file.
< lFreezeRow1 > if .TRUE. causes the first row of the Excel sheet to
be
bold font and locked from scrolling. The default is .FALSE.
< lCsvFallBack > if .TRUE. will cause the output to be a .CSV file in
the event that the Excel ActiveX control is not installed.
Returns:
A logical .true. if the spreadsheet could be created, .false.
otherwise.
Description:
DC_Array2Excel() is use to create an Excel spreadsheet (*.XLS)
file from the data in a 2-dimensional array.
Examples:
aDir := Directory()
aDir := { aDir }
DC_Array2Excel('DIRECTORY.XLS',aDir)
DC_SpawnUrl('DIRECTORY.XLS')
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL, DCLIPX.LIB
dc_array2hexstring()
Convert a multidimensional array to a hex string
Syntax:
DC_Array2HexString ( < aArray > ) - > cString
Arguments:
< aArray > is any multidimensional array that contains variables of
type
C, M, D, L, or N.
Returns:
A character string.
Description:
DC_Array2HexString() will convert the contents of any multi-dimensional
array to a string for later restoring with DC_HexString2Array(). The
string may then be saved to a file or to a character or memo type
database field.
This function is mainly intended for use on the internet when an array
of information must be passed in an XML stream.
Source/Library:
_DCASAVE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_hexstring2array()
dc_ar2str()
dc_asave()
dc_array2js()
Convert an array to JSON
Syntax:
DC_Array2JS( < aArray > ) - > cJson
Arguments:
< aArray > is any multi-dimensional array.
Returns:
A character string.
Description:
DC_Array2JS() is used to convert an array to JSON (Javascript Object
Notation). The array may contain any Xbase++ value including
subarrays and objects. Only the iVars in the objects will be
converted.
See Also:
dc_object2js()
dc_array2xml()
dc_object2xml()
dc_array2prg()
Save the contents of a multidimensional array to source code
Syntax:
DC_Array2Prg ( < aArray >, ;
< cFileName >, ;
[< cFunction >], ;
[< cComments >], ;
[< cCode >] ) - > lStatus
Arguments:
< aArray > is the name of the array to write.
< cFileName > is the name of the file to create.
< cFunction > is the name of the function to call that will
return the array contents. If this parameter is not passed
then the function will be given the same name as the file.
< cComments > is any comment heading to place at the top of
the file.
< cCode > is any source code that should be executed at the
beginning of the function before returning the array
contents.
Returns:
A logical .t. if the file was created.
Description:
DC_ARRAY2PRG() is used to create a .PRG file from the contents
of a multi-dimensional array. This allows the programmer
to capture the contents of any array to a source code file
that can be compiled and run to rebuild the array.
Notes:
If the file being created already exists, then the user
will be prompted to Append, Overwrite or Abort the
operation.
Examples:
-- Example 1 --
. aMyArray := directory()
. DC_ARRAY2PRG( aMyArray, "MYDIR" )
. clip mydir // compile mydir.prg
. obj mydir // load mydir.obj
. aNewArray := MYDIR()
-- Example 2 --
. use all like cust*
. browse tile // configure browse windows
. DC_ARRAY2PRG( DCBROWSE, 'MYBROWSE' )
. clip mybrowse // compile mbrowse.prg
. obj mybrowse // load mybrowse.obj
. release dcbrowse // kill old browse array
. dcbrowse := MYBROWSE()
Source/Library:
_DCARRAY.PRG, DCLIP1.DLL
See Also:
dc_asave()
dc_array2sqlinsert()
Create SQL statement for inserting records
Syntax:
DC_Array2SQLInsert( < aData >, < cTable > ) - >
cSQLStatement
Arguments:
< aData > is a 2-dimensional array of values to write to the database
or a 1-dimensiona array of record objects to write to the database.
Returns:
A character string.
Description:
DC_Array2SQLInsert() is used to create a SQL statement for inserting
records into a database. This accepts an 2-dimensional array
that matches the order of fields or a 1-dimensional array of
record objects.
Notes:
This function is handy when processing a lot of transactions that
require adding many records to a database at one time. Normal
append() require locking and unlocking and also take a considerable
amount of time. SQL INSERT, on the other hand, is very fast
because everything is being done on the server. In addition
a BEGIN TRANSACTION is put into the SQL at the beginning and a
COMMIT WORK at the end. This insures that no other task or
workstation can write to the database until all records are
inserted.
Examples:
USE TRANS
aRecords := {}
oRecord := DC_DBRecord():new()
TRANS->(dbGoTo(0))
oRecord:date := Date()
...
oRecord:tran_type := 'LOGIN'
AAdd(aRecords,oRecord)
cSQL := DC_Array2SqlInsert(aRecords)
Source/Library:
_DCSQL.PRG, DCLIPX.DLL
See Also:
dc_adsstatement()
dc_array2xml()
Convert an array to XML
Syntax:
DC_Array2Xml( < aArray > ) - > cXML
Arguments:
< aArray > is any multi=dimensional array that includes any Xbase++
value including subarrays and objects. Only the iVars of objects
are included in the XML.
Returns:
A character string.
Description:
DC_Array2XML() converts an array to an XML string.
Source/Library:
_DCFUNCT.PRG
See Also:
dc_object2xml()
dc_array2js()
dc_object2js()
dc_arrayview()
A Tree style array/object browser
Syntax:
DC_ArrayView( < aArray > | < oObject >, ;
[< lExpand >] ) - > nil
Arguments:
< aArray > is any type of array.
< oObject > is any type of object.
< lExpand > if .TRUE. will expand the tree. The default is .FALSE.
Returns:
NIL.
Description:
DC_ARRAYVIEW() is used to browse multidimensional arrays
and/or objects using a Tree-View style browser.
The array can be any type of array with any dimensions and may
contain any type of data. When expanding the array tree, the
user has the option of opening a new window to display the
contents of the sub-tree. When expanding an object, the user
has the option of displaying the properties of the object
using DC_InspectObject().
Examples:
PROCEDURE XTest()
LOCAL aDir
aDir := directory()
DC_ArrayView( aDir )
RETURN
Source/Library:
_DCARRAY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_inspectobject()
dc_asave()
Save a multidimensional array to a binary file
Syntax:
DC_ASave ( < aArray >, ;
< cFileName > ) - > lStatus
Arguments:
< aArray > is any multidimenstional array.
< cFileName > is the name of the binary file to create with
the array contents.
Returns:
A logical .TRUE. if the array file was created, .FALSE.
otherwise.
Description:
DC_ASAVE() will save the contents of any multi-dimensional
array to a binary file for later restoring with DC_ARESTORE().
If the array contains code blocks, the code blocks will be
saved and restored provide that they contain persistent data.
Any code block that contains non-persistent data will be
saved as a NIL.
If the array contains pointers to objects, they pointers will
be saved as a NIL.
Examples:
PROCEDURE XTest()
LOCAL aDir1, aDir2
DC_Gui(.t.)
aDir1 := Directory()
DC_ASAVE( aDir1, 'ADIR.ARX' )
aDir2 := DC_Arestore( 'ADIR.ARX' )
DC_Achoice( 5,10,20,30, DC_AConvert( aDir2 )[1] )
RETURN
Source/Library:
_DCASAVE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_arestore()
SAVE ARRAY
dc_at_clear()
Clear all prompts added by DC_At_Prompt()
Syntax:
DC_At_Clear() - > nil
Arguments:
None
Returns:
NIL
Description:
DC_AT_CLEAR() is used to clear the array that holds the
menu prompts created with DC_AT_PROMPT(). This array
is automatically cleared after calling DC_MENU_TO() so
it is not necessary to call this function unless you
wish to simply display menu prompts and not call the
DC_MENU_TO() function to get a user selection.
Examples:
dc_at_prompt( 10, 10, "Open a File", "Use a new database" )
DC_AT_CLEAR() // changed my mind
Source/Library:
_DCMENU2.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_at_prompt()
dc_menu_to()
dc_at_prompt()
A moused replacement for AT..PROMPT
Syntax:
DC_At_Prompt( < nRow >, ;
< nCol >, ;
< cPrompt >, ;
[< cMessage >] ) - > nil
Arguments:
< nRow > is the screen row to display the prompt.
< nCol > is the screen column to display the prompt.
< cPrompt > is the prompt to display on the screen.
< cMessage > is an optional message to display at the coordinates
defined by the SET MESSAGE environment variable or by the
message coordinates passed to DC_MENU_TO().
Returns:
NIL
Description:
DC_AT_PROMPT() is used with DC_MENU_TO() to replace Clipper
@..PROMPT / MENU TO commands with a "mouseable" menu prompt
system. The prompts and menu will behave exactly like the
Clipper MENU TO system except the left button of the mouse will
high-light the selected prompt, and the right button performs
the same function as the <þENTERþ> key.
Examples:
// display prompts
DC_AT_PROMPT( 10, 10, "Open a File", "Use a new database" )
DC_AT_PROMPT( 12, 10, "Open an Index", "Use an Index file" )
DC_AT_PROMPT( 14, 10, "Edit database", "Browse all records" )
// get a user selection and display message at row 20, col 25
nChoice := dc_menu_to( 1, 20, 25 )
Source/Library:
_DCMENU2.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_at_clear()
dc_menu_to()
dc_atnext()
Find the next occurrence of a string in another string
Syntax:
DC_AtNext ( < cCharacter >, ;
< cString >, ;
< nOccurrence > ) - > nPosition
Arguments:
< cCharacter > is the character or substring to search.
< cString > is the string to search.
< nOccurrence > is the occurrence of < cCharacter > in
< cString > to
find.
Returns:
The numeric location of the <þnOccurenceþ> of <þcCharacterþ>
in
<þcStringþ>. If not found then 0 is returned.
Description:
DC_ATNEXT() is used to return the location of the nth occurence
of a substring within a string.
Examples:
PROCEDURE XTest()
LOCAL cString
DC_Gui(.t.)
cString := 'this is a test'
DC_MsgBox( { cString, ;
DC_ATNEXT( 'is', cString, 1 ), ;
DC_ATNEXT( 'is', cString, 2 ) } )
RETURN
Source/Library:
_DCATNXT.PRG/.OBJ, DCLIPX.LIB
dc_atoattr()
Convert a Clipper color string to a screen color attribute
Syntax:
DC_AtoAttr ( < cColorString > ) - > nColor
Arguments:
< cColorString > is a valid Clipper color string.
Returns:
A character string.
Description:
DC_ATOATTR() is used to convert a Clipper color string to
a numeric screen attribute. Screen attributes are represented
as a number from 0 to 255 for a total of 256 colors. Clipper
functions require that a color string be used for setting
colors rather than a number.
Examples:
PROCEDURE XTest()
DC_Gui(.t.)
DC_MsgBox( { DC_ATOATTR( 'R/GR' ), ;
DC_ATOATTR( 'N/N' ), ;
DC_ATOATTR( 'W+*/W' ) } )
RETURN
Source/Library:
_DCCOLOR.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_attrtoa()
dc_attrtoa()
Convert a screen color attribute to a color string
Syntax:
DC_AttrtoA ( < nColor > ) - > cColorString
Arguments:
< nColor > is a number from 0 to 256.
Returns:
A character string.
Description:
DC_ATTRTOA() is used to convert a screen attribute to a
color string. Screen attributes are represented as a
number from 0 to 255 for a total of 256 colors. Clipper
functions require that a color string be used for setting
colors rather than a number.
Examples:
PROCEDURE XTest()
DC_Gui(.t.)
DC_MsgBox( { DC_ATOATTR( 'R/GR' ), ;
DC_ATOATTR( 'N/N' ), ;
DC_ATOATTR( 'W+*/W' ) } )
RETURN
Source/Library:
_DCCOLOR.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_atoattr()
dc_autoresize()
Resize all objects to fit on the resized parent
Syntax:
DC_AutoReSize( < aOldSize >, ;
< aNewSize >, ;
< oParent >, ;
< aGetList >, ;
< lToolBars > ) - > nil
Arguments:
< aOldSize > is a 2 element array containing the width and height
in pixels of the dialog window before resize.
< aNewSize > is a 2 element array containing the widht and height
in pixels of the dialog window after resize.
< oParent > is the parent object.
< aGetList > is the GetList array that was passed to DC_ReadGui().
< lToolBars > if .FALSE. will not resize DCTOOLBAR or XbpPushButton
objects. These objects, if using bitmaps can truncate the image
when resized. The position of the ToolBar or PushButton will
change accordingly but the size will not change. The default
is .TRUE. (resize all toolbars and pushbuttons).
Returns:
NIL.
Description:
DC_AutoReSize() is used to automatically resize and reposition
all child objects so they use the real estate of the parent in
the same proportions as the child objects before the parent was
resized.
DC_AutoReSize() is designed to be placed in a code block that is
attached to the :resize callback slot of the parent object.
The complete childlist tree is resized.
Notes:
DC_AutoReSize() will not resize or reposition anything on a
dialog that was painted with a Gra*() function or a DCGRA*
command.
Due to a bug in Xbase++ 1.3 make sure to add o:hide() and o:show()
to your resize code block or the screen may leave some undesirable
side effects after resizing objects.
Examples:
FUNCTION XTest()
LOCAL GetList := {}, oDesc, oBrowse
USE COLLECT VIA DBFNTX
@ 12,0 DCSAY COLLECT->descrip SAYSIZE 50 ;
SAYOBJECT oDesc COLOR GRA_CLR_BLUE FONT '12.Courier Bold'
@ .5,.5 DCBROWSE oBrowse ALIAS 'COLLECT' SIZE 49,9 ;
EVAL {|o|o:itemMarked := {||oDesc:setCaption(COLLECT->descrip)} } ;
HEADLINES 2 DELIMITER CHR(13)+CHR(10)
DCBROWSECOL FIELD COLLECT->descrip HEADER
"Description"+CHR(13)+CHR(10)+"Line 2" ;
PARENT oBrowse WIDTH 50
DCREAD GUI FIT ADDBUTTONS ;
EVAL {|o| o:resize := ;
{|a,b,o|DC_AUTORESIZE(a,b,o,GetList),o:hide(),o:show()} }
RETURN nil
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
DCGETOPTIONS
DC_AutoRestoreBrowse()
Automatically Save/Restore Browse Configurations.
Syntax:
DC_AutoRestoreBrowse( [< aParams >] ) - > aOldParams
Arguments:
< aParams > is a 2-element array.
Element Type Description
------- ---- ------------------------------------------------------
[1] N/B The key value of the registry item to write. The
default is HKEY_LOCAL_MACHINE.
The available options are defined in DCREG.CH.
HKEY_NO_KEY
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
Optionally, this element may contain a codeblock to evaluate.
If this is a codeblock, then the registry will not be used.
Instead, the codeblock is evaluated when saving or restoring
the coordinate array. When writing, 2 parameters are passed
to the codeblock: (1) the window title and (2) the array of
coordinates. When reading, 1 parameter is passed to the
codeblock () the window title.
[2] C The entry name in the registry to store the information.
This element is not used if Element 1 is a codeblock.
[3] L Default Restore / NoRestore mode. If .TRUE. then the
default for restoring windows is ON and the override clause
of DCREAD GUI is NOAUTORESTORE. If .FALSE., then the
default for restoring windows will be OFF, and the override
clause of DCREAD GUI is AUTORESTORE.
Returns:
An array of 2 elements.
Description:
DC_AutoRestoreBrowse() is a Get-Set function that is used to
Get/Set the Registry directory to be used for storing Browse
column sizes and positions. Data is saved to the registry when a
browse is destroyed and is restored from the registry when a browse
is created.
If the user resizes columns and/or moves columns using the
DC_XbpBrowse:moveColumn() method, then the information will be
automatically saved to the registry for restoring later.
The name assigned to the item saved in the registry is the
function name that contains the DCREAD GUI command concatenated
with the ID of the DCBROWSE. This will insure that each name
is unique (required).
Optionally, the window sizes and coordinates can be written to
a file or a database by using a custom codeblock.
Notes:
The browse configuration will not be restored unless the
DCBROWSE command is immediately followed by a set of DCBROWSECOL
commands in the GetList.
DCBROWSE commands must have a unique ID for this feature to be
activated. The ID must only be unique if there are multiple
DCBROWSE windows in the same procedure or function.
Examples:
aParams := { HKEY_LOCAL_MACHINE, ;
'\Software\Donnay Software\Xdemo\Browses' }
DC_AutoRestoreBrowse(aParams)
For more samples see \exp19\samples\autorestore.
Source/Library:
_DCGETBX.PRG
See Also:
@ DCBROWSE
DC_AutoRestoreWindow()
DC_RegWrite()
DC_RegQuery()
DC_AutoRestoreWindow()
Automatically Save/Restore window coordinates
Syntax:
DC_AutoRestoreWindow( [< aParams >] ) - > aOldParams
Arguments:
< aParams > is a 3-element array.
Element Type Description
------- ---- ------------------------------------------------------
[1] N/B The key value of the registry item to write. The
default is HKEY_LOCAL_MACHINE.
The available options are defined in DCREG.CH.
HKEY_NO_KEY
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
Optionally, this element may contain a codeblock to evaluate.
If this is a codeblock, then the registry will not be used.
Instead, the codeblock is evaluated when saving or restoring
the coordinate array. When writing, 2 parameters are passed
to the codeblock: (1) the window title and (2) the array of
coordinates. When reading, 1 parameter is passed to the
codeblock () the window title.
[2] C The entry name in the registry to store the information.
This element is not used if Element 1 is a codeblock.
[3] L Default Restore / NoRestore mode. If .TRUE. then the
default for restoring windows is ON and the override clause
of DCREAD GUI is NOAUTORESTORE. If .FALSE., then the
default for restoring windows will be OFF, and the override
clause of DCREAD GUI is AUTORESTORE.
Returns:
An array of 2 elements.
Description:
DC_AutoRestoreWindow() is a Get-Set function that is used to
Get/Set the Registry directory to be used for storing window
sizes and coordinates. Data is saved to the registry when a
window is closed and is restored from the registry when a window
is created.
The name assigned to the item saved in the registry is the
function name that contains the DCREAD GUI command concatenated
with the title of the window. This will insure that each name
is unique (required).
Optionally, the window sizes and coordinates can be written to
a file or a database by using a custom codeblock.
Notes:
The window size will not be restored if the NORESIZE clause of
DCGETOPTIONS was used when creating the window. Only the position
of the window will be restored.
Examples:
aParams := { HKEY_LOCAL_MACHINE, ;
'\Software\Donnay Software\Xdemo\Windows' }
DC_AutoRestoreWindow(aParams)
For more samples see \exp19\samples\autorestore.
Source/Library:
_DCGETBX.PRG
See Also:
DC_AutoRestoreBrowse()
DC_RegWrite()
DC_RegQuery()
dc_average()
Average numeric fields in selected database
Syntax:
DC_Average() - > lStatus
Arguments:
None.
Returns:
A logical .TRUE. if the average was not aborted.
Description:
DC_Average() is used to average numeric fields from the currently
selected database based on a set of conditions. As GUI dialog
window is displayed for the user to select the conditions.
Examples:
. USE COLLECT
. DC_Average()
Source/Library:
_DCSUM.PRG, DCLIP2.DLL
See Also:
SUM
dc_basefont()
A Get-Set function for setting the Base Font for dialog objects
Syntax:
DC_BaseFont( [< nPointSize >], ;
[< cFontName >], ;
[< lBold >] ) - > < cFontCompoundName >
Arguments:
< nPointSize > is the point size.
< cFontName > is the font family name.
< lBold > if .TRUE. will set the font to bold.
Description:
DC_BaseFont() is a Get-Set function that is used to set the base font for
dialog items.
The default is 8.MS Sans Serif
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_batch()
Process a Batch file with Dot-Prompt commands
Syntax:
dc_batch ( < cFileName >, ;
[< c1 >], ;
[< c2 >], ;
[< c3 >], ;
[< c4 >], ;
[< c5 >] ) - > nil
Arguments:
< cFileName > is the name of the batch file to run. If the
extension is not given then .DCB is assumed.
< c1 > , < c2 >, < c3 >, < c4 >, < c5 >
are optional parameters that are
received in the batch file via the PARAMETERS command.
Returns:
Nil.
Description:
DC_Batch() will execute all commands in a .DCB batch file in
sequential order. A batch file can include any commands which
can be entered at the dot-prompt and executed by the eXPress++
interpreter other than structural commands, like DO WHILE, DO CASE
IF..ENDIF or FOR..NEXT. All commands in DCSTD.CH, DCDIALOG.CH,
or DCCUSTOM.CH may be used in batch files.DC_BATCH() is used to open and
execute a .DCB batch file. A
"batch" file can contain any commands that can be interpreted
at the dot prompt, including commands in .CH files which
have been included in DCCUSTOM.CH.
Notes:
DC_Dot() will automatically execute an AUTOEXEC.DCB batch file
found in the directory containing the executable program or
the or the directory named by the dos SET DCLIP=<þdirectoryþ>
environment setting.
Examples:
DC_BATCH('test.dcb',Date(),Time()) // run TEST.DCB file
* TEST.DCB
PARAMETERS dDate, cTime
FOR i := 1 TO 10
DCQDEBUG dDate + i
NEXT
DCQDEBUG cTime
Source/Library:
_dcbatch.prg, DCLIP1.DLL
See Also:
BATCH
dc_batchnewthread()
dc_batchnewthread()
Process a Batch file in a new thread
Syntax:
DC_BatchNewThread ( < cFileName >, ;
[< c1 >], ;
[< c2 >], ;
[< c3 >], ;
[< c4 >], ;
[< c5 >] ) - > nil
Arguments:
< cFileName > is the name of the batch file to run. If the
extension is not given then .DCB is assumed.
< c1 > , < c2 >, < c3 >, < c4 >, < c5 >
are optional parameters that are
subsituted by %1 - %5 respectively in the batch file commands.
Returns:
Nil.
Description:
DC_BatchNewThread() functions identically to DC_Batch() except
it will execute in a new thread.
Notes:
DC_Dot() will automatically execute an AUTOEXEC.DCB batch file
found in the directory containing the executable program or
the or the directory named by the dos SET DCLIP=<þdirectoryþ>
environment setting.
Examples:
. DC_BatchNewThread('test.dcb') // run TEST.DCB file
Source/Library:
_dcbatch.prg, DCLIP1.DLL
See Also:
BATCH
dc_batch()
dc_bin2num()
Converts a Binary String to a Number
Syntax:
DC_Bin2Num( < cBinary > ) - > nDecimal
Arguments:
< cBinary > is a string of up to eight 1's and 0's.
Returns:
A numeric value from 0 - 255
Description:
DC_BIN2NUM() will convert a binary string to a numeric value.
Source/Library:
_DCAND.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_bittest()
dc_xorbits()
dc_bitmapdraw()
Redraw a Bitmap Object on a GUI dialog screen
Syntax:
DC_BitMapDraw ( < oParent >, ;
< ncbResource > ) - > nil
Arguments:
< oParent > is the Static object that contains the presentation
space for the bitmap.
< ncbResource > may be any of the following:
1. The number of a resource that has been linked to the .EXE
2. A character string with the name of a *.BMP file, a *.JPG file,
a *.GIF file or a *.PNG file.
3. An XbpBitMap() object.
4. A code block which, when evaluated, returns a number, character
string or XbpBitMap() object.
Returns:
Nil.
Description:
DC_BITMAPDRAW() is used to redraw a Bitmap object that was created
with the DCBITMAP command and painted on a dialog screen with
DC_READGUI().
This function is used to load a new *.BMP file into the
presentation space previously created from the DCBITMAP object
in the GetList.
Examples:
#include 'dcdialog.ch'
PROCEDURE XTest()
LOCAL GetList := {}, cBitMap1, cBitMap2, oPhoto1, oPhoto2
USE COLLECT NEW SHARED
SKIP 2
cBitMap1 := COLLECT->bitmap1
cBitMap2 := COLLECT->bitmap2
@ 2,2 DCSTATIC XBPSTATIC_TYPE_RAISEDBOX SIZE 33,10 ;
OBJECT oPhoto1
@ 2,37 DCSTATIC XBPSTATIC_TYPE_RAISEDBOX SIZE 33,10 ;
OBJECT oPhoto2
DCBITMAP cBitMap1 PARENT oPhoto1 AUTOSCALE
DCBITMAP cBitMap2 PARENT oPhoto2 AUTOSCALE
@ 1,3 DCSAY 'Photo 1' GET cBitMap1 ;
SAYRIGHT SAYSIZE 10 ;
DATALINK {||DC_BitMapDraw(oPhoto1,cBitMap1)}
@ 1,38 DCSAY 'Photo 2' GET cBitMap2 ;
SAYRIGHT SAYSIZE 10 ;
DATALINK {||DC_BitMapDraw(oPhoto2,cBitMap2)}
DCREAD GUI ;
FIT ;
ADDBUTTONS
RETURN
Source/Library:
_DCFUNCT.PRG/.OBJ, DCLIPX.LIB
See Also:
DCBITMAP
dc_readgui()
DIALOG GETLIST
dc_bitmapresourcefile()
Get-Set function used to set a list of resource DLLs for bitmaps
Syntax:
DC_BitmapResourceFile( [< aDllList >] ) - > aOldDllList
Arguments:
< aDllList > is an array of numeric DLL handles.
Returns:
An array.
Description:
DC_BitmapResourceFile() is a Get-Set function that is used to
establish a list of resource DLLs for finding bitmaps. All
bitmaps in eXpress++ are loaded via the function DC_GetBitmap().
This function always returns a bitmap object of type XbpBitmap().
This function now runs through a loop to try to load resources
from Dlls set with DC_BitmapResourceFile() if the named resource
is not linked to the EXE, therefore bitmaps with a numeric resource
ID can now be in multiple DLLs and do not need to be linked to the
.EXE.
Examples:
nResDll1 := LoadDll('MYBITMAPS.DLL') // load my custom bitmaps
nResDll2 := LoadDll('DCRES.DLL') // load eXpress++ bitmaps
DC_BitmapResourceFile( { nResDll1, nResDll2 } )
DCADDBUTTON CAPTION MYBITMAP_PERSON // defined in MYBITMAPS.DLL
DCADDBUTTON CAPTION BITMAP_HELP_M // defined in DCRES.DLL
This eliminates the need to use the RESFILE clause when defined
bitmap captions. Also, if the RESTYPE clause is not used, then
the resources must be of type BITMAP, GIF, JPEG, BMP or PNG in
your resource DLLs.
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.DLL
See Also:
dc_getbitmap()
dc_bitmaptransparentcolor()
Set RGB transparent color for pushbutton bitmaps
Syntax:
DC_BitmapTransparentColor( [< anColor >] ) - > nOldColor
Arguments:
< anColor > is a 3-element array containing numeric RGB values or
an numeric equivalent of an RGB color.
Returns:
A numeric value.
Description:
DC_BitmapTransparentColor() is a Get-Set function that is used
to set the RGB value of the transparent color used with Bitmaps
that are placed on DCPUSHBUTTON objects.
Examples:
// set the transparent color to medium gray (the background
// color of the bitmaps)
aColor := { 192, 192, 192 }
DC_BitmapTransparentColor( aColor )
@ 0,0 DCPUSHBUTTON CAPTION DCBITMAP_FIND_1 SIZE 10,2
DCREAD GUI FIT
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
See Also:
@ DCPUSHBUTTON
dc_getbitmap()
dc_bittest()
Tests if a bit is set to 1 or 0 in a number
Syntax:
DC_BitTest( < nDecimal >, ;
< nBit > ) - > lStatus
Arguments:
< nDecimal > is a numeric value from 0 to 255.
< nBit > is the bit to test. This is a value from 1 to 8.
Returns:
A logical .TRUE. if the bit is a 1 and a logical .FALSE. if
the bit is a 0.
Description:
DC_BITTEST() will test for a specified bit in a number.
Source/Library:
_DCAND.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_andbits()
dc_blank()
Blank all fields in the current record
Syntax:
DC_Blank( [< lCommit >] ) - > lStatus
Arguments:
< lCommit > if .TRUE. (default) will commit the changes to disk.
Returns:
A logical .TRUE. if the record was blanked.
Description:
DC_BLANK() is used to blank the contents of all fields in the
current record of the current work area. It is not necessary
to lock the record because DC_BLANK() will also lock and unlock
the record before blanking the contents.
Examples:
. USE COLLECT
. GO 5
. DC_Blank()
Source/Library:
_dcblank.prg, DCLIP1.DLL
See Also:
BLANK
dc_isblank()
dc_bof()
Is the record pointer at the beginning of the file?
Syntax:
DC_Bof() - > lStatus
Arguments:
None.
Returns:
A logical value.
Description:
DC_BOF() is used to test whether or not DC_DbSkip() attempted
to move the record pointer past the top record in a "scoped"
set of records when using a negative skip value. If no scope
is set or the ADSDBE is being used as the data driver for the
current work area this function simply calls Bof() therefore
it can be used as a replacement for Bof().
Notes:
Examples:
DC_SetScope(0,'12001')
DC_SetScope(1,'12001')
DC_DbGoBottom()
DO WHILE !DC_Bof()
DC_DbSkip(-1)
ENDDO
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_setscope()
dc_eof()
dc_dbskip()
dc_dbgotop()
dc_dbgobottom()
dc_browcelledit()
Edit Cells of a Browse Object
Syntax:
DC_BrowCellEdit( < oBrowse >, ;
[< nRow >], ;
[< nCol >], ;
[< nEditMode >], ;
[< lArray >], ;
[< abDefault >], ;
[< bEval >] ) - > nil
Arguments:
< oBrowse > is the browse object to edit, insert or delete. This
must be an object of the XbpBrowse class.
< nRow > is the starting row. If this argument is not passed,
then the currently selected row is the default. < nRow > must
be a numeric value within the currently visible number of rows.
< nCol > is the starting column. If this argument is not passed,
then the currently selected column is the default. < nCol > must
be a numeric value between 1 and the total number of columns in
the browse object.
< nEditMode > is the editing and/or navigation mode.
< nEditMode > Description
----------- ---------------------------------------
DCGUI_BROWSE_EDITEXIT Edit - Exit cell editing after ENTER key
DCGUI_BROWSE_EDITACROSS Edit - Move to next column after ENTER key
DCGUI_BROWSE_EDITDOWN Edit - Move to next row after ENTER key
DCGUI_BROWSE_INSERT Insert an element or a record
DCGUI_BROWSE_DELETE Delete current element or record
< lArray > is a logical value determining if the browsed data is an
array or a database. If .TRUE., then it is an array. If this
argument is not passed and the browse object was created via the
DCBROWSE command then this is determined automatically. If an
array is being browsed, then the :cargo iVar of the browse object
must contain an array of at least 5 elements. Element 5 is a
pointer to the array being browsed. Element 4 is a numeric
value containing a pointer to the currently selected array
element.
< abDefault > is used only when inserting an array element, ie
< nMode > is DCGUI_BROWSE_INSERT. This parameter contains either
an array or a code block which returns an array. The array
contains the default data for the inserted element. Note: array
browsers always browse multi-dimensional, symmetrical arrays, so
this array must contain the same number of sub-elements as each
array element.
< bEval > is an optional code block to evaluate before inserting,
deleting, or editing a cell row.
Description:
DC_BrowCellEdit() is used to edit the cells of any browse object.
Navigation modes allow for moving up and down within the browse
via the UP, DOWN keys or automatically moving DOWN or ACROSS
with the ENTER key.
DC_BrowCellEdit() supports WHEN code blocks for each column to
prevent the editing of a cell and VALID code blocks for each
column to validate user input.
DC_BrowCellEdit() also is used to delete an element from the
array being browsed or to insert and edit a new element.
Notes:
The :dataLink iVar of each XbpColumn object in the XbpBrowse
object is used to store the GET/SET code block for editing the
cell. If the XbpColumn objects were created by the DCBROWSECOL
command using the FIELD <þcFieldþ> clause, then it will automatically
be created as a GET/SET code block.
The :cargo iVar of each XbpColumn object in the XbpBrowse object
may be used to store WHEN clause and VALID clause information.
If the column objects were created by the DCBROWSECOL command
then the code blocks for these clauses are automatically stored
in XbpColumn:cargo. If the XbpColumn objects are NOT created by
DCBROWSECOL, then you must store an array at least 7 elements in
length into the XbpColumn:cargo instance variable.
XbpColumn:cargo[6] is used to store the VALID codeblock. This
code block is used to validate the input for each column object.
The value in the editing buffer of the cell is passed to the
code block, therefore the code block should look like so:
{ |c| !Empty(c) }
The value passed is always the same type as the value of the
field. The code block must return a logical value. If a .TRUE.
is returned or the value stored in XbpColumn:cargo is not an
array or the value stored in XbpColumn:cargo[6] is not a code
block, then the value entered will be stored. If a .FALSE. is
returned, then the editing window cannot be exited until a
.TRUE. is returned or the ESCape key is pressed.
XbpColumn:cargo[7] is used to store the WHEN codeblock. This
code block is used to prevent editing of a cell. It must always
return a logical value. If a .TRUE. is returned or the value
stored in XbpColumn:cargo is not an array or the value stored
in XbpColumn:cargo[7] is not a code block, then the cell can be
edited. If a .FALSE. is returned, then the cell will be skipped.
Examples:
#include 'dcdialog.ch'
PROCEDURE XTest()
LOCAL GetList := {}, oBrowBox, oBrowse, oToolBar, GetOptions
USE COLLECT NEW SHARED
@ 3,0 DCSTATIC XBPSTATIC_TYPE_RECESSEDBOX SIZE 78,12 ;
OBJECT oBrowBox
@ .1,.5 DCBROWSE oBrowse PARENT oBrowBox ALIAS 'COLLECT' ;
SIZE 77,11.8
DCBROWSECOL FIELD COLLECT->descrip ;
HEADER "Description" PARENT oBrowse
DCBROWSECOL FIELD COLLECT->type ;
HEADER "Type" PARENT oBrowse
DCBROWSECOL FIELD COLLECT->sub_type ;
HEADER "SubType" PARENT oBrowse
DCBROWSECOL FIELD COLLECT->location ;
HEADER "Location" PARENT oBrowse
DCBROWSECOL FIELD COLLECT->date_orig ;
HEADER "Orig Date" PARENT oBrowse
DCBROWSECOL FIELD COLLECT->date_acqu ;
HEADER "Acqu Date" PARENT oBrowse
DCTOOLBAR oToolBar
DCADDBUTTON CAPTION 'Edit Down' ;
SIZE 10 ;
PARENT oToolBar ;
ACTION {||DC_BrowCellEdit( oBrowse,,,DCGUI_BROWSE_EDITDOWN ) }
DCADDBUTTON CAPTION 'Edit Across' ;
PARENT oToolBar ;
SIZE 10 ;
ACTION {||DC_BrowCellEdit( oBrowse,,1,DCGUI_BROWSE_EDITACROSS ) }
DCGETOPTIONS ;
WINDOW WIDTH 560 ;
WINDOW HEIGHT 350
DCREAD GUI ;
OPTIONS GetOptions ;
ADDBUTTONS ;
EVAL {||oBrowse:hide(), oBrowse:show()}
RETURN
Source/Library:
_DCGETBX.PRG, DCLIPX.LIB
See Also:
@ DCBROWSE
dc_browcelleditexit()
Force an exit of the Browse Cell Editor
Syntax:
DC_BrowCellEditExit( [< nMode >] ) - > nOldMode
Arguments:
< nMode > is the value to return from the Cell Editor event handler.
This should be either DCGUI_EXIT_ABORT or DCGUI_EXIT_OK.
DCGUI_EXIT_ABORT is the same as pressing the ESCAPE key.
DCGUI_EXIT_OK is the same as pressing the ENTER key.
Returns:
A numeric value.
Description:
DC_BrowCellEditExit() is used in a cell editor validation clause
to force an exit of the cell editor.
Source/Library:
_DCGETBX.PRG, DCLIPX.LIB
See Also:
@ DCBROWSE
dc_browcelledit()
dc_browpres()
A Get/Set function for browse presentation parameters.
Syntax:
DC_BrowPres([< aPres >, ;
[< nFrame >]) - > aPres
Arguments:
< aPres > is an array of browse presentation parameters that
conforms to the specification of parameters described in the
Xbase++ documentation for XbpBrowse().
< nFrame > is used to set the frame type for the hilighlight bar.
Each frame type is defined in DCDIALOG.CH as a DCGUI_BROWSEFRAME_*
constant.
Example: @ DCBROWSE .. PRESENTATION ;
DC_BrowPres(,DCGUI_BROWSEFRAME_THICK_RECESSED)
Returns:
A presentation parameters array.
Description:
DC_BrowPres() is a Get/Set function that is used to Get or Set
a presentation parameters array for browse windows.
DC_BrowPres() returns a default set of browse paramaters if a
user-defined set of parameters is not set.
Examples:
aBrowPres := ;
{ { XBP_PP_COL_HA_FGCLR, GRA_CLR_WHITE }, /* Header FG Color */
;
{ XBP_PP_COL_HA_BGCLR, GRA_CLR_DARKGRAY }, /* Header BG Color */
;
{ XBP_PP_COL_DA_ROWSEPARATOR, XBPCOL_SEP_DOTTED }, /* Row Sep */
;
{ XBP_PP_COL_DA_COLSEPARATOR, XBPCOL_SEP_DOTTED }, /* Col Sep */
;
{ XBP_PP_COL_DA_FGCLR, GRA_CLR_BLACK }, /* Row FG Color */
;
{ XBP_PP_COL_DA_BGCLR, GRA_CLR_WHITE }, /* Row BG Color */
;
{ XBP_PP_COL_DA_ROWHEIGHT, 16 }, /* Row Height */
;
{ XBP_PP_COL_HA_HEIGHT, 10 }, /* Header Height */
;
{ XBP_PP_HILITE_FGCLR, GRA_CLR_WHITE }, /* Hilite FG color */
;
{ XBP_PP_HILITE_BGCLR, GRA_CLR_DARKBLUE }, /* Hilite BG color */
;
{ XBP_PP_COL_FA_FGCLR, GRA_CLR_WHITE }, /* Footer FG Color */
;
{ XBP_PP_COL_FA_BGCLR, GRA_CLR_DARKGRAY }, /* Footer BG Color */
;
{ XBP_PP_COL_FA_HEIGHT, 10 } /* Footer Height */
;
}
DC_BrowPres(aBrowPres)
@ 1,1 DCBROWSE oBrowse PRESENTATION DC_BrowPres()
Source/Library:
_dcpres.prg
See Also:
@ DCBROWSE
dc_browseautoseek()
Seek a record/array element based on a data entered into a GET
Syntax:
DC_BrowseAutoSeek( < nKey >, ;
< oGET >, ;
< oBrowse >, ;
[< aData >], ;
[< nColumn >], ;
[< bcPrefix >], ;
[< bFormat >], ;
[< nSeekDelay >], ;
[< bSeek >], ;
[@< nPointer >] ) - > NIL
Arguments:
< nKey > is the numeric value of the key pressed.
< oGET > is the DCGET object that is being used to enter the seek
string.
< oBrowse > is the @..DCBROWSE object that will be refreshed.
< aData > is the array being browsed. If this parameter is not
used then it is assumed that a database is being browsed.
< nColumn > is the column element of the array to scan for a
match. This parameter is used only with < aData > and is a
required parameter when browsing an array.
< bcPrefix > is the a value to insert at the beginning of the
seek string. If a code block, then it must return a string.
< bFormat > is a seek string code block. The user input buffer
passed to this code block and the return value of code block
is used for the seek.
ex: {|c|Right(Space(7)+Alltrim(cString),7)}
< nSeekDelay > is the number of seconds after a key is pressed to
wait before performing the seek. This allows a string to be
typed without performing a seek everytime a key is pressed.
The default is .1 seconds.
< bSeek > is a code block to use to do the actual seek. If this
argument is not used then the function DC_DbSeek() will be used.
The code block will receive the keyboard buffer as an argument.
The code block must return a logical value - .TRUE. if record
was found, .FALSE. if not found.
@< nPointer > is a numeric variable (passed by reference) to store
the array element selected when the user double-clicks on the
browse or presses ENTER. This value will be stored only when
using an array.
Returns:
NIL.
Description:
When browsing a database, DC_BrowseAutoSeek() is used to
automatically seek to a record in a database that matches the
text entered into a GET and refresh an associated browse object.
When browsing an array, DC_BrowseAutoSeek() is used to
automatically seek to an element of the array that matches the
text entered into a GET and refresh an associated browse object.
DC_BrowseAutoSeek() is intended to be used in a codeblock that
is assigned to the :keyboard callback slot of a DCGET object or
the GET portion of an @..DCSAY..GET object. It is also intended
to be used with an @..DCBROWSE object.
Notes:
When browsing a database, an index must be in focus and the
key of the index must match whatever is being entered by the
user into the GET.
The seek is a SOFTSEEK, meaning that the record that closely
matches the entered data will be selected.
When browsing an array the <þnColumnþ> element of the array must
match whatever is being entered by the user into the GET.
Examples:
FUNCTION XTest
LOCAL GetList := {}, cSeek := Space(20), oBrowse
SET DEFA TO ..\XDOC
USE EXPRESS VIA FOXCDX EXCLUSIVE ALIAS 'XDOC'
SET INDEX TO EXPRESS.CDX
OrdSetFocus('COMMAND')
SET DEFA TO
@ 1,1 DCSAY 'Seek' GET cSeek SAYRIGHT PICT '@!' ;
KEYBLOCK {|a,b,o|DC_BrowseAutoSeek(a,o,oBrowse)}
@ 3,1 DCBROWSE oBrowse ALIAS 'XDOC' SIZE 77,11.8
DCBROWSECOL FIELD XDOC->command HEADER "Command" PARENT oBrowse ;
WIDTH 7
DCBROWSECOL FIELD XDOC->type HEADER "Type" PARENT oBrowse ;
WIDTH 6
DCBROWSECOL FIELD XDOC->category HEADER "Category" PARENT oBrowse ;
WIDTH 6
DCBROWSECOL FIELD XDOC->short HEADER "Short Description" PARENT oBrowse
DCBROWSECOL FIELD XDOC->module HEADER "Module" PARENT oBrowse ;
DCBROWSECOL FIELD XDOC->see_also HEADER "See Also" PARENT oBrowse
DCBROWSECOL DATA {||XDOC->(recno())} HEADER "Record" PARENT oBrowse ;
WIDTH 4
DCREAD GUI ;
TITLE 'DC_BrowseAutoSeek() Demo' ;
FIT ;
ADDBUTTONS
RETURN nil
Source/Library:
_DCFINDX.PRG, DCLIPX.DLL
See Also:
@ DCBROWSE
dc_findbrowse()
dc_browsecolor()
Set the default color for alternate rows of a DCBROWSE
Syntax:
DC_BrowseColor( [< aColors >] ) - > aOldColors
Arguments:
< aColors > is an array of 4 colors.
Each color may be defined as a numeric value or a 3-element
array of RGB colors.
Element Type Description
------- ---- -----------------------------------------------
1 A/N Odd row foreground color
2 A/N Odd row background color
3 A/N Even row foreground color
4 A/N Even row background color
Returns:
An array.
Description:
DC_BrowseColor() is used to establish the default colors for
alternate rows of all DCBROWSE objects. These colors will be
invoked only if the COLOR clause of DCBROWSE is not used.
Examples:
DC_BrowseColor( { nil, GRA_CLR_WHITE, nil, GRA_CLR_CYAN } )
Source/Library:
_DCXBROW.PRG
See Also:
@ DCBROWSE
dc_browsedb()
A text-based Database browsing system
Syntax:
DC_BrowseDb ( [< aOptions >], ;
[< aFields >], ;
[< cUdfName >], ;
[< lExit >], ;
[< lReSize >], ;
[< lRestoreScreen >], ;
[< cConfigFile >], ;
[< lEditDb >], ;
[< lProtect >], ;
[< aMenu >], ;
[< aKeys >], ;
[< aMouse >], ;
[< lBackGround >] ) - > Nil
Arguments:
< aOptions > is an array of parameters to define the size and
style of the browse window.
Element Type Description
------- ---- ---------------------------------------------
[ 1] L .t. - Pick-list operation. Will only display
menu options for window configuration and
searching for a record. Use this mode
when you want the user to choose a field
and/or record and exit with the RETURN key.
.f. - Normal operation. (default).
[ 2] L .t. - Protect data from being changed by user
.f. - Allow data modification ( Default )
[ 3] N Start Display Row ( 0 is default )
[ 4] N Start Display Column ( 0 is default )
[ 5] N End Display Row ( 24 is default )
[ 6] N End Display Column ( 79 is default )
[ 7] L .t. - Display File Data at bottom of window
.f. - Don't Display File Data ( Default )
[ 8] L .t. - Don't display a shadow around the window
.f. - Display a shadow around window ( Default )
[ 9] L .t. - Display a record number column ( Default )
.f. - Don't display record numbers
[10] L .t. - Set the TAB for this window ( Default )
.f. - Don't set the TAB
[11] L .t. - Automatic update of Relational Windows
.f. - Don't update Relational Windows ( Default )
[12] L .t. - One-To-Many Browse configuration
.f. - Standard configuration ( Default )
[13] L .t. - Sticky-Browse mode ON
.f. - Sticky-Browse mode OFF ( Default )
[14] L .t. - Display all child relational fields (Default)
.f. - Don't display child fields
[15] L .t. - Automatic update of Full-screen edit window
.f. - Don't update Edit window (Default)
[16] L .t. - Display a Record Tagging Column.
[17] N Inkey value of keyboard key to use for record
tagging with [16] is .TRUE. Default is SPACE BAR
(32)
[18] L .t. - Fast Paint option. Paints browse screens
faster if they contain long memo fields. This
option will not display memo fields with the
capitalized "MEMO" when they are not empty.
.f. - Display "MEMO" when memo fields are not empty
otherwise display "memo". (Default)
[19] L .t. - Display totals at the bottom of all numeric
columns. This option can take a long time to
start-up the browse while totals are being
calculated.
.f. - Don't display totals. (Default)
[20] L .t. - Display menu bar at the top of the physical
screen (Row 0, Column 0)
.f. - Display menu bar at the top of the browse
window (Default).
[21] L .t. - PICK-EDIT mode. In this mode, pressing the
ENTER key will exit the browse with the record
pointer at the selected record. This is
different than PICK-LIST mode above, however,
because this option still allows editing by
selecting ADD or EDIT from the menus.
.f. - ENTER key will edit currently selected field.
[22] L .t. - AUTOSEEK mode. Overrides setting of Autoseek
that was saved in Browse configuration.
[23] C Description of the Browse
[24] C A list of relational browse windows separated by
commas.
< aFields > is a 2-dimensional array of field names and headings.
If this argument is not passed, then all fields will appear in
the display with the field name used as the heading. There
should be one element in the second array for each element in
the first array.
Example:
{ { 'CUST_NAME','CUST_NMBR','STREET1','CITY','STATE','ZIP' }, ;
{ 'Customer;Name','Number','Street','City','State','Zip' } }
Note: Use semicolon (;) character(s) in the heading to break the
heading display into multiple rows.
< cUdfName > is the name of a User-Defined Function to call
after each keystroke.
< lExit > if .TRUE. will paint the display and items on the
screen then return. .FALSE. is Default.
< lReSize > if .TRUE. will simply resize the browse window to
the new coordinates passed in < aOptions > and not affect the
previous browse configuration.
< lRestoreScreen > if .TRUE. (default) will restore the screen
upon exiting the browse, otherwise all the browse screens
will remain on the display.
< cConfigFile > is the name of a *.DBR file to use as the
browse configuration. A *.DBR file is created by the
"Save Configuration to a File" selection from the FILES
menu after configuring the browse screen as desired. If no
path is included in the file name, then the file must exist
in the same directory as the currently selected database.
< lEditDb > if .TRUE. will automatically paint a full-screen
EDIT window and update it every time the record pointer
changes in the browse window. Use this parameter when you
want to see both a full-screen edit view and a browse view
at the same time. Using this parameter is the same as
selecting "Automatic Update of Edit Window ON" from the
VIEW menu. The default is .FALSE. or OFF.
< lProtect > if .TRUE. will protect the database from being
modified by the user. The default is .FALSE.
< aMenu > is an optional array which is used to replace the
default Browse pull-down menus. The menu array must conform
to the specification of the array returned by the
function DC_MENUEDIT() or DC_MENULOAD(). If < aMenu > is
a character string, then the string must contain the
NAME of the menu as contained in the menu dictionary file
(DCMENU.DBF).
< aKeys > is an optional array which is used to replace, add
or delete hot-keys from the Browse defaults. The key array
must conform to the specification of the array returned by
the function DC_KEYEDIT() or DC_KEYLOAD(). If < aKeys > is
a character string, then the string must contain the
NAME of the key-set as contained in the key dictionary file
(DCKEY.DBF).
< aMouse > is an optional array which is used to add to the
default mouse-actions. The mouse array must conform
to the specification of the array defined for use by the
function DC_MOUSEKEYS() or returned by the function
DC_MOUSEEDIT() or DC_MOUSELOAD(). If < aMouse > is a
character string, then the string must contain the
NAME of the mouse-set as contained in the mouse dictionary
file (DCMOUSE.DBF).
< lBackGround > if .TRUE. (default) will paint a default
background and all browse screens for all work areas. If
.FALSE., then only the browse screen for the current work
area will be displayed over the existing screen.
Returns:
Nil
Description:
DC_BROWSEDB() is a Multi-Window database browsing system that
can be used as a complete menu-driven DBMS. DC_BROWSEDB() is
the base system for all Text-Based browsing features. This is an
array-driven system, ie, a multi-dimensional array ( DCBROWSE )
object is used to store all the parameters for all work areas.
DC_BROWSEDB() supports a complete set of menus and options:
Edit, View, File, Search, Print, Utilities, etc. The text-based
browse system supports the following features:
1. Cut and Paste
2. Keyboard Macros
3. User-configuration
4. Multi-window browsing
5. Relational browsing
6. Sticky browsing
7. Pick-list operation
See the section titled BROWSE for a complete description of how
to use the DC_BROWSEDB() function.
Examples:
use customer
DC_BROWSEDB()
use invoice new
DC_BROWSEDB( { , , 0, 0, 24, 39 } )
use invitems new
set relation to inv_nmbr into invoice
DC_BROWSEDB( { , , 0, 40, 24, 79, , , .t., .f., , .t., .t. } )
Source/Library:
_DCBROW.PRG
See Also:
BROWSE
dc_browsegetlist()
A Browse-view of a GetList array (for debugging)
Syntax:
DC_BrowseGetList( < aGetList > ) - > nil
Returns:
Nil.
Description:
DC_BrowseGetList() is used to browse an entire GetList array
in a Multi-dimensional view. This utility helps in debugging
dialogs.
Examples:
FUNCTION XTest()
LOCAL GetList[0], dDate := Date()
@ 0,0 DCSAY 'Enter Date' GET dDate
DCREAD GUI FIT ;
EVAL {||DC_BrowseGetList(GetList)}
RETURN nil
Source/Library:
DCLIP1.LIB, DCLIP1.DLL
dc_browserow()
Set or return the row (element) of a browse
Syntax:
DC_BrowseRow( < oBrowse >, ;
[< nRow >] ) - > nRow
Arguments:
< oBrowse > is the browse object.
< nRow > is the element in the browse to select.
Returns:
The numeric value of the current row (array element).
Description:
DC_BrowseRow() is used to Get or Set the row of a browse object
which was created by the @ DCBROWSE command. This function is
used only when browsing arrays.
DC_BrowseRow() is used when it is necessary to seek an element
of the array being browsed, then update the row pointer and
refresh the browse.
Examples:
#include 'dcdialog.ch'
FUNCTION XTest()
LOCAL GetList := {}, aDir := Directory(), oBrowse, aRef[2]
@ 0,0 DCBROWSE oBrowse SIZE 50,10 DATA aDir ;
PRESENTATION DC_BrowPres() NOHSCROLL
DCBROWSECOL ELEMENT 1 HEADER 'File Name' WIDTH 15 PARENT oBrowse
DCBROWSECOL ELEMENT 2 HEADER 'File Size' WIDTH 13 PARENT oBrowse
DCREAD GUI FIT ADDBUTTONS ;
HANDLER MyHandler REFERENCE aRef ;
EVAL {|| aRef[1]:=oBrowse, aRef[2]:=aDir, ;
SetAppFocus(oBrowse:getColumn(1)) }
RETURN nil
* -----------------
STATIC FUNCTION MyHandler( nEvent, mp1, mp2, oXbp, ;
oDlg, GetList, aRef )
LOCAL oBrowse := aRef[1], aDir := aRef[2], nFound
IF nEvent == xbeP_Keyboard
nFound := ;
AScan( aDir, {|a|Upper(Substr(a[1],1,1))==Upper(Chr(mp1))} )
IF nFound > 0
DC_BrowseRow( oBrowse, nFound )
oBrowse:refreshAll()
ENDIF
ENDIF
RETURN DCGUI_NONE
Source/Library:
_DCGETBX.PRG, DCLIPX.LIB
See Also:
@ DCBROWSE
dc_getcolarray()
dc_browsesort()
Set Sort Header options for @..DCBROWSE
Syntax:
DC_BrowseSort( [< aSortOptions >] ) - > aOldOptions
Arguments:
< aSortOptions > is an array of 6 elements.
Element Description
------- -------------------------------------------------------
1 / 2 Used to set the foreground and background color of the
column heading that is chosen as the controlling sort
order when clicking the mouse in the column heading.
See the SORT clause of DCBROWSECOL.
3 / 4 Used to set the foreground and background color of the
column headings that are not the controlling sort order
and are not selectable. These columns will not change
the sort order when the mouse is clicked in the header.
5 / 6 Use to set the UP arrow and DOWN arrow bitmaps that are
used in the column header of the sorted column when
the order is "ascending" or "descending" respectively.
NOTE: These are no longer used. Instead, special Marlett
font characters are used.
7 / 8 Used to set the foreground and background color of the
column headings that are not the controlling sort order
but are selectable. These columns will change the sort
order when the mouse is clicked in the header.
Returns:
An array containing the old sort options.
Description:
DC_BROWSESORT() is used to set the column heading options
for @..DCBROWSE when using the sort feature that is activated
by clicking in the header column.
Examples:
aSort := Array(6)
aSort[1] := GRA_CLR_WHITE // Sort Selected Color (Foreground)
aSort[2] := GRA_CLR_RED // Sort Selected Color (Background)
aSort[3] := GRA_CLR_WHITE // Sort Non-Selectable Color (Foreground)
aSort[4] := GRA_CLR_DARKGRAY // Sort Non-Selectable Color (Background)
aSort[5] := nil
aSort[6] := nil
aSort[7] := GRA_CLR_WHITE // Sort Unselected Color (Foreground)
aSort[8] := GRA_CLR_BLUE // Sort Unselected Color (Background)
aSaveSort := DC_BrowseSort(aSort)
@ 10,1 DCBROWSE oBrowse
DCREAD GUI
DC_BrowseSort(aSaveSort)
Source/Library:
_DCXBROW.PRG, DCLIPX.DLL
See Also:
@ DCBROWSE
dc_busyoff()
Destroy a busy window created with DC_BusyOn()
Syntax:
DC_BusyOff( < oBusyDlg > ) - > nil
Arguments:
< oBusyDlg > is a pointer to a dialog window created by
DC_BusyOn().
Description:
DC_BusyOn() is used to embed a dialog window into another dialog
window to provide a means to display a "busy" message and to
temporarily disable the drawing area of the parent window
during a process. DC_BusyOff() is used to destroy the temporary
child window.
Examples:
FUNCTION XTest()
LOCAL lContinue := .t.
oBusyDlg := DC_BusyOn( SetAppWindow(), ;
{||WaitDialog(@lContinue,@oStatus)} )
DO WHILE !Eof() .AND. lContinue
oStatus:setCaption('Processing Record ' + Alltrim(Str(n)))
SKIP
DC_CompleteEvents()
ENDDO
DC_BusyOff(oBusyDlg)
RETURN nil
* -------------------
STATIC FUNCTION WaitDialog( lContinue, oStatus )
LOCAL GetList[0], oBusyDlg, GetOptions
@ 0,0 DCSAY "Processing" FONT '20.Arial Bold' SAYSIZE 0
@ 2,0 DCSAY '' OBJECT oStatus COLOR GRA_CLR_BLUE FONT '12.Arial Bold' SIZE 30
@ 4,8 DCPUSHBUTTON CAPTION 'Cancel' ACTION {||lContinue := .F. } SIZE 9, 1.2
DCGETOPTIONS NOTITLEBAR HIDE
DCREAD GUI FIT EXIT PARENT @oBusyDlg OPTIONS GetOptions
RETURN oBusyDlg
Source/Library:
_DCMSG.PRG, DCLIPX.DLL
See Also:
dc_waiton()
dc_busyon()
Invoke a busy message window
Syntax:
DC_BusyOn( < oParentDlg >, ;
< bDialog > ) - > oBusyDlg
Arguments:
< oParentDlg > is a pointer to any window derived from the
XbpDialog() class. This is the window who's drawing area will
be disabled and which will be come the parent of the child
window.
< bDialog > is a code block to evaluate. The code block must
return a dialog window which will be embedded within < oParentDlg >.
Returns:
A pointer to a dialog window object.
Description:
DC_BusyOn() is used to embed a dialog window into another dialog
window to provide a means to display a "busy" message and to
temporarily disable the drawing area of the parent window
during a process. DC_BusyOff() is used to destroy the temporary
child window.
Examples:
FUNCTION XTest()
LOCAL lContinue := .t.
oBusyDlg := DC_BusyOn( SetAppWindow(), ;
{||WaitDialog(@lContinue,@oStatus)} )
DO WHILE !Eof() .AND. lContinue
oStatus:setCaption('Processing Record ' + Alltrim(Str(n)))
SKIP
DC_CompleteEvents()
ENDDO
DC_BusyOff(oBusyDlg)
RETURN nil
* -------------------
STATIC FUNCTION WaitDialog( lContinue, oStatus )
LOCAL GetList[0], oBusyDlg, GetOptions
@ 0,0 DCSAY "Processing" FONT '20.Arial Bold' SAYSIZE 0
@ 2,0 DCSAY '' OBJECT oStatus COLOR GRA_CLR_BLUE FONT '12.Arial Bold' SIZE 30
@ 4,8 DCPUSHBUTTON CAPTION 'Cancel' ACTION {||lContinue := .F. } SIZE 9, 1.2
DCGETOPTIONS NOTITLEBAR HIDE
DCREAD GUI FIT EXIT PARENT @oBusyDlg OPTIONS GetOptions
RETURN oBusyDlg
Source/Library:
_DCMSG.PRG, DCLIPX.DLL
See Also:
dc_waiton()
dc_byteshift()
Shift a byte a specified number of bits
Syntax:
DC_ByteShift( < cChar >, ;
[< nShift >] ) - > cChar
Arguments:
< cChar > is any character (byte).
< nShift > is the number of bits to shift from -7 to +7.
Returns:
A character (byte).
Description:
DC_ByteShift() is used to shift the bits in a byte a specified
amount.
Source/Library:
_DCAND.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_bin2num()
dc_num2word()
dc_calcabsoluteposition()
Calculate desktop position from an objects coordinates
Syntax:
DC_CalcAbsolutePosition( [< aPos >], < oXbp > ) - >
aCoords
Arguments:
< aPos > is a two-element array containing the offset from the
object for the resultant output. The default is {0,0}.
< oXbp > is the object whose absolute coordinates are being
calcualated.
Returns:
A two element array containing two numeric values:
1. The absolute COLUMN position.
2. The absolute ROW position.
Description:
DC_CalcAbsolutePosition() returns the coordinates of an object
with respect to coordinate 0,0 of the desktop. This is needed
to get coordinates for tooltips and modal popup windows that
must be displayed adjecent to another object.
Examples:
// This function will center an object on the screen over any
// relative object.
FUNCTION DC_CenterObject( oXbp, oRel )
LOCAL nRelWidth, nRelHeight, nWidth, nHeight, nCol, nRow, aPos
DEFAULT oRel := oXbp:setParent()
nWidth := oXbp:currentSize()[1]
nHeight := oXbp:currentSize()[2]
nRelWidth := oRel:currentSize()[1]
nRelHeight := oRel:currentSize()[2]
nCol := (nRelWidth-nWidth)/2
nRow := (nRelHeight-nHeight)/2
IF oRel == oXbp:setParent()
oXbp:setPos( {nCol,nRow} )
ELSE
aPos := DC_CALCABSOLUTEPOSITION({0,0},oRel)
oXbp:setPos( {aPos[1]+nCol,aPos[2]+nRow} )
ENDIF
RETURN nil
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_callstack()
Display the callstack and optionally edit the source
Syntax:
DC_CallStack() - > Nil
Arguments:
None.
Returns:
Nil.
Description:
DC_CallStack() is used to display a GUI dialog listing the
current call stack and line numbers.
Clicking on an item in the list will scan the list of .OBJs
in the ODIR path to find the source of the function. If
the same named function exists in more than one .OBJ, then
all .OBJs will be listed. Clicking on the selected .OBJ will
call the default editor and pass the name and line number of
the selected source file to editor for editing.
Examples:
. DC_SetKeyActive(.t.)
. SetKey( K_ALT_S, {||DC_CallStack()} )
Source/Library:
_DCOFIND.PRG, DCLIP2.DLL
See Also:
STACK
dc_editprg()
dc_objpublic()
dc_capfirst()
Capitalize the first character of each word.
Syntax:
DC_CapFirst( < cString >, ;
[< lLower >] ) - > cString
Arguments:
< cString > is any string.
< lLower > if .TRUE. will force all characters except the first
character in each word to lower case. The default is .FALSE.
Returns:
A Character String.
Description:
DC_CapFirst() capitalizes the first letter of all words in a
string and leaves all other letters lowercase.
Examples:
. ? DC_CapFirst('DONNAY SOFTWARE DESIGNS',.t.)
Donnay Software Designs
. ? DC_CapFirst('donnay SoftWare')
Donnay SoftWare
Source/Library:
_DCCAPF.PRG, DCLIP1.DLL
dc_cascadecoords()
Returns coordinates to cascade a window
Syntax:
DC_CascadeCoords( [< oParent >], ;
[< lTextBased >], ;
[< aDefault >], ;
[< lTranslate >], ;
[< oExclude >] ) - > aCoords
Arguments:
< oParent > is the dialog window to scan. If no parameter is
passed the AppDeskTop() is the default.
< lTextBased > will return text-based coordinates if .TRUE.
otherwise it will return pixel-based coordinates (default).
< aDefault > is an array of two coordinates to return if no
siblings were found.
< lTranslate > if .TRUE. (default) will return coordinates
translated with 0,0 at the top of the parent window. If
.FALSE. the coordinates will be relative to 0,0 at the bottom
of the parent window.
< oExclude > is a sibling object (an object in the childlist) to
ignore when scanning the childlist.
Returns:
An array of two numeric coordinates:
Element 1 is the row.
Element 2 is the column.
Description:
DC_CASCADECOORD() returns an array of two coordinates. These
coordinates are calculated by scanning the childlist of an
object and finding the object with the lowest coordinates. This
allows for cascading of dialog windows.
Examples:
/*
This example will set the coordinates of a dialog window to
cascaded coordinates relative to the lowest sibling on the
desktop. If there are no siblings, the current coordinates
will be used.
*/
FUNCTION Xtest( oDlg )
LOCAL aCoords, nRow, nCol
nRow := oDlg:currentPos()[2]
nCol := oDlg:currentPos()[1]
aCoords := ;
DC_CascadeCoords(AppDesktop(),.f.,{nRow,nCol},.f.,oDlg)
oDlg:setPos( { nCol, nRow } )
RETURN nil
Source/Library:
_DCFUNCT.PRG, DCLIPX.LIB
dc_cdow()
Translated name of the Day of Week
Syntax:
DC_CDow( < dDate > ) - > cDayOfWeek
Arguments:
< dDate > is any valid date type.
Returns:
A character string.
Description:
DC_CDow() is used to get the name of the day of the week for a
specified date. The name is translated to the language
previously selected by DC_LangSel().
Examples:
DC_LangSet( DCLANG_GERMAN )
? DC_CDow( Date() )
Mittwoch
Source/Library:
_DCCALEN.PRG, DCLIPX.DLL
See Also:
dc_cmonth()
dc_langset()
dc_langmsg()
dc_celledittimeout()
Set a timeout for the Cell-Editor
Syntax:
DC_CellEditTimeOut( [< nSeconds >] ) - > nOldTimeOut
Arguments:
< nSeconds > is the amount of time, in seconds, to allow cell-
editing with no user activity. The default is 0 (no time out).
Returns:
A numerical value equivalent to the previous timeout setting.
Description:
DC_CellEditTimeOut() is used to establish a timeout to exit the
cell editor if there is no user activity after a specified amount
of time.
The Cell Editor automatically locks the record and holds the lock
until it exits or until a new record is selected. If the user
enters the cell-editor and walks away from the computer, a lock
on the record for a long period of time may be undesirable.
Source/Library:
_DCGETBX.PRG, DCLIPX.LIB
See Also:
dc_browcelledit()
dc_centerobject()
Center an Object
Syntax:
DC_CenterObject ( < oXbp >, ;
[< oReference >] ) - > nil
Arguments:
< oXbp > is the object to center.
< oReference > is the reference object to center < oXbp > in.
If < oReference > is not passed, < oXbp > will be centered
within it's
parent.
Returns:
nil
Description:
DC_CENTEROBJECT() will center any object within the viewing area
of it's parent object or any other object.
Examples:
-- Example 1 --
* Center the CRT window on the Desktop
DC_CenterObject(SetAppWindow(),AppDeskTop())
Source/Library:
_DCFUNCT.PRG/.OBJ, DCLIPX.LIB
dc_cgigetenvval()
Read an environment variable in a CGI program
Syntax:
DC_CGIGetEnvVal( < nEnvName > ) - > cValue
Arguments:
< nEnvName > is the numeric value defined in DCCGI.CH. The
following names are available.
AUTH_TYPE
CONTENT_LENGTH
CONTENT_TYPE
GATEWAY_INTERFACE
HTTP_USER_AGENT
HTTP_ACCEPT
HTTP_FROM
PATH_INFO
PATH_TRANSLATED
QUERY_STRING
REFERER_URL
REMOTE_ADDR
REMOTE_HOST
REMOTE_IDENT
REMOTE_USER
REQUEST_METHOD
SCRIPT_NAME
SERVER_NAME
SERVER_PORT
SERVER_PROTOCOL
SERVER_SOFTWARE
SERVER_ADMIN
GMT_OFFSET
HTTP_REFERRER
HTTP_COOKIE
_FROM
AUTH_NAME
DATE_LOCAL
CONTENT_STRING
REQUEST_PROTOCOL
EXECUTABLE_PATH
KEEP_ALIVE
DOC_ROOT
AUTH_PASSWORD
AUTH_METHOD
AUTH_REALM
DEBUG_MODE
X_SERIAL_NUMBER
PRAGMA
ACCEPT_LANGUAGE
HOST
UA_PIXELS
UA_COLOR
UA_OS
UA_CPU
EXTENSION
CGI_VERSION
NT_USERNAME
OUTPUT_FILE
CONTENT_FILE
Returns:
A character string.
Description:
DC_CGIGetEnvVal() is used to get the value of an environment
variable that has been passed by an HTML form to a CGI
application. When a CGI application starts, DC_CGIInit()
stores all the passed environment variables to a static array
which is accessed by DC_CGIGetEnvVal().
Notes:
DC_CGIInit() must be called before using this function.
Variables passed to a CGI program are always character strings.
Examples:
<form METHOD="POST" ACTION="/cgi-bin/waa1gate.exe?dummy=0">
Your Name <input NAME="Name" TYPE="TEXT" size="20">
Company <input NAME="Company" TYPE="TEXT" size="20">
Street1 <input NAME="Street1" TYPE="TEXT" size="20">
Street2 <input NAME="Street2" TYPE="TEXT" size="20">
City <input NAME="City" TYPE="TEXT" size="20">
State <input NAME="State" SIZE="10" TYPE="TEXT">
Zip <input NAME="Zip" TYPE="TEXT" SIZE="10">
Country <input NAME="Country" TYPE="TEXT" size="20">
E-Mail Address <input NAME="Email" TYPE="TEXT" size="20">
Phone <input NAME="Phone" TYPE="TEXT" size="20">
Fax <input NAME="Fax" TYPE="TEXT" size="20">
<input type=hidden name="WAA_PACKAGE" value="DS">
<input type=hidden name="WAA_FORM" value="FreeDownload">
<input type=SUBMIT name="FreeDownload" value="Download!"
</form>
FUNCTION _register( oPackage )
oPackage:registerForm( 'FreeDownload' )
RETURN .T.
* -----------------
FUNCTION FreeDownload( oHtml, oContext )
IF !DC_CGIInit(oHtml, oContext)
RETURN .f.
ENDIF
// send the environment back to the browser
FOR i := 1 to 50
DC_CGISend( DC_CGIGetEnvVal(i) )
NEXT
RETURN
Source/Library:
_DCCGI.PRG, DCLIPX.DLL
See Also:
dc_cgigetparmval()
dc_cgiinit()
dc_cgigetparmval()
Read a data variable in a CGI program
Syntax:
DC_CGIGetParmVal( < cVarName >, ;
[@< cValue >], ;
[< oHtml >] ) - > cValue
Arguments:
< cVarName > is the case sensitive name of the variable holding
the value.
@< cValue > is the name of a variable, passed by reference, to
store the value.
< oHtml > is the HTML3 object passed to the program. If this
parameter is not used then the HTML3 object posted by the
DC_CGIInit() function will be used. CAUTION: When running
heavily loaded CGI programs that may receive simultaneous hits
it is recommended that this parameter be used.
Returns:
A character string.
Description:
DC_CGIGetParmVal() is used to get the value of a data variable
that has been passed by an HTML form to a CGI application.
When a CGI application starts, DC_CGIInit() stores all the
passed data variables to a static array which is accessed by
DC_CGIGetParmVal().
Notes:
DC_CGIInit() must be called before using this function.
Variables passed to a CGI program are always character strings.
Examples:
<form METHOD="POST" ACTION="/cgi-bin/waa1gate.exe?dummy=0">
Your Name <input NAME="Name" TYPE="TEXT" size="20">
Company <input NAME="Company" TYPE="TEXT" size="20">
Street1 <input NAME="Street1" TYPE="TEXT" size="20">
Street2 <input NAME="Street2" TYPE="TEXT" size="20">
City <input NAME="City" TYPE="TEXT" size="20">
State <input NAME="State" SIZE="10" TYPE="TEXT">
Zip <input NAME="Zip" TYPE="TEXT" SIZE="10">
Country <input NAME="Country" TYPE="TEXT" size="20">
E-Mail Address <input NAME="Email" TYPE="TEXT" size="20">
Phone <input NAME="Phone" TYPE="TEXT" size="20">
Fax <input NAME="Fax" TYPE="TEXT" size="20">
<input type=hidden name="WAA_PACKAGE" value="DS">
<input type=hidden name="WAA_FORM" value="FreeDownload">
<input type=SUBMIT name="FreeDownload" value="Download!"
</form>
FUNCTION _register( oPackage )
oPackage:registerForm( 'FreeDownload' )
RETURN .T.
* -----------------
FUNCTION FreeDownload( oHtml, oContext )
LOCAL cName, cStreet1, cStreet2, cCompany, ;
cEmail, cState, cZip, cPhone, cFax, cCountry, cCity
IF !DC_CGIInit(oHtml, oContext)
RETURN .f.
ENDIF
dbeSetDefault('DBFCDX')
cName := DC_CGIGetParmVal('Name')
cCompany := DC_CGIGetParmVal('Company')
cStreet1 := DC_CGIGetParmVal('Street1')
cStreet2 := DC_CGIGetParmVal('Street2')
cState := DC_CGIGetParmVal('State')
cZip := DC_CGIGetParmVal('Zip')
cEmail := DC_CGIGetParmVal('Email')
cCountry := DC_CGIGetParmVal('Country')
cCity := DC_CGIGetParmVal('City')
cPhone := DC_CGIGetParmVal('Phone')
cFax := DC_CGIGetParmVal('Fax')
IF Empty(cName) .OR. !'@'$cEmail
oHTML:message( "Error", ;
'Please provide a Name and E-mail Address.<p>' + ;
'Click on your Back Button to return to the download page.<p>')
DC_CGIQuit()
RETURN .t.
ELSE
USE register INDEX register.cdx
OrdSetFocus('EMAIL')
SEEK Upper(Alltrim(cEmail))
IF Eof() .AND. DC_AddRec(10)
REPL REGISTER->name WITH cName,;
REGISTER->company WITH cCompany,;
REGISTER->street1 WITH cStreet1,;
REGISTER->street2 WITH cStreet2,;
REGISTER->city WITH cCity,;
REGISTER->country WITH cCountry,;
REGISTER->state WITH cState,;
REGISTER->zip WITH cZip,;
REGISTER->phone WITH cPhone,;
REGISTER->fax WITH cFax,;
REGISTER->email WITH cEmail,;
REGISTER->filename WITH cVariable,;
REGISTER->date WITH Date(),;
REGISTER->time WITH Time()
UNLOCK
ENDIF
RunShell('/C C:\spimail\sm.exe /t:' + Alltrim(cEmail) + ;
' /s:"File Download Instructions"' + ;
' /m:' + MemoRead('download.txt',,.t.,.t. )
cHtml += 'An email message has been sent to <em><b>' +
Alltrim(cEmail) + ;
' </b></em>with download
instructions<br><br>'
DC_CGISend(cHtml)
ENDIF
RETURN
Source/Library:
_DCCGI.PRG, DCLIPX.DLL
See Also:
dc_cgiinit()
dc_cgiinit()
Initialize CGI environment
Syntax:
DC_CGIInit( < oHtml >, ;
< oContext > ) - > lStatus
Arguments:
< oHtml > is the HTML3 object passed by the WAA adapter to the
application.
< oContext > is the Context object passed by the WAA adapter to
the application.
Returns:
A logical .TRUE. if the environment was properly initialized,
.FALSE. otherwise.
Description:
DC_CGIInit() is used in Web applications designed for use with
the WAA (Web Application Adapter). This function reads all
the passed environment variables and data variables into static
arrays for later access with DC_CGIGetParmVal().
DC_CGIInit() also creates (an overwrites) two text files:
CGIVARS.TXT - Contains a list of all data variables.
CGIENVIR.TXT - Contaisn a list of all environment variables.
Note: These files are overwritten each time DC_CGIInit() is
run in a program. They are intended to be used for debugging
problems immediately after they occur.
Notes:
This must be the first DC_CGI*() function called in a WAA
program.
Examples:
<form METHOD="POST" ACTION="/cgi-bin/waa1gate.exe?dummy=0">
Your Name <input NAME="Name" TYPE="TEXT" size="20">
Company <input NAME="Company" TYPE="TEXT" size="20">
Street1 <input NAME="Street1" TYPE="TEXT" size="20">
Street2 <input NAME="Street2" TYPE="TEXT" size="20">
City <input NAME="City" TYPE="TEXT" size="20">
State <input NAME="State" SIZE="10" TYPE="TEXT">
Zip <input NAME="Zip" TYPE="TEXT" SIZE="10">
Country <input NAME="Country" TYPE="TEXT" size="20">
E-Mail Address <input NAME="Email" TYPE="TEXT" size="20">
Phone <input NAME="Phone" TYPE="TEXT" size="20">
Fax <input NAME="Fax" TYPE="TEXT" size="20">
<input type=hidden name="WAA_PACKAGE" value="DS">
<input type=hidden name="WAA_FORM" value="FreeDownload">
<input type=SUBMIT name="FreeDownload" value="Download!"
</form>
FUNCTION _register( oPackage )
oPackage:registerForm( 'FreeDownload' )
RETURN .T.
* -----------------
FUNCTION FreeDownload( oHtml, oContext )
LOCAL cName, cStreet1, cStreet2, cCompany, ;
cEmail, cState, cZip, cPhone, cFax, cCountry, cCity
IF !DC_CGIInit(oHtml, oContext)
RETURN .f.
ENDIF
dbeSetDefault('DBFCDX')
cName := DC_CGIGetParmVal('Name')
cCompany := DC_CGIGetParmVal('Company')
cStreet1 := DC_CGIGetParmVal('Street1')
cStreet2 := DC_CGIGetParmVal('Street2')
cState := DC_CGIGetParmVal('State')
cZip := DC_CGIGetParmVal('Zip')
cEmail := DC_CGIGetParmVal('Email')
cCountry := DC_CGIGetParmVal('Country')
cCity := DC_CGIGetParmVal('City')
cPhone := DC_CGIGetParmVal('Phone')
cFax := DC_CGIGetParmVal('Fax')
IF Empty(cName) .OR. !'@'$cEmail
oHTML:message( "Error", ;
'Please provide a Name and E-mail Address.<p>' + ;
'Click on your Back Button to return to the download page.<p>')
DC_CGIQuit()
RETURN .t.
ELSE
USE register INDEX register.cdx
OrdSetFocus('EMAIL')
SEEK Upper(Alltrim(cEmail))
IF Eof() .AND. DC_AddRec(10)
REPL REGISTER->name WITH cName,;
REGISTER->company WITH cCompany,;
REGISTER->street1 WITH cStreet1,;
REGISTER->street2 WITH cStreet2,;
REGISTER->city WITH cCity,;
REGISTER->country WITH cCountry,;
REGISTER->state WITH cState,;
REGISTER->zip WITH cZip,;
REGISTER->phone WITH cPhone,;
REGISTER->fax WITH cFax,;
REGISTER->email WITH cEmail,;
REGISTER->filename WITH cVariable,;
REGISTER->date WITH Date(),;
REGISTER->time WITH Time()
UNLOCK
ENDIF
RunShell('/C C:\spimail\sm.exe /t:' + Alltrim(cEmail) + ;
' /s:"File Download Instructions"' + ;
' /m:' + MemoRead('download.txt',,.t.,.t. )
cHtml += 'An email message has been sent to <em><b>' +
Alltrim(cEmail) + ;
' </b></em>with download
instructions<br><br>'
DC_CGISend(cHtml)
ENDIF
RETURN
Source/Library:
_DCCGI.PRG, DCLIPX.DLL
See Also:
dc_cgigetparmval()
dc_cgigetenvval()
dc_cginocrsend()
Send data to the web browser without a CR
Syntax:
DC_CGINoCrSend( < cHTML >, [< oHtml >] ) - > nil
Arguments:
< cHTML > is any HTML response. The text will be added to any
previous calls to DC_CGISend() in the program and all text
will be sent when the program terminates.
< oHtml > is the HTML3 object passed to the program. If this
parameter is not used then the HTML3 object posted by the
DC_CGIInit() function will be used. CAUTION: When running
heavily loaded CGI programs that may receive simultaneous hits
it is recommended that this parameter be used.
Returns:
Nil.
Description:
DC_CGINoCrSend() is used to send HTML data to the web browser
without adding a CR (Chr(13)) to the response.
Notes:
This must be the first DC_CGI*() function called in a WAA
program.
Examples:
<form METHOD="POST" ACTION="/cgi-bin/waa1gate.exe?dummy=0">
Your Name <input NAME="Name" TYPE="TEXT" size="20">
Company <input NAME="Company" TYPE="TEXT" size="20">
Street1 <input NAME="Street1" TYPE="TEXT" size="20">
Street2 <input NAME="Street2" TYPE="TEXT" size="20">
City <input NAME="City" TYPE="TEXT" size="20">
State <input NAME="State" SIZE="10" TYPE="TEXT">
Zip <input NAME="Zip" TYPE="TEXT" SIZE="10">
Country <input NAME="Country" TYPE="TEXT" size="20">
E-Mail Address <input NAME="Email" TYPE="TEXT" size="20">
Phone <input NAME="Phone" TYPE="TEXT" size="20">
Fax <input NAME="Fax" TYPE="TEXT" size="20">
<input type=hidden name="WAA_PACKAGE" value="DS">
<input type=hidden name="WAA_FORM" value="FreeDownload">
<input type=SUBMIT name="FreeDownload" value="Download!"
</form>
FUNCTION _register( oPackage )
oPackage:registerForm( 'FreeDownload' )
RETURN .T.
* -----------------
FUNCTION FreeDownload( oHtml, oContext )
LOCAL cName, cStreet1, cStreet2, cCompany, ;
cEmail, cState, cZip, cPhone, cFax, cCountry, cCity
IF !DC_CGIInit(oHtml, oContext)
RETURN .f.
ENDIF
dbeSetDefault('DBFCDX')
cName := DC_CGIGetParmVal('Name')
cCompany := DC_CGIGetParmVal('Company')
cStreet1 := DC_CGIGetParmVal('Street1')
cStreet2 := DC_CGIGetParmVal('Street2')
cState := DC_CGIGetParmVal('State')
cZip := DC_CGIGetParmVal('Zip')
cEmail := DC_CGIGetParmVal('Email')
cCountry := DC_CGIGetParmVal('Country')
cCity := DC_CGIGetParmVal('City')
cPhone := DC_CGIGetParmVal('Phone')
cFax := DC_CGIGetParmVal('Fax')
IF Empty(cName) .OR. !'@'$cEmail
oHTML:message( "Error", ;
'Please provide a Name and E-mail Address.<p>' + ;
'Click on your Back Button to return to the download page.<p>')
DC_CGIQuit()
RETURN .t.
ELSE
USE register INDEX register.cdx
OrdSetFocus('EMAIL')
SEEK Upper(Alltrim(cEmail))
IF Eof() .AND. DC_AddRec(10)
REPL REGISTER->name WITH cName,;
REGISTER->company WITH cCompany,;
REGISTER->street1 WITH cStreet1,;
REGISTER->street2 WITH cStreet2,;
REGISTER->city WITH cCity,;
REGISTER->country WITH cCountry,;
REGISTER->state WITH cState,;
REGISTER->zip WITH cZip,;
REGISTER->phone WITH cPhone,;
REGISTER->fax WITH cFax,;
REGISTER->email WITH cEmail,;
REGISTER->filename WITH cVariable,;
REGISTER->date WITH Date(),;
REGISTER->time WITH Time()
UNLOCK
ENDIF
RunShell('/C C:\spimail\sm.exe /t:' + Alltrim(cEmail) + ;
' /s:"File Download Instructions"' + ;
' /m:' + MemoRead('download.txt',,.t.,.t. )
cHtml += 'An email message has been sent to <em><b>' +
Alltrim(cEmail) + ;
' </b></em>with download
instructions<br><br>'
DC_CGINoCrSend(cHtml)
ENDIF
RETURN
Source/Library:
_DCCGI.PRG, DCLIPX.DLL
See Also:
dc_cgisend()
dc_cgiparamarray()
Return an array of all Data Variables
Syntax:
DC_CGIParamArray( [< oHtml >] ) - > aVars
Arguments:
< oHtml > is the HTML3 object passed to the program. If this
parameter is not used then the HTML3 object posted by the
DC_CGIInit() function will be used. CAUTION: When running
heavily loaded CGI programs that may receive simultaneous hits
it is recommended that this parameter be used.
Returns:
A two-dimensional array. The first element contains the case
sensitive variable name. The second element contains the
character string value.
Description:
DC_CGIParmArray() returns a two-dimensional array with the
case-sensitive name and the character string value of each
variable passed to the CGI Program. This array is created
by DC_CGIInit().
Examples:
<form METHOD="POST" ACTION="/cgi-bin/waa1gate.exe?dummy=0">
Your Name <input NAME="Name" TYPE="TEXT" size="20">
Company <input NAME="Company" TYPE="TEXT" size="20">
Street1 <input NAME="Street1" TYPE="TEXT" size="20">
Street2 <input NAME="Street2" TYPE="TEXT" size="20">
City <input NAME="City" TYPE="TEXT" size="20">
State <input NAME="State" SIZE="10" TYPE="TEXT">
Zip <input NAME="Zip" TYPE="TEXT" SIZE="10">
Country <input NAME="Country" TYPE="TEXT" size="20">
E-Mail Address <input NAME="Email" TYPE="TEXT" size="20">
Phone <input NAME="Phone" TYPE="TEXT" size="20">
Fax <input NAME="Fax" TYPE="TEXT" size="20">
<input type=hidden name="WAA_PACKAGE" value="DS">
<input type=hidden name="WAA_FORM" value="FreeDownload">
<input type=SUBMIT name="FreeDownload" value="Download!"
</form>
FUNCTION _register( oPackage )
oPackage:registerForm( 'FreeDownload' )
RETURN .T.
* -----------------
FUNCTION FreeDownload( oHtml, oContext )
LOCAL cName, cStreet1, cStreet2, cCompany, ;
cEmail, cState, cZip, cPhone, cFax, cCountry, cCity
IF !DC_CGIInit(oHtml, oContext)
RETURN .f.
ENDIF
aVars := DC_CGIParamArray()
DC_ASave(aVars,'VARS.TXT')
RETURN nil
Source/Library:
_DCCGI.PRG, DCLIPX.DLL
See Also:
dc_cgiinit()
dc_cgisend()
Send data to the web browser
Syntax:
DC_CGISend( < cHTML >, [< oHtml >] ) - > nil
Arguments:
< cHTML > is any HTML response. The text will be added to any
previous calls to DC_CGISend() in the program and all text
will be sent when the program terminates.
< oHtml > is the HTML3 object passed to the program. If this
parameter is not used then the HTML3 object posted by the
DC_CGIInit() function will be used. CAUTION: When running
heavily loaded CGI programs that may receive simultaneous hits
it is recommended that this parameter be used.
Returns:
Nil.
Description:
DC_CGISend() is used to send HTML data to the web browser.
Notes:
This must be the first DC_CGI*() function called in a WAA
program.
Examples:
<form METHOD="POST" ACTION="/cgi-bin/waa1gate.exe?dummy=0">
Your Name <input NAME="Name" TYPE="TEXT" size="20">
Company <input NAME="Company" TYPE="TEXT" size="20">
Street1 <input NAME="Street1" TYPE="TEXT" size="20">
Street2 <input NAME="Street2" TYPE="TEXT" size="20">
City <input NAME="City" TYPE="TEXT" size="20">
State <input NAME="State" SIZE="10" TYPE="TEXT">
Zip <input NAME="Zip" TYPE="TEXT" SIZE="10">
Country <input NAME="Country" TYPE="TEXT" size="20">
E-Mail Address <input NAME="Email" TYPE="TEXT" size="20">
Phone <input NAME="Phone" TYPE="TEXT" size="20">
Fax <input NAME="Fax" TYPE="TEXT" size="20">
<input type=hidden name="WAA_PACKAGE" value="DS">
<input type=hidden name="WAA_FORM" value="FreeDownload">
<input type=SUBMIT name="FreeDownload" value="Download!"
</form>
FUNCTION _register( oPackage )
oPackage:registerForm( 'FreeDownload' )
RETURN .T.
* -----------------
FUNCTION FreeDownload( oHtml, oContext )
LOCAL cName, cStreet1, cStreet2, cCompany, ;
cEmail, cState, cZip, cPhone, cFax, cCountry, cCity
IF !DC_CGIInit(oHtml, oContext)
RETURN .f.
ENDIF
dbeSetDefault('DBFCDX')
cName := DC_CGIGetParmVal('Name')
cCompany := DC_CGIGetParmVal('Company')
cStreet1 := DC_CGIGetParmVal('Street1')
cStreet2 := DC_CGIGetParmVal('Street2')
cState := DC_CGIGetParmVal('State')
cZip := DC_CGIGetParmVal('Zip')
cEmail := DC_CGIGetParmVal('Email')
cCountry := DC_CGIGetParmVal('Country')
cCity := DC_CGIGetParmVal('City')
cPhone := DC_CGIGetParmVal('Phone')
cFax := DC_CGIGetParmVal('Fax')
IF Empty(cName) .OR. !'@'$cEmail
oHTML:message( "Error", ;
'Please provide a Name and E-mail Address.<p>' + ;
'Click on your Back Button to return to the download page.<p>')
DC_CGIQuit()
RETURN .t.
ELSE
USE register INDEX register.cdx
OrdSetFocus('EMAIL')
SEEK Upper(Alltrim(cEmail))
IF Eof() .AND. DC_AddRec(10)
REPL REGISTER->name WITH cName,;
REGISTER->company WITH cCompany,;
REGISTER->street1 WITH cStreet1,;
REGISTER->street2 WITH cStreet2,;
REGISTER->city WITH cCity,;
REGISTER->country WITH cCountry,;
REGISTER->state WITH cState,;
REGISTER->zip WITH cZip,;
REGISTER->phone WITH cPhone,;
REGISTER->fax WITH cFax,;
REGISTER->email WITH cEmail,;
REGISTER->filename WITH cVariable,;
REGISTER->date WITH Date(),;
REGISTER->time WITH Time()
UNLOCK
ENDIF
RunShell('/C C:\spimail\sm.exe /t:' + Alltrim(cEmail) + ;
' /s:"File Download Instructions"' + ;
' /m:' + MemoRead('download.txt',,.t.,.t. )
cHtml += 'An email message has been sent to <em><b>' +
Alltrim(cEmail) + ;
' </b></em>with download
instructions<br><br>'
DC_CGISend(cHtml)
ENDIF
RETURN
Source/Library:
_DCCGI.PRG, DCLIPX.DLL
See Also:
dc_cgiinit()
dc_cgisetparmval()
Set a data variable in a CGI program
Syntax:
DC_CGISetParmVal( < cVarName >, ;
< cValue >, ;
[< oHtml >] ) - > cValue
Arguments:
< cVarName > is the case sensitive name of the variable holding
the value.
< cValue > is the value to set.
< oHtml > is the HTML3 object passed to the program. If this
parameter is not used then the HTML3 object posted by the
DC_CGIInit() function will be used. CAUTION: When running
heavily loaded CGI programs that may receive simultaneous hits
it is recommended that this parameter be used.
Returns:
A character string.
Description:
DC_CGISetParmVal() is used to set the value of a data variable
to be later passed back to the browser as a hidden variable.
Notes:
DC_CGIInit() must be called before using this function.
Variables passed to a CGI program are always character strings.
Examples:
TEXT TO FILE wishedit.txt
<div align="center">
<center>
<table border="4" cellpadding="5" width="100%" colspan="1"
BORDERCOLOR="#7D7D7D">
<tr>
<td bgcolor="#9C6995">
<font color=#FFFFFF>
Editing WISHLIST<br> <font
size=+1>Record:</font>
<font size=5>
<bold>"DCCGI_Record"</font></bold>
<FONT SIZE=+1> "DCCGI_TitleMsg"</FONT>
</td>
</tr>
<tr>
<td bgcolor="#008080">
<input type=submit value="First" name="DbEditAction">
<input type=submit value="Prev" name="DbEditAction">
<input type=submit value="Next" name="DbEditAction">
<input type=submit value="Last" name="DbEditAction">
<input type=submit value="Abort" name="DbEditAction">
<input type=submit value="Commit" name="DbEditAction">
<input type=submit value="New" name="DbEditAction">
<input type=submit value="Browse" name="DbEditAction">
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFCC">
<table width=500>
<tr>
<td><b><em>Name of
WishMaker:</b></em></td>
<td><b><em>Date of
Wish:</em></b></td>
<td><b><em>Status:</em></b></td
2
</tr>
<tr>
<td><b><font
color="#0000FF">"DCCGI_UserName"
</font></b></td>
<td><b>"dCGI_WishDate"</b></td>
<td><b>"nCGI_WishStatus"</b></td>
</tr>
<tr>
<td colspan=3><b><em>Short
Description:</em></b></td>
</tr>
<tr>
<td colspan=3><input type=text name="cCGI_Description"
size=75 maxlength=75></td>
</tr>
</table>
<b><em>Explanation of
Wish:</em></b><br>
<TEXTAREA name="mCGI_Memo" rows=7 cols=80></TEXTAREA>
<br>
<b><em>Donnay Software
Reply:</em></b><br>
<TEXTAREA name="mCGI_Reply" rows=7 cols=80></TEXTAREA>
</td>
</tr>
</table>
</center>
</div>
ENDTEXT
cForm := DC_CGIStuff( WishEditFieldMap( .t., .t. ), ;
MemoRead( 'wishedit.txt' )
DC_CGISetParmVal('HiddenData','this is some data')
DC_CGISend(cForm)
RETURN nil
* --------------------
FUNCTION WishEditFieldMap( lEditMode )
RETURN { ;
{ 'DCCGI_UserName', ;
IIF(Empty(WISHLIST->user_name), ;
DC_CGIGetParmVal('DCCGI_UserName'),WISHLIST->user_name), ;
0 }, ;
{ 'dCGI_WishDate', ;
IIF(Eof(),Date(),WISHLIST->date), ;
0 }, ;
{ 'cCGI_Description', ;
WISHLIST->descrip, ;
IIF(lEditMode,1,0) }, ;
{ 'nCGI_WishStatus', ;
WISHLIST->status, ;
0 }, ;
{ 'sCGI_Version', ;
WISHLIST->version, ;
7 }, ;
{ 'mCGI_Memo', ;
IIF(lEditMode,WISHLIST->memo, ;
Strtran(WISHLIST->memo,Chr(13),'<BR>')), ;
IIF(lEditMode,6,0) }, ;
{ 'mCGI_Reply', ;
IIF(lEditMode,WISHLIST->reply, ;
Strtran(WISHLIST->reply,Chr(13),'<BR>')), ;
IIF(lEditMode .AND. lMasterPassWord,6,0) }, ;
{ 'DCCGI_Record', ;
IIF( Eof(),0, RecNo()), ;
0 }, ;
{ 'DCCGI_TitleMsg', ;
TitleMessage(), ;
0 } }
Source/Library:
_DCCGI.PRG, DCLIPX.DLL
See Also:
dc_cgigetparmval()
dc_cgiinit()
dc_cgistuff()
Stuff an HTML response template with data
Syntax:
DC_CGIStuff( < aStuff >, ;
< cForm >, ;
[< cDelim >], ;
[< lMacro >] ) - > lStatus
Arguments:
< aStuff > is a multi-dimensional array consisting of 3 sub
elements per item to stuff:
Element Type Description
------- ------ --------------------------------------------
[1] C The name of the variable in the HTML form
[2] CNDLM Value to stuff into the form
[3] N The type of variable (See below table)
Type [3] Description
-------- ---------------------------------------------------
0 ANYTHING (value may be any value)
1 TEXT (value must be character string) DEFAULT
2 RADIO (value must be character string)
3 TEXT (value must be date)
4 TEXT (value must be numeric)
5 CHECKBOX (value must be logical)
6 TEXTAREA (value must be character string)
7 OPTION (value must be character string)
< cForm > is the HTML form template
< cDelim > is the delimeter that is used around variables in the
form. The default is ".
< lMacro > if .TRUE. specifies that element 2 of the stuff array
is an expression which will return a value. The default is
.FALSE.
Returns:
A logical .TRUE. if the processed was completed successfully.
Description:
DC_CGIStuff() is used to merge data with an HTML form. This
function is handy when is it desired to read a "template"
HTML form, insert data in the template and then send this to
the web browser.
Examples:
FUNCTION XTest
TEXT TO FILE wishedit.txt
<div align="center">
<center>
<table border="4" cellpadding="5" width="100%" colspan="1"
BORDERCOLOR="#7D7D7D">
<tr>
<td bgcolor="#9C6995">
<font color=#FFFFFF>
Editing WISHLIST<br> <font
size=+1>Record:</font>
<font size=5>
<bold>"DCCGI_Record"</font></bold>
<FONT SIZE=+1> "DCCGI_TitleMsg"</FONT>
</td>
</tr>
<tr>
<td bgcolor="#008080">
<input type=submit value="First" name="DbEditAction">
<input type=submit value="Prev" name="DbEditAction">
<input type=submit value="Next" name="DbEditAction">
<input type=submit value="Last" name="DbEditAction">
<input type=submit value="Abort" name="DbEditAction">
<input type=submit value="Commit" name="DbEditAction">
<input type=submit value="New" name="DbEditAction">
<input type=submit value="Browse" name="DbEditAction">
</td>
</tr>
<tr>
<td valign="top" bgcolor="#FFFFCC">
<table width=500>
<tr>
<td><b><em>Name of
WishMaker:</b></em></td>
<td><b><em>Date of
Wish:</em></b></td>
<td><b><em>Status:</em></b></td
2
</tr>
<tr>
<td><b><font
color="#0000FF">"DCCGI_UserName"
</font></b></td>
<td><b>"dCGI_WishDate"</b></td>
<td><b>"nCGI_WishStatus"</b></td>
</tr>
<tr>
<td colspan=3><b><em>Short
Description:</em></b></td>
</tr>
<tr>
<td colspan=3><input type=text name="cCGI_Description"
size=75 maxlength=75></td>
</tr>
</table>
<b><em>Explanation of
Wish:</em></b><br>
<TEXTAREA name="mCGI_Memo" rows=7 cols=80></TEXTAREA>
<br>
<b><em>Donnay Software
Reply:</em></b><br>
<TEXTAREA name="mCGI_Reply" rows=7 cols=80></TEXTAREA>
</td>
</tr>
</table>
</center>
</div>
ENDTEXT
cForm := DC_CGIStuff( WishEditFieldMap( .t., .t. ), ;
MemoRead( 'wishedit.txt' )
RETURN cForm
* --------------------
FUNCTION WishEditFieldMap( lEditMode )
RETURN { ;
{ 'DCCGI_UserName', ;
IIF(Empty(WISHLIST->user_name), ;
DC_CGIGetParmVal('DCCGI_UserName'),WISHLIST->user_name), ;
0 }, ;
{ 'dCGI_WishDate', ;
IIF(Eof(),Date(),WISHLIST->date), ;
0 }, ;
{ 'cCGI_Description', ;
WISHLIST->descrip, ;
IIF(lEditMode,1,0) }, ;
{ 'nCGI_WishStatus', ;
WISHLIST->status, ;
0 }, ;
{ 'sCGI_Version', ;
WISHLIST->version, ;
7 }, ;
{ 'mCGI_Memo', ;
IIF(lEditMode,WISHLIST->memo, ;
Strtran(WISHLIST->memo,Chr(13),'<BR>')), ;
IIF(lEditMode,6,0) }, ;
{ 'mCGI_Reply', ;
IIF(lEditMode,WISHLIST->reply, ;
Strtran(WISHLIST->reply,Chr(13),'<BR>')), ;
IIF(lEditMode .AND. lMasterPassWord,6,0) }, ;
{ 'DCCGI_Record', ;
IIF( Eof(),0, RecNo()), ;
0 }, ;
{ 'DCCGI_TitleMsg', ;
TitleMessage(), ;
0 } }
Source/Library:
_DCCGI.PRG, DCLIPX.DLL
See Also:
dc_cgiupdate()
dc_cgitrans()
Write a transacation to log file
Syntax:
DC_CGITrans() - > lStatus
Arguments:
None.
Returns:
A logical .TRUE. if the transaction record was written, .FALSE.
otherwise.
Description:
DC_CGITrans() is used to write a transaction record to a
database log named DCCGI.DBF. The record will contain the date
and time, the names and values of all passed data variables
(in array format) and the names and values of all passed
environment variables (in array format).
A call to DC_CGITrans() is recommended right after the call to
DC_CGIInit() in a CGI program. This will insure that all
information passed to the program is permanently captured in
the event of an error in the program. It can also be used
as a history log to monitor all activity by the program.
Notes:
The function DC_CGIInit() must be called before using this
function.
Examples:
<form METHOD="POST" ACTION="/cgi-bin/waa1gate.exe?dummy=0">
Your Name <input NAME="Name" TYPE="TEXT" size="20">
Company <input NAME="Company" TYPE="TEXT" size="20">
Street1 <input NAME="Street1" TYPE="TEXT" size="20">
Street2 <input NAME="Street2" TYPE="TEXT" size="20">
City <input NAME="City" TYPE="TEXT" size="20">
State <input NAME="State" SIZE="10" TYPE="TEXT">
Zip <input NAME="Zip" TYPE="TEXT" SIZE="10">
Country <input NAME="Country" TYPE="TEXT" size="20">
E-Mail Address <input NAME="Email" TYPE="TEXT" size="20">
Phone <input NAME="Phone" TYPE="TEXT" size="20">
Fax <input NAME="Fax" TYPE="TEXT" size="20">
<input type=hidden name="WAA_PACKAGE" value="DS">
<input type=hidden name="WAA_FORM" value="FreeDownload">
<input type=SUBMIT name="FreeDownload" value="Download!"
</form>
FUNCTION _register( oPackage )
oPackage:registerForm( 'FreeDownload' )
RETURN .T.
* -----------------
FUNCTION FreeDownload( oHtml, oContext )
LOCAL cName, cStreet1, cStreet2, cCompany, ;
cEmail, cState, cZip, cPhone, cFax, cCountry, cCity
IF !DC_CGIInit(oHtml, oContext)
RETURN .f.
ENDIF
DC_CGITrans()
dbeSetDefault('DBFCDX')
cName := DC_CGIGetParmVal('Name')
cCompany := DC_CGIGetParmVal('Company')
cStreet1 := DC_CGIGetParmVal('Street1')
cStreet2 := DC_CGIGetParmVal('Street2')
cState := DC_CGIGetParmVal('State')
cZip := DC_CGIGetParmVal('Zip')
cEmail := DC_CGIGetParmVal('Email')
cCountry := DC_CGIGetParmVal('Country')
cCity := DC_CGIGetParmVal('City')
cPhone := DC_CGIGetParmVal('Phone')
cFax := DC_CGIGetParmVal('Fax')
IF Empty(cName) .OR. !'@'$cEmail
oHTML:message( "Error", ;
'Please provide a Name and E-mail Address.<p>' + ;
'Click on your Back Button to return to the download page.<p>')
DC_CGIQuit()
RETURN .t.
ELSE
USE register INDEX register.cdx
OrdSetFocus('EMAIL')
SEEK Upper(Alltrim(cEmail))
IF Eof() .AND. DC_AddRec(10)
REPL REGISTER->name WITH cName,;
REGISTER->company WITH cCompany,;
REGISTER->street1 WITH cStreet1,;
REGISTER->street2 WITH cStreet2,;
REGISTER->city WITH cCity,;
REGISTER->country WITH cCountry,;
REGISTER->state WITH cState,;
REGISTER->zip WITH cZip,;
REGISTER->phone WITH cPhone,;
REGISTER->fax WITH cFax,;
REGISTER->email WITH cEmail,;
REGISTER->filename WITH cVariable,;
REGISTER->date WITH Date(),;
REGISTER->time WITH Time()
UNLOCK
ENDIF
RunShell('/C C:\spimail\sm.exe /t:' + Alltrim(cEmail) + ;
' /s:"File Download Instructions"' + ;
' /m:' + MemoRead('download.txt',,.t.,.t. )
cHtml += 'An email message has been sent to <em><b>' +
Alltrim(cEmail) + ;
' </b></em>with download
instructions<br><br>'
DC_CGISend(cHtml)
ENDIF
RETURN
Source/Library:
_DCCGI.PRG, DCLIPX.DLL
See Also:
dc_cgiinit()
dc_cgiupdate()
Update a database from an array of information
Syntax:
DC_CGIUpdate( < aStuff >, ;
[< cAlias >] ) - > lStatus
Arguments:
< aStuff > is a multi-dimensional array consisting of 3 sub
elements per item to update:
Element Type Description
------- ------ --------------------------------------------
[1] CNLMDB A value, code block, macro expression, or
name of variable.
[2] C Name of field to update (fully aliased)
[3] N The type of update to perform (default is 0)
See below table
Type [3] Description
-------------- --------------------------------------------
0 Direct replacement (no translation) DEFAULT
1,2,6 Character string [1] must be name of variable
3 Date [1] must be name of variable
4 Numeric [1] must be name of variable
5 Logical [1] must be name of variable
7 Reserved
8 Macro substitution
< cAlias > is the Alias of the database to update. If this
argument is not passed then the current alias is the default.
Returns:
A logical .TRUE. if the update was performed successfully.
Description:
DC_CGIUpdate() can be used in both web and non-web programs
however it was designed for CGI programs to simplify the
process of writing passed in data to a database because data
is always received as character strings but it often must be
saved to a database in another format like a date, numeric,
logical, or memo.
Examples:
<form METHOD="POST" ACTION="/cgi-bin/waa1gate.exe?dummy=0">
Your Name <input NAME="Name" TYPE="TEXT" size="20">
Company <input NAME="Company" TYPE="TEXT" size="20">
Street1 <input NAME="Street1" TYPE="TEXT" size="20">
Street2 <input NAME="Street2" TYPE="TEXT" size="20">
City <input NAME="City" TYPE="TEXT" size="20">
State <input NAME="State" SIZE="10" TYPE="TEXT">
Zip <input NAME="Zip" TYPE="TEXT" SIZE="10">
Country <input NAME="Country" TYPE="TEXT" size="20">
E-Mail Address <input NAME="Email" TYPE="TEXT" size="20">
Phone <input NAME="Phone" TYPE="TEXT" size="20">
Fax <input NAME="Fax" TYPE="TEXT" size="20">
<input type=hidden name="WAA_PACKAGE" value="DS">
<input type=hidden name="WAA_FORM" value="FreeDownload">
<input type=SUBMIT name="FreeDownload" value="Download!"
</form>
FUNCTION _register( oPackage )
oPackage:registerForm( 'FreeDownload' )
RETURN .T.
* -----------------
FUNCTION FreeDownload( oHtml, oContext )
LOCAL cName, cStreet1, cStreet2, cCompany, ;
cEmail, cState, cZip, cPhone, cFax, cCountry, cCity
IF !DC_CGIInit(oHtml, oContext)
RETURN .f.
ENDIF
aUpdate := { ;
{ "Name", "REGISTER->name", 1 }, ;
"Company", "REGISTER->company", 1 }, ;
"Street1", "REGISTER->street2", 1 }, ;
"Street2", "REGISTER->street2", 1 }, ;
"City", "REGISTER->city", 1 }, ;
"State", "REGISTER->state", 1 }, ;
"Zip", "REGISTER->zip", 1 }, ;
"Country", "REGISTER->country", 1 }, ;
"Email", "REGISTER->email, 1 }, ;
"Phone", "REGISTER->phone, 1 }, ;
"Fax", "REGISTER->fax, 1 }, ;
"Date()", "REGISTER->date, 8 }, ;
{||Time()}, "REGISTER->time, 0 } }
USE REGISTER
DC_CGIUpdate( aUpdate, "REGISTER" )
RETURN nil
Source/Library:
_DCCGI.PRG, DCLIPX.DLL
dc_chdir()
Change dos directory
Syntax:
DC_ChDir ( < cDirectory > ) - > lStatus
Arguments:
< cDirectory > is the drive and directory to select.
Returns:
.TRUE. if the drive and/or directory exists and is selected.
.FALSE. if the drive and/or directory does not exist.
Description:
DC_CHDIR() is used to select a new dos drive and directory.
Examples:
DC_CHDIR('A:')
DC_CHDIR('C:\DCLIP')
DC_CHDIR('\DCLIP\DATA')
Source/Library:
_DCCHDIR.PRG/.OBJ, DCLIPX.LIB
dc_childcount()
Report the number of child work areas
Syntax:
DC_ChildCount ( [< nArea >] ) - > nChildren
Arguments:
< nArea > is the work area. If argument is not passed, then the
current work area is default.
Description:
DC_CHILDCOUNT() is used to report the total number of
parent-child relations for a specified work area.
Examples:
. use customer
. use invoice new
. use sales new
. sele customer
. set rela to cust_nmbr into invoice, to so_nmbr into sales
. ? DC_CHILDCOUNT()
2
Source/Library:
_DCAREA.PRG, DCLIP1.DLL
See Also:
dc_setrelation()
dc_chrsel()
Choose a character from an ASCII Character Chart
Syntax:
CHR
Arguments:
None.
Returns:
The numeric value of the character selected.
Description:
DC_ChrSel() will display a chart of the 256 ASCII text-mode
characters and return the numeric value of the selected character.
Notes:
CAUTION: This is a text-mode function so the SetAppWindow()
must be a CRT window.
Examples:
. ? dc_chrsel()
Source/Library:
_DCCHR.PRG, DCLIP1.DLL
See Also:
CHR
dc_clearevents()
Clear all events out of the Event Queue
Syntax:
DC_ClearEvents() - > nil
Returns:
nil
Description:
DC_CLEAREVENTS() will clear all pending events from the event
Queue. This is handy when calling a dialog function to insure
that no mouse or keyboard events are in the queue thus adversely
affecting the operation of the dialog window.
Source/Library:
_DCFUNCT.PRG/.OBJ, DCLIPX.DLL
See Also:
dc_completeevents()
dc_saveevents()
dc_restoreevents()
dc_closearea()
Close the database that is open in the current work area
Syntax:
DC_CloseArea() - > nil
Arguments:
None.
Returns:
Nil.
Description:
DC_CLOSEAREA() is a front-end to the Xbase++ function dbCloseArea().
Before calling dbCloseArea(), DC_CLOSEaREA() tests the function
DC_UseDBFProtect(). If this function returns a logical .TRUE.
then DC_CLOSEAREA() first modifies the header of the database
before the database is closed to prevent other utility programs
from being able to open the database. If a file header is
modified by DC_CLOSEAREA(), then it can only be restored again
by DC_USEAREA().
Examples:
. DC_UseDBFProtect(.t.)
// open TEST.DBF
. DC_UseArea( .t., 'DBFNTX', 'TEST' )
// close TEST.DBF but first modify header to protect the data
. DC_CloseArea()
Source/Library:
_DCUSE.PRG, DCLIP2.DLL
See Also:
dc_usedbfprotect()
dc_usearea()
dc_clrarr()
Initialize or modify the Color Array
Syntax:
DC_ClrArr ( ) - > lStatus
Arguments:
NONE
Description:
DC_CLRARR() is used to initalize or the dCLIP system color
array. The color array is a PUBLIC array named DCCOLOR and is
automatically initialized by any dCLIP function that uses the
array. This function is normally not needed unless you are
using the dCLIP color system in your own functions.
The first time the color array is initialized in an application
using dCLIP functions, if a file named DCCOLOR.AR is found in
the SET DCLIP directory, then the contents of the file will be
used to intialize the array, otherwise the default colors will
be used.
dCLIP also provides multiple "palettes" of colors which can be
saved to DCCOLOR.AR and modified or selected via DC_CLRSETUP().
Notes:
dCLIP Color Manifest Constants from DCCOLOR.CH
Manifest
constant Element Description
------------ ----------------------- ----------------------------
cC_DOTPROMPT dCCOLOR[dCCOLOR[1]+1,1] Main dot-prompt
cC_BRMENUF dCCOLOR[dCCOLOR[1]+1,2] Browse menus frame
cC_BRMENUD dCCOLOR[dCCOLOR[1]+1,3] Browse menus data
cC_BRMENUH dCCOLOR[dCCOLOR[1]+1,4] Browse menus header
cC_BRMENUB dCCOLOR[dCCOLOR[1]+1,5] Browse menus menu bar
cC_BRMENUS dCCOLOR[dCCOLOR[1]+1,6] Browse menus select bar
cC_POPMENF dCCOLOR[dCCOLOR[1]+1,7] Popup / pulldown menu frames
cC_POPMENI dCCOLOR[dCCOLOR[1]+1,8] Popup / pulldown menu items
cC_POPMENS dCCOLOR[dCCOLOR[1]+1,9] Popup / pulldown menu select bars
cC_MEMOBOX dCCOLOR[dCCOLOR[1]+1,10] All memos box
cC_MEMOTXT dCCOLOR[dCCOLOR[1]+1,11] All memos contents
cC_EXPBOXF dCCOLOR[dCCOLOR[1]+1,12] Exploding boxes frame
cC_EXPBOXC dCCOLOR[dCCOLOR[1]+1,13] Exploding boxes contents
cC_DBUGGER dCCOLOR[dCCOLOR[1]+1,14] DBUGGER main screen
cC_WARNBOX dCCOLOR[dCCOLOR[1]+1,15] Warning boxes frame
cC_WARNTXT dCCOLOR[dCCOLOR[1]+1,16] Warning boxes contents
cC_DBUGBOX dCCOLOR[dCCOLOR[1]+1,17] Debug boxes frames
cC_DBUGTXT dCCOLOR[dCCOLOR[1]+1,18] Debug boxes contents
cC_DBUGBAR dCCOLOR[dCCOLOR[1]+1,19] Debug boxes select bar
cC_SPECIAL dCCOLOR[dCCOLOR[1]+1,20] Special codes
cC_SAY dCCOLOR[dCCOLOR[1]+1,21] SAYs
cC_PENDGET dCCOLOR[dCCOLOR[1]+1,22] Pending GETs
cC_CURRGET dCCOLOR[dCCOLOR[1]+1,23] Current GET
cC_STAT1 dCCOLOR[dCCOLOR[1]+1,24] Dot-prompt status line / lines
cC_STAT2 dCCOLOR[dCCOLOR[1]+1,25] Dot-prompt status line / data
lC_BLINKBIT dCCOLOR[dCCOLOR[1]+1,34] Blink-bit or High Intensity
cC_SETNAME dCCOLOR[dCCOLOR[1]+1,35] Name of this color set
cC_COLORNAME 35 Numeric value of cC_SETNAME
nC_COLORPAL dCCOLOR[1] Default color palette
Examples:
#include "dccolor.ch"
FUNCTION main
DC_CLRARR() // initalize array
dc_expl(10,10,15,70) // explode a box
setcolor(cC_EXPBOXC) // set color to box contents
@ 12,12 say 'Enter something below'
something := space(10)
@ 14,12 get something
read
Source/Library:
_DCCOLOR.PRG/.OBJ, DCLIPX.LIB
dc_clrscope()
Clear scoping values for the current work area
Syntax:
dc_clrscope ( ) - > Nil
Arguments:
None.
Returns:
Nil
Description:
DC_CLRSCOPE() is used to clear both the SCOPE TOP and
SCOPE BOTTOM "scoping range" values that were previously set
by DC_SETSCOPE().
Notes:
DC_SETSCOPE() does not establish the scoping range at the
RDD-layer level, but instead is just a handy way of storing
the SCOPE TOP and SCOPE BOTTOM to be retrieved by programs
that can use this information such as data-entry systems and
browse systems. It does not affect the behavior of the
data-driver nor does it set any filters on the data.
Examples:
#include 'dcdialog.ch'
#include 'appevent.ch'
PROCEDURE XTest()
LOCAL GetList := {}, oBrowse, aPres, cScopeTop, cScopeBot
USE ..\XDOC\EXPRESS INDEX ..\XDOC\EXPRESS.CDX ;
VIA FOXCDX ALIAS XDOC
OrdSetFocus('COMMAND')
DC_KeyStat(.t.)
DC_SETSCOPE(0,'DC_G')
DC_SETSCOPE(1,'DC_K')
DC_DbGoTop()
aPres := ;
{ { XBP_PP_COL_HA_FGCLR, GRA_CLR_WHITE }, /* Header FG Color */ ;
{ XBP_PP_COL_HA_BGCLR, GRA_CLR_DARKGRAY }, /* Header BG Color */ ;
{ XBP_PP_COL_DA_ROWSEPARATOR, XBPCOL_SEP_DOTTED }, /* Row Sep */ ;
{ XBP_PP_COL_DA_COLSEPARATOR, XBPCOL_SEP_DOTTED } /* Col Sep */ ;
}
cScopeTop := Pad('DC_G',10)
cScopeBot := Pad('DC_K',10)
@ 1,1 DCSAY 'Scope Top' GET cScopeTop PICT '@!' SAYRIGHT ;
VALID {||DC_SetScope(0,Alltrim(cScopeTop)),;
oBrowse:RefreshAll(),;
SetAppFocus(oBrowse),.t.}
@ 1,25 DCSAY 'Scope Bottom' GET cScopeBot PICT '@!' SAYRIGHT ;
VALID {||DC_SetScope(1,Alltrim(cScopeBot)),;
oBrowse:RefreshAll(),;
SetAppFocus(oBrowse),.t.}
@ 1, 65 DCPUSHBUTTON CAPTION 'Clear ~Scope' SIZE 10,1.5 ;
ACCELKEY xbeK_ALT_S ;
ACTION {||DC_CLRSCOPE(),oBrowse:RefreshAll(),;
SetAppFocus(oBrowse)}
@ 3,1 DCBROWSE oBrowse ALIAS 'XDOC' ;
SIZE 77,11.8 ;
FREEZELEFT {1} ;
PRESENTATION aPres ;
SCOPE
DCBROWSECOL FIELD XDOC->command ;
HEADER "Command" PARENT oBrowse
DCBROWSECOL FIELD XDOC->type ;
HEADER "Type" PARENT oBrowse
DCBROWSECOL FIELD XDOC->short ;
HEADER "Short Description" PARENT oBrowse
DCBROWSECOL FIELD XDOC->module ;
HEADER "Module" PARENT oBrowse ;
DCBROWSECOL FIELD XDOC->category ;
HEADER "Category" PARENT oBrowse
DCBROWSECOL FIELD XDOC->see_also ;
HEADER "See Also" PARENT oBrowse
DCREAD GUI ;
FIT ;
ADDBUTTONS ;
TITLE 'Scoping Demo: DC_G thru DC_K'
RETURN
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_setscope()
dc_cls()
Perform a clear screen of a window created by DC_EXPL()
Syntax:
DC_Cls ( [< aSaveScreen >] ) - > nil
Arguments:
< aSaveScreen > is an array of screen information that was
originally returned by DC_EXPL(). If no parameter is
passed, then the static array posted by the last usage of
DC_EXPL() or the DCEXPLODE command will be used for the
screen information. If no call to DC_EXPL() or DCEXPLODE
is made since the last call to DC_IMPL() or DCIMPLODE,
then the text is written to the CRT window and treated as
a normal @..SAY.
Returns:
NIL
Description:
DC_CLS() is a Dual-Mode function which is used to clear all the
text in a TEXT window or GUI dialogue that was created by
DC_EXPL().
Examples:
aText := { "Enter a name to search.",;
"The name must start with",;
"an alphabet character" }
disp_msg( 10,10,15,40,aText )
return
/* --------- */
FUNC disp_msg ( nSrow, nScol, nErow, nEcol, aText )
DC_Gui(.t.) // display a gui dialogue
cScreen := dc_expl( nSrow, nScol, nErow, nEcol )
for i := 1 to len(aText)
DC_SAY( i+1, 2, aText[i] )
next
Source/Library:
_DCEXPL.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_expl()
dc_cmonth()
Translated name of the Month
Syntax:
DC_CMonth( < dDate > ) - > cMonth
Arguments:
< dDate > is any valid date type.
Returns:
A character string.
Description:
DC_Cmonth() is used to get the name of the month for a specified
date. The name is translated to the language previously selected
by DC_LangSel().
Examples:
DC_LangSet( DCLANG_GERMAN )
? DC_CMonth( Date() )
Oktober
Source/Library:
_DCCALEN.PRG, DCLIPX.DLL
See Also:
dc_cdow()
dc_langset()
dc_langmsg()
dc_codedelete()
Delete a code table
Syntax:
dc_codedelete ( [< cTableName >] ) - > lStatus
Arguments:
< cTableName > is the name of the code table. This is a name of
up to eight (8) digits. If no argument is passed, then a pick
list of all code tables in the code table file will be displayed.
Description:
DC_CODEDELETE() is used to delete a code table from the code
table file.
Notes:
The DCCODES.DBF file and its indexes will be created by
the DC_CodeOpen() function if it they do not already exist.
Examples:
DC_CODEELETE('POSITION')
Source/Library:
_DCCODES.PRG, DCLIP1.DLL
See Also:
dc_codeedit()
dc_codeget()
dc_codeload()
dc_codeedit()
Edit a Code Table
Syntax:
dc_codeedit ( [ < cCodeTable > | < aCodeTable > ] ) - >
aCodeTable
Arguments:
< cCodeTable > is the name of the code table in DCCODES.DBF
to load and edit (up to 8 characters) or < aCodeTable > is a
Code Table array. See RETURNS for a specification of this
array. If no parameter is passed, a pick-list of all Code
Tables in DCCODES.DBF will be displayed.
Returns:
A 2-dimensional array of two sub-arrays.
The first array contains general information about the
screen group.
Element Type Description
------- ---- --------------------------------------
[1] C Code Table Name (up to 8 characters)
[2] C Code Table Description
The second array contains one sub-array for each code
table item.
Element Type Description
------- ---- ---------------------------------------
[1] C Code Table Name (up to 8 chars)
[2] C Code Name (up to 10 chars)
[3] C Code Description (up to 50 chars)
[4] C Code Sequence (used for indexing file)
[5] C Code UR (reserved)
Description:
DC_CodeEdit() is an editor that is used to maintain the DCCODES.DBF
dictionary file. Code Tables are groups of records that are
loaded into an array pick-list and used in validations when
using the eXPress++ data-driven Browse and Edit (data-entry)
system. When a "T" validation is used in a field-array, this
pops-up a code table pick-list for the operator to choose
possible values. Code tables can also be used in custom
applications where validations and/or choice boxes are required.
For example a code table named "POSITION" can be added to
provide a picklist of available entries for a field of
baseball player positions. They would be entered in a code
table as follows:
1B - First Base
2B - Second Base
3B - Third Base
P - Pitcher
SS - Short Stop
RF - Right Field
LF - Left Field
CF - Center Field
C - Catcher
A choice from this table can then be selected by calling
DC_CodeGet() in a validation or popup routine.
Notes:
The DCCODES.DBF file and its indexes will be created by
the DC_CodeOpen() function if it they do not already exist.
Examples:
-- Example 1 --
// Load a code table from the dictionary and edit it //
DC_CODEDIT()
-- Example 2 --
// Edit code table "POSITION"
DC_CODEEDIT("POSITION")
-- Example 3 --
// Edit a code table array and save it to dictionary //
aCodeTable := DC_CodePick()
aCodeTable := DC_CODEDIT( aCodeTable )
DC_CodeSave( aCodeTable )
Source/Library:
_DCCODES.PRG, DCLIP1.DLL
See Also:
CODE EDIT
dc_codeget()
Get a choice from a code table
Syntax:
DC_CodeGet ( < cTableName >, ;
[@< cCode >], ;
[< cTitle >], ;
[< lForcePick >], ;
[@< cDesc >], ;
[@< aCode >], ;
[< lNoPick >], ;
[< lCurrPos >], ;
[< lValidate >] ) - > cCode
Arguments:
< cTableName > is the name of the code table in DCCODES.DBF.
to load (up to 8 characters).
@< cCode > is an optional value to seek in the code table. If
the value is found and < lPickList > is .FALSE. then the
full value will be returned and the description will be
placed into the @< cDesc > variable. If the value is not
found or < lForcePick > is .TRUE., a pick list will be
displayed for the user to choose a code.
< cTitle > is the title to place at the top of the picklist.
If no parameter is passed, then a default title is displayed.
@< cDesc > is a variable to be passed by reference. The value
in the description field (CODE_DESC) will be placed into
this variable.
@< aCode > is a variable to be passed by reference. The value
of all database fields for the selected code will be placed
into an array of 6 elements and placed into this variable.
Element Field Name
------- ------------
1 CODE_NAME
2 CODE_DESC
3 CODE_SEQ
4 CODE_UR
5 CODE_UDF1
6 CODE_UDF2
< lNoPick > if .TRUE. will not display a pick-list if the code
cannot be found.
< lCurrPos > if .TRUE. (default) will display the window at the
current mouse position.
< lValidate > if .TRUE. will return a logical value rather than
the selected code table value. See RETURNS.
Returns:
The value of the code chosen (a Character string) if <þlValidateþ>
is .FALSE.
IF <þlValidateþ> is .TRUE. then the returned value is a logical
.TRUE. if the user selected a code from the table, otherwise a
logical .FALSE. is returned. Also, the selected value is returned
in the variable @<þcCodeþ> when it is passed by reference.
Description:
DC_CODEGET() is used to allow the operator to select a code
from a designated code table. All codes are stored in the
DCCODES.DBF database in separate tables.
"User defined fields" allow data to easily be extracted from a code
table via the DC_CODEGET() function.
The "definition" of the three fields is established under the "options"
for the code table. Each of the fields is a character type field with
a length of 50. For example, let's establish a code table named
"REPORTS" with the following data:
Code Description User Field 1 User Field 2
---- ------------------ ---------------- -----------------
R001 Inventory Report INVREPT.EXE Executable Program
R002 Sales Report {||SlsRept()} Code-Block
R003 End-of-Month EOF.RP1 R&R Report
Now, you can use DC_CODEGET() to place "virtual" fields on the screen
so you can display the Description, User Field 1 and User Field 2
based on the code entered into another field.
Notes:
The DCCODES.DBF file and its indexes will be created by
the DC_CodeOpen() function if it they do not already exist.
Examples:
--- Example 1 ---
LOCAL GetList := {}, cTreatment
cTreatment := Space(10)
@ 12,12 DCSAY "Enter Treatment Plan Code" GET cTreatment ;
PICT '@!' POPUP {|c|DC_CODEGET('TRTMENT',c,,.t.)} )
DCREAD GUI FIT ADDBUTTONS MODAL TITLE 'Treatment'
RETURN cTreatMent
--- Example 2 ---
To display the description:
Eval({|a|DC_CodeGet('REPORTS',repttype,,,,@a,.t.),a[2]})
To display user field 1:
Eval({|a|DCC_odeGet('REPORTS',repttype,,,,@a,.t.),a[3]})
To display user field 2:
Eval({|a|DC_CodeGet('REPORTS',repttype,,,,@a,.t.),a[4]})
Source/Library:
_DCCODES.PRG, DCLIP1.DLL
See Also:
dc_codeedit()
dc_codeload()
dc_codeimp()
Import a code table
Syntax:
dc_codeimp ( [< cTableName > | "ALL"] ) - > lStatus
Arguments:
< cTableName > is the name of the code table. This is a name of
up to eight (8) digits. If a code table name is passed then
the DXCODES.DBF database will be searched and all code table
items that match the code table name will be imported into
DCCODES.DBF. If no name is passed, then a pick-list of all tables
stored in the DXCODES.DBF database will be displayed.
If "ALL" is passed as the table name, then all tables in the
DXCODES.DBF will be imported into DCCODES.DBF.
Returns:
A logical .TRUE. if the files were imported successfully.
Description:
DC_CODEIMP() is used to import a code table from the DXCODES.DBF
import/export file to the DCCODES.DBF file.
Notes:
The DCCODES.DBF file is the data-dictionary database that
contains all code tables. If this file does not exist in your
default directory or path then it will be created. The
DXCODES.DBF file is the data-dictionary database that contains
all code tables that were exported from another system.
Examples:
DC_CODEIMP( "ALL" )
Source/Library:
_DCCODES.PRG, DCLIP1.DLL
See Also:
dc_codeedit()
dc_codeget()
dc_codeload()
dc_codeload()
Load a code table into an array
Syntax:
dc_codeload ( [< cCodeTable >], ;
[< lCache >], ;
[< lExport >] ) - > aCodeTable
Arguments:
< cCodeTable > is the name of the code table in DCCODES.DBF
to load (up to 8 characters). If no parameter is passed, a
pick-list of all Code Tables in the DCCODES.DBF dictionary
will be displayed.
< lCache > if .TRUE. (default) will save the table to a static
cache array so the next time it is requested it will be
reloaded from the static array for faster speed. If .FALSE.
then it will not be saved to the cache.
< lExport > if .TRUE. will open the DXCODES.DBF (import/export)
file rather than the DCCODES.DBF file.
Returns:
A 2-dimensional array of two sub-arrays.
The first array contains general information about the
screen group.
Element Type Description
------- ---- --------------------------------------
[1] C Code Table Name (up to 8 characters)
[2] C Code Table Description
The second array contains one sub-array for each code
table item.
Element Type Description
------- ---- ---------------------------------------
[1] C Code Table Name (up to 8 chars)
[2] C Code Name (up to 10 chars)
[3] C Code Description (up to 50 chars)
[4] C Code Sequence (used for indexing file)
[5] C Code UR (reserved)
Description:
DC_CODELOAD() is used to load a code table array from the
DCCODES.DBF dictionary file.
Notes:
The DCCODES.DBF file and its indexes will be created by
the DC_CodeOpen() function if it they do not already exist.
Examples:
. aCodeTable := DC_CODELOAD( 'POSITION' )
. aCodeTable := DC_CodeEdit( aCodeTable )
. DC_CodeSave( aCodeTable )
Source/Library:
_DCCODES.PRG, DCLIP1.DLL
See Also:
dc_codeedit()
dc_codeget()
dc_codepick()
Pick a code table from the Code Table File
Syntax:
dc_codepick ( [< cTitle >], ;
[< lExport >], ;
[@< cTableDesc >], ;
[< aCodeList >], ;
[< lNoPick >] ) - > cTableName
Arguments:
< cTitle > is the title to display on the pick-list box.
< lExport > if .TRUE. will open the DXCODES.DBF (import/export)
file rather than the DCCODES.DBF file.
@< cTableDesc > is the name of a variable (passed by reference)
to store the description of the table that was chosen.
@< aCodeList > is the name of a variable (passed by reference)
to store a single-dimensional array containing the names of
all code tables in the code table file.
< lNoPick > if .TRUE. will not pop up the list of code tables
to choose. This option is intended to be used only when
@< aCodeList > is also passed.
Returns:
A character string containing the name of the code table
selected by the user.
Description:
DC_CODEPICK() is used to pick the name of a code table
from the DCCODES.DBF Code Table dictionary.
Notes:
The DCCODES.DBF file and its indexes will be created by
the DC_CodeOpen() function if it they do not already exist.
Examples:
cCodeTable := DC_CODEPICK()
IF !Empty(cCodeTable)
aCodeTable := DC_CodeEdit( cCodeTable )
ENDIF
Source/Library:
_DCCODES.PRG, DCLIP1.DLL
See Also:
dc_codeedit()
dc_codeget()
dc_coderename()
Rename a Code Table
Syntax:
DC_CodeRename( [< cTableName >], ;
[< cNewName >], ;
[< cNewDesc >] ) - > lStatus
Arguments:
< cTableName > is the name of the table to rename. This is a
name of up to 10 characters. If no name is given, then a pick
list of all code tables will be displayed.
< cNewName > is the new name. If no name is given, then a
dialog window will be displayed to enter a new name.
< cNewDesc > is the new description. If no description is given,
the old description will be used.
Returns:
A logical .TRUE. if the rename was successful.
Description:
DC_CodeRename() is used to rename a Code Table.
Examples:
DC_CodeRename( 'BULLET', 'BULLETS' )
Source/Library:
_DCCODES.PRG, DCLIP1.DLL
See Also:
CODE RENAME
dc_codeedit()
dc_codesave()
Save a code table array to the Code Table file
Syntax:
dc_codesave ( < aCodeTable >, ;
[< lExport >] ) - > lStatus
Arguments:
< aCodeTable > is a code table array that conforms to the
specification of the array documented in RETURNS for the
function DC_CODEEDIT().
< lExport > if .TRUE. will save to the DXCODES.DBF (import/export)
file rather than DCCODES.DBF.
Returns:
A logical .TRUE. if the code table was saved, .FALSE. otherwise.
Description:
DC_CODESAVE() is used to save a code table array to the
DCCODES.DBF dictionary file.
Notes:
The DCCODES.DBF file and its indexes will be created by
the DC_CodeOpen() function if it they do not already exist.
Examples:
aCodeTable := DC_CodePick()
aCodeTable := DC_CodeEdit( aCodeTable )
DC_CODESAVE( aCodeTable )
Source/Library:
_DCCODES.PRG, DCLIP1.DLL
See Also:
dc_codeedit()
dc_codeget()
dc_codeload()
dc_color()
Set the current screen color value
Syntax:
DC_Color ( < cColorString > | < nColorElement >, ;
[< lSelectBar >], ;
[< lReverseVideo >] ) - > cColorString
Arguments:
< cColorString > is the color string value to set. See the
color definitions in DCCOLOR.CH. String definitions start
with cC_*.
or
< nColorElement > is the number of the color based on the table
of Numeric color definitions in DCCOLOR.CH. Numeric definitions
start with nC_*.
< lSelectBar > if .TRUE. will set the color to "highlight" if
application is being run on a monochrome monitor or COLOR_MON
is .FALSE.
< lReverseVideo > is used only if < lSelectBar > is .TRUE. If
.TRUE., this argument will set highlight to "reverse video".
Returns:
A numeric value equal to the palette number of the new color palette.
Description:
DC_COLOR() is a replacement for SETCOLOR(). DC_COLOR()
automatically tests the status of ISCOLOR() and a STATIC
variable named COLOR_MON to determine if the application is
being run on a color monitor. This allows the programmer or
user to enable all color output dynamically by simply turning
color on or off with the DC_COLORSET() function.
Examples:
#include "dccolor.ch"
// Set color to Browse menus frame color
// Use numeric value - nC_BRMENUF is defined as 2
// This is the preferred method for speed and code size
// Use this method if you are using dCLIP colors
DC_COLOR( nC_BRMENUF )
// Set color to Browse menus frame color
// Use Character string value
// cC_BRMENUF is defined as DCCOLOR[DCCOLOR[1]+1,2]
// This method is provided only for backward compatability
DC_COLOR( cC_BRMENUF )
// Set color to 'BG+/W'
// Use Character string value
DC_COLOR( 'BG+/W' )
Source/Library:
_DCCOLOR.PRG/.OBJ, DCLIPX.LIB
dc_color2array()
Convert a color string to an array
Syntax:
DC_Color2Array( [< cColorString >] ) - > aColor
Arguments:
< cColorString > is a valid Clipper color string. If no
parameter is passed, then the current SETCOLOR() will be
used.
Returns:
An array of 5 elements;
Element Type Color
------- ---- -------------------------
[1] C Standard (screen output)
[2] C Enhanced (GETS, hilites)
[3] C Border
[4] C Background (unsupported)
[5] C Unselected GETS
Description:
DC_COLOR2ARRAY() is a handy function which is used to convert
a standard "complex" Clipper color string to an array of
individual colors.
Examples:
PROCEDURE XTest()
LOCAL cColorString := 'W+/B,,N/BG'
DC_Gui(.t.)
DC_MsgBox( DC_COLOR2ARRAY() )
DC_MsgBox( DC_COLOR2ARRAY( cColorString ) )
RETURN
Source/Library:
_DCCOLOR.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_color()
dc_color2gra()
Convert a color string to a GUI compatible color
Syntax:
DC_Color2Gra( [< cColorString >] ) - > aColor
Arguments:
< cColorString > is a valid Clipper color string. If no
parameter is passed, then the first color in the current
SETCOLOR() will be used.
Returns:
An array of 2 elements;
Element Type Description
------- ---- -------------------------
[1] N ForeGround Color
[2] N BackGround Color
Description:
DC_COLOR2GRA() is used to convert a Text-Based color string
to a 2 element array containing a foreground and background
color which is compatible with GUI objects.
Examples:
#include 'dcdialog.ch'
PROCEDURE XTest()
LOCAL GetList := {}, cColor := 'GR+/R', aPres, aColor
aColor := DC_Color2Gra(cColor)
aPres := { {XBP_PP_FGCLR, aColor[1]},;
{XBP_PP_BGCLR, aColor[2]} }
@ 0,0 DCSAY 'This should be yellow on red' SAYSIZE 40,2 ;
FONT 'Helv.32' COLOR aColor[1], aColor[2]
DCREAD GUI ;
FIT ;
ADDBUTTONS
RETURN
Source/Library:
_DCCOLOR.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_say()
dc_gra2color()
dc_coloradd()
Add a new color set to the Color Array
Syntax:
DC_ColorAdd ( ) - > nPalette
Arguments:
NONE
Description:
DC_COLORADD() will add a new color palette set to the color
array and save the contents to DCCOLOR.AR for restoring with
the DC_CLRARR() initialize function.
Source/Library:
_DCCOLOR.PRG/.OBJ, DCLIPX.LIB
dc_colordel()
Delete a color set from the Color Array
Syntax:
DC_ColorDel ( [< nPalette >] ) - > lStatus
Arguments:
< nPalette > is the number of the color palette to delete. You
cannot delete color palette number 0 or 1, so this number must
be greater than 1. If no argument is given, then a pick-list
of palette descriptors will be displayed.
Description:
DC_COLORDEL() is used to delete a color palette that was
created with DC_COLORADD().
Examples:
. nPalette := dc_coloradd()
. DC_COLORDEL( nPalette )
Source/Library:
_DCCOLOR.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_coloradd()
dc_colorlist()
Convert a GRA_CLR_* numeric index to a description array
Syntax:
DC_ColorList( < nColor >, ;
[@< aColorTypes >], ;
[@< aColors >] ) - > cColor
Arguments:
< nColor > is an index from -5 to 15.
@< aColorTypes > is an optional memory variable to store a
single-dimensional array of 21 characters representing the
colors for index values from -5 to 15.
@< aColors > is an optional memory variable to store a
multi-dimensional array of 21 sub-elements representing the
colors for index values from -5 to 15.
Returns:
A Character String
Description:
DC_COLORLIST() is used create an array of character strings that
represent a conversion of standard GRA_CLR_* numeric values.
This is a handy function which is used to create a picklist of
colors by color name.
Examples:
#include 'gra.ch'
PROCEDURE XTest()
LOCAL nColor := GRA_CLR_GREEN, aColorList, aColors, cColor
cColor := DC_ColorList( nColor, @aColorList, @aColors )
DC_Gui(.t.)
DC_MsgBox( { cColor, ;
aColorList[GRA_CLR_DARKGRAY], ;
aColors[GRA_CLR_YELLOW] } )
DC_MsgBox( aColorList )
RETURN
Source/Library:
_DCCOLOR.PRG/.OBJ, DCLIPX.LIB
dc_colormode()
Enable or Disable Color / Monochrome display mode
Syntax:
DC_ColorMode ( [< lColorOn >] ) - > lStatus
Arguments:
< lColorOn > if .TRUE. will enable the color display, if .FALSE.
will enable monochrome display.
Description:
DC_COLORMODE() is used to enable or disable the color display.
Use this function to disable color mode when using dCLIP
functions in an application that is running on a monochrome
display with a color driver board that returns an ISCOLOR() of
.true.
Examples:
. DC_COLORMODE(.f.) // disable color display
Source/Library:
_DCCOLOR.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_color()
dc_colorrest()
Restore a color set
Syntax:
DC_ColorRest( < nPalette > ) - > nil
Arguments:
< nPalette > is the number of the palette that was saved with the
DC_SAVECOLOR() function.
Description:
DC_COLORREST() is used to restore a color palette that was
previously saved with DC_COLORSAVE().
Examples:
. nPalette := dc_colorsave() // save color palette
. do something
. DC_COLORREST( nPalette ) // restore old color palette
Source/Library:
_DCCOLOR.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_colorsave()
dc_colorsave()
Save the current color set
Syntax:
DC_ColorSave() - > nPalette
Arguments:
NONE
Description:
DC_COLORSAVE() is used to save the number of the currently
selected color palette for later restoring with DC_COLORREST().
Use DC_COLORSAVE() and DC_COLORREST() if you are calling a
function that might select a different color palette such as
DC_BROWSEDB().
Examples:
. nPalette := DC_COLORSAVE() // save selected palette number
. do something
. dc_colorrest( nPalette ) // restore old color palette
Source/Library:
_DCCOLOR.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_colorrest()
dc_colorsel()
Select a color set from the Color Array
Syntax:
DC_ColorSel( [< nPalette >] ) - > nPalette
Arguments:
< nPalette > is the number of the color palette to select. If no
argument is passed then the number of the currently selected
palette will be returned. If a 0 is passed or if the number is
not a valid palette number then a pick-list of available palette
descriptions will be displayed.
Description:
DC_COLORSEL() is used to select a color palette. The default
number of palettes in the dCLIP color system is one (1), so
this function is useful only after creating extra color
palettes with the DC_COLORADD() function.
Multiple color palettes are provided in the dCLIP system for
the following purpose:
1. To allow the user to select a different color set when using
dCLIP functions in applications that must be run on multiple
display systems. For example, if you work with dCLIP part
time on a color monitor and part time on an LCD display, you
can create color palettes that are "optimized" for you
display type.
2. To allow the user to select different color sets for
different windows in an application.
Examples:
. nPalette := dc_colorsave()
. DC_COLORSEL(0) // select a color palette
. do something
. dc_colorrest( nPalette ) // restore the old palette
Source/Library:
_DCCLR2.PRG/.OBJ, DCLIPX.LIB
dc_compile()
Compile a source .PRG or all changed .PRGs
Syntax:
DC_Compile ( [< cFileName >], ;
[< cCompOpt >], ;
[< lQuiet >], ;
[< lWindow >], ;
[< lReCompile >] ) - > lStatus
Arguments:
< cFileName > is the name of the file to compile. If this
argument is left blank, then all .PRG files which have a later
date stamp than the associated .OBJ file will be compiled.
< cCompOpt > is a string of compiler options. If no argument is
given, then the options established by DC_SETT('XPPOPT',< cOptions >),
SET XPPOPT TO < cOptions > or XPPOPT=< cOptions > (DCLIP.SYS)
are
used as the default.
< lQuiet > if .TRUE. will prevent displaying the status after
compiling. If .FALSE. (default), then all errors will be
displayed.
< lWindow > if .TRUE. (default) will display a window showing the
compiled results.
< lReCompile > if .TRUE. will force a recompile of
< cFileName >
regardless of the date/time of < cFileName >. If FALSE. (default),
then < cFileName > will be compiled only if it's date/time stamp
is later than the date/time stamp of it's associated. .OBJ file.
Description:
DC_COMPILE() compiles a specified .PRG file into an .OBJ file
or recompiles all .PRG files which have been modified and
have a later date/time stamp than their associated .OBJ file.
Use DC_COMPILE() after editing your source files. DC_COMPILE()
checks the date and time stamp on .PRG files and compares them
to the date and time on any corresponding .OBJ files. If the
date and/or time on a .PRG is later than the corresponding
.OBJ, the .PRG will be compiled with the /m option.
Notes:
If <þcFileNameþ> contains a full-path specification of a .PRG
file, then the compiled .OBJ will be created in the same
directory as the .PRG file unless the /o compiler switch is
used to direct the output.
If <þcFileNameþ> does not contain a full path then the .PRG file
must exist in the current directory or the directory
established by DC_SETT('PDIR',<þcPathþ>), SET PDIR TO
<þcPathþ>
or PDIR=<þcPathþ> (DCLIP.SYS).
If <þcFileNameþ> does not contain a full path or the /o compiler
switch is not used, then the compiled .OBJ will be created in
the directory established by DC_SETT('ODIR',<þcPathþ>), SET ODIR
TO <þcPathþ> or ODIR=<þcPathþ> (DCLIP.SYS).
Examples:
accept 'Enter a file to edit and compile' TO cFile
dc_editprg(cFile)
DC_COMPILE(cFile,'/n/m/w/l')
Source/Library:
_DCMAKE.PRG
See Also:
COMPILE
dc_objload()
dc_completeevents()
Process all events in the event queue
Syntax:
DC_CompleteEvents() - > nil
Arguments:
None.
Returns:
Nil
Description:
DC_CompleteEvents() is used to process all events in the event
queue. Use this function in processing loops when it is
necessary to react to window events to move the window or to
affect the processing.
Examples:
FUNCTION XTest()
LOCAL lContinue := .t.
oBusyDlg := DC_BusyOn( SetAppWindow(), ;
{||WaitDialog(@lContinue,@oStatus)} )
DO WHILE !Eof() .AND. lContinue
oStatus:setCaption('Processing Record ' + Alltrim(Str(n)))
SKIP
DC_CompleteEvents()
ENDDO
DC_BusyOff(oBusyDlg)
RETURN nil
* -------------------
STATIC FUNCTION WaitDialog( lContinue, oStatus )
LOCAL GetList[0], oBusyDlg, GetOptions
@ 0,0 DCSAY "Processing" FONT '20.Arial Bold' SAYSIZE 0
@ 2,0 DCSAY '' OBJECT oStatus COLOR GRA_CLR_BLUE FONT '12.Arial Bold' SIZE 30
@ 4,8 DCPUSHBUTTON CAPTION 'Cancel' ACTION {||lContinue := .F. } SIZE 9, 1.2
DCGETOPTIONS NOTITLEBAR HIDE
DCREAD GUI FIT EXIT PARENT @oBusyDlg OPTIONS GetOptions
RETURN oBusyDlg
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_clearevents()
dc_saveevents()
dc_restoreevents()
dc_configdialogbuttons()
Configure buttons in title bar area of dialog window
Syntax:
DC_ConfigDialogButtons( < oDlg >, ;
< nOption > ) - > nil
Arguments:
< oDlg > is the Dialog object to configure.
< nOption > is an option, defined in DCDIALOG.CH:
DLG_BUTTON_HELP_NOMINMAX
DLG_BUTTON_NONE
DLG_BUTTON_DISABLEMAX
Description:
DC_ConfigDialogButtons() is used to configure the buttons in
the titlebar area of a dialog window.
For example, the buttons can be configured to disable the
Maximize button in a child window.
Examples:
DCREAD GUI EVAL ;
{|o|DC_ConfigDialogButtons(o,DLG_BUTTON_DISABLEMAX)}
Source/Library:
DCLIPX.LIB, DCLIPX.DLL
dc_copynew()
Copy only new files to another directory
Syntax:
DC_CopyNew( [< cFromSpec >], ;
[< cToSpec >] ) - > lStatus
Arguments:
< cFromSpec > is the specification of the file(s) to copy from.
If this argument is not given, then a dialog will be displayed
prompting the user for the file specification.
< cToSpec > is the specification of the directory to copy to.
If this argument is not given, then a dialog will be displayed
prompting the user for the directory specification.
Returns:
A logical .TRUE. if any files were copied.
Description:
DC_CopyNew() is used to copy a file or set of files to another
directory only if they are newer than the sames files in the
destination directory.
A dialog window will display the status of all files copied.
Examples:
DC_CopyNew('*.TXT','C:\express\sample')
Source/Library:
_DCCOPYN.PRG, DCLIP1.DLL
See Also:
COPYNEW
dc_count()
Count records in selected database
Syntax:
DC_Count() - > lStatus
Arguments:
None.
Returns:
A logical .TRUE. if the count was not aborted.
Description:
DC_Count() is used to count records from the currently selected
database based on a set of conditions. As GUI dialog window
is displayed for the user to select the conditions.
Examples:
. USE COLLECT
. DC_Count()
Source/Library:
_DCSUM.PRG, DCLIP2.DLL
See Also:
COUNT
dc_create()
Create a new database
Syntax:
DC_Create( < cDataBase > ) - > lStatus
Arguments:
< cDataBase > is the name of the new database to create. If you
do not include an extension, then the default extension for the
currently selected database driver will be used.
Returns:
A logical .TRUE. if the database was successfully created.
Description:
DC_Create() is used to create a new database from a menu in which
the user is prompted for entering field names, types, lengths,
etc.
The currently selected default DBE is used when the new database
is created.
Examples:
. SET DBE TO FOXCDX
. DC_Create('JUNK')
Source/Library:
_DCFCSTR.PRG, DCLIP1.DLL
See Also:
CREATE
dc_crindex()
Create an index file
Syntax:
DC_CrIndex() - > lStatus
Arguments:
None.
Returns:
A logical .TRUE. if the index was created successfully, .FALSE.
otherwise.
Description:
DC_CRINDEX() is a high-level function that provides a
user-interface menu for creating a new index file.
Examples:
. USE COLLECT
. DC_CrIndex()
Source/Library:
_DCDBIND.PRG, DCLIP1.DLL
See Also:
INDEX ON
dc_crtrun()
Run a text-based procedure in a new CRT Window
Syntax:
DC_CrtRun( < bBlock >, ;
[< cTitle >], ;
[< cColorString >], ;
[< oParent >], ;
[< oOwner >], ;
[< lUnique >], ;
[< aOptions >], ;
[< lModal >], ;
[@< oCrt >], ;
[< lSuspend >], ;
[< lGui >] ) - > lStatus
Arguments:
< bBlock > is the code block to evaluate after the CRT window
is created or selected.
< cTitle > is the title to place into the title bar of the CRT
window.
< cColorString > is the color to clear the CRT window.
< oParent > is the parent of the CRT window. If this parameter is
not passed, then the parent will be AppDeskTop().
< oOwner > is the owner of the CRT window. If this argument is
not passed, then the owner is the parent.
< lUnique > if .TRUE. will create the CRT window and run the
code block only if there is not a window already running with the
same code block. The default is .FALSE.
< aOptions > is an array of display options:
Element Type Description
------- ---- -----------------------------------------------
[1] N Font Width (Default is 8)
[2] N Font Height (Default is 12)
[3] C Font Name (Default is Alaska Crt)
[4] N Window Icon (Default is DC_IconDefault())
[5] N Text Rows
[6] N Text Columns
< lModal > if .TRUE. will make the CRT window MODAL if it is not
a child window.
@< oCrt > is the name of a variable to store a pointer to the
Crt Window object that is created.
< lSuspend > is RESERVED.
< lGui > is used to set the DC_Gui() flag.
Returns:
A logical .TRUE. if the text procedure was executed successfully.
Description:
DC_CrtRun() is used to run a text-based procedure in a new
CRT Window.
The function DC_CrtRunWindow() is used to store a pointer to
any existing XbpCrt() class window to use. If this function
returns anything other than an XbpCrt() object, then a new
CRT window is created before the code block is evaluated and
then destroyed after returning from the code block.
Examples:
. DC_CrtRun( {||DC_ChrSel()}, 'ASCII Chart', 'N/W' )
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_crtrunwindow()
dc_crtwindow()
dc_qout()
dc_gui()
dc_crtrunwindow()
Set the CRT Window for DC_CrtRun()
Syntax:
DC_CrtRunWindow( [< oCrt >] ) - > oCrtWindow
Arguments:
< oCrt > is a pointer to an XbpCrt() class CRT window.
Returns:
A pointer to the previous CRT window.
Description:
DC_CrtRunWindow() is used to store a pointer to any existing
XbpCrt() class window to use later with DC_CrtRun(). If this
function returns anything other than an XbpCrt() object, then
DC_CrtRun() will create a new window before the code block is
evaluated and then destroyed after returning from the code
block.
Examples:
. oCrt := DC_CrtWindow()
. DC_CrtRunWindow(oCrt)
. DC_CrtRun( {||DC_ChrSel()}, 'ASCII Chart', 'N/W' )
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_crtrun()
dc_crtwindow()
dc_qout()
dc_crtwindow()
Create a Crt Window to be used later with DC_CrtRun()
Syntax:
DC_CrtWindow( [< cTitle >], ;
[< cColorString >] ) - > oCrtWindow
Arguments:
< cTitle > is the title to place into the title bar of the CRT
window.
< cColorString > is the color to clear the CRT window.
Returns:
A pointer to the newly created CRT Window (an XbpCrt object).
Description:
DC_CrtWindow() is used to create a CRT Window which will be
used later with DC_CrtRun().
The function DC_CrtRunWindow() is used to store a pointer to
any existing XbpCrt() class window to use. If this function
returns anything other than an XbpCrt() object, then a new
CRT window is created before the code block is evaluated and
then destroyed after returning from the code block.
Examples:
. oCrt := DC_CrtWindow()
. DC_CrtRunWindow(oCrt)
. DC_CrtRun( {||DC_ChrSel()}, 'ASCII Chart', 'N/W' )
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_crtrunwindow()
dc_qout()
dc_csv2workarea()
Import a CSV file to an open work area
Syntax:
DC_Csv2WorkArea() - > < lStatus >
Returns:
A logical .TRUE. if file was successfully imported, .FALSE. otherwise.
Description:
DC_Csv2WorkArea() loads a CSV file into a work area.
The top line of the CSV file must contain the field names that
match the work area.
Examples:
See the example in \exp19\samples\csv\csvimp2.prg.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_curpath()
Get the current dos directory
Syntax:
DC_CurPath ( [< cDrive >] ) - > cDirectory
Arguments:
< cDrive > is the drive to report the currently selected
directory. If no argument is given, then the currently selected
drive is the default.
Returns:
A character string representing the selected drive and directory.
Description:
DC_CURPATH() reports the currently selected DOS directory for
any specified drive.
Examples:
PROCEDURE XTest()
DC_Gui(.t.)
dc_chdir('C:\ALASKA\XPPW32')
DC_MsgBox( DC_CURPATH() )
dc_chdir('\EXPRESS\SAMPLE')
DC_MsgBox( DC_CURPATH('C:') )
RETURN
Source/Library:
_DCPATH.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_setdclip()
dc_setdefault()
dc_dataconvert()
Convert a database to a different DBE driver
Syntax:
DC_DataConvert( [< cFileName >], ;
[< cFromDBE >], ;
[< cToDBE >], ;
[< cExtension >] ) - > lStatus
Arguments:
< cFileName > is the name of the database to convert. If this
argument is not passed a GUI dialog window will be displayed to
enter information required. Enter ALL to convert all databases
with a specified extension.
< cFromDBE > is the DBE to use to open < cFileName >.
< cToDBE > is the DBE to use to create the converted file.
< cExtension > is the extension to use when using ALL as the
file name
Returns:
A logical .TRUE. if the conversion was successful.
Description:
DC_DataConvert() is used to convert a database to use another
DBE driver.
Examples:
// convert all files that have a .DBT memo file.
. DC_DataConvert('COLLECT','DBFNTX','FOXCDX','.DBT')
// convert all files that have a .DBF extension
. DC_DataConvert('ALL','DBFNTX','DBFCDX','.DBF')
Source/Library:
_DCRDD.PRG, DCLIP2.DLL
See Also:
DATACONVERT
dc_datarest()
Restore work areas
Syntax:
DC_DataRest( < aWorkArea > ) - > lStatus
Arguments:
< aWorkArea > is a multidimensional array created by the SAVE DATA
command or DC_DataSave() function.
Returns:
A logical .TRUE. if workareas were successfully restored.
Description:
DC_DATAREST(aWork) will reopen all databases, indexes and relations
from the array created by DC_DATASAVE(). This function is handy
when it is necessary to insure that database work areas are restored
to their original condition after calling a routine that may close
files, open files, select different indexes or clobber relations.
Examples:
. USE EXPRESS ALIAS XDOC VIA FOXCDX INDEX EXPRESS
. SET TAG TO COMMAND
. aWorkArea := DC_DataSave()
. CLOSE ALL
. DC_DataRest(aWorkArea)
Source/Library:
_DCRDD.PRG, DCLIP2.DLL
See Also:
dc_datasave()
dc_datasave()
Save info about all open workareas to an array
Syntax:
DC_DataSave() - > aWorkArea
Arguments:
None.
Returns:
A multidimensional array.
Description:
DC_DATASAVE() will store all work area info to an array.
DC_DATAREST(aWork) will reopen all databases, indexes and relations
from the array created by DC_DATASAVE(). This function is handy
when it is necessary to insure that database work areas are restored
to their original condition after calling a routine that may close
files, open files, select different indexes or clobber relations.
Examples:
. USE EXPRESS ALIAS XDOC VIA FOXCDX INDEX EXPRESS
. SET TAG TO COMMAND
. aWorkArea := DC_DataSave()
. CLOSE ALL
. DC_DataRest(aWorkArea)
Source/Library:
_DCRDD.PRG, DCLIP2.DLL
See Also:
dc_datarest()
dc_dbchcreate()
Create a database or array pick-list object
Syntax:
DC_DbChCreate ( < aOptions >, ;
< aColumns >, ;
[< aTags >], ;
[< aData >] ) - > aObject
Arguments:
< aOptions > is an array defining the pick-list window size,
color, function, and array data when browsing an array.
Element Type Description
------- ---- -----------------------------------------------
1 N Start display row
2 N Start display column
3 N End display row
4 N End display column
5 C Heading at top of window
6 C Menubar at top or bottom of window. The first
character in each word will be highlighted
or the first character after any tilde ~
character will be highlighted.
7 C A color string for the box and lines
8 C A color string for the data items
9 C A color string for the data select bar
10 C A color string for column headings
11 C A color string for the menu bar at the bottom
of the window. This is a two-color string
(separated by a comma). The first color is
the bar and words, the second is the highlight
color.
12 L If .TRUE. then "Auto-Seek" mode will be enabled.
Auto-Seek will cause the pick-list to
automatically seek to the item whose index key
matches the sequence of keys pressed.
13 C/N/D/L A value to include in a "One-To-Many" style
pick-list. The type of this value must match
the index key of the database. Only database
items that match this value will be included
in the display. This is provided for compatability
with previous versions. Parameters 19/20 are
recommended for one-to-many browses.
14 L If .TRUE. then a "Tagging" Column will be
displayed. All records or array elements which
have been tagged will contain a check mark. The
operator may tag/untag records with the SPACE bar
key, TAG records with the LEFT mouse key, or UNTAG
records with the RIGHT mouse key.
15 N The INKEY() value of the key to assign as the
Record Tagging key. The default is 32 (Space bar).
16 L If .FALSE. will display menu at bottom.
If .TRUE. will display menu at top (default).
17 N Starting array element to browse
18 N Subscript number of data array that is used for
holding tags. This is required if Tag Mode is
enabled and you are browsing an array rather than
a database. The tags must all be initialized to
a logical value.
19 C/D/N/L A value that defines the SCOPE TOP of the database
for one-to-many browses.
20 C/D/N/L A value that defines the SCOPE BOTTOM of the
database for one-to-many browses.
21 A An optional array of 10 elements. Each element
is a character string to display as the mouse
"prompt" message when the mouse is placed over
one of the 10 mouse buttons at the bottom of
the window. The 10 default messages are defined
in the _DCDBCHO.PRG source code.
Note: If color elements are not passed, then the system
default colors will be used.
< aColumns > is a multi-dimensional array that defines the
columns in the pick-list window. One sub-array is required
for each column in the window.
Element Type Description
------- ------- --------------------------------------
1 C Expression to evaluate
or B Code-Block to evaluate
or N Array sub-element number (array browse mode)
2 C Column title
3 N Column width. If 0, then column will
automatically size to expression output
width.
4 C Code Block to pass to SETCOLOR()
For example, this could be the name of a color
field in a database and would be passed as
follows: {||APPT_COLOR} .OR. {||'W+/B'}.
< aTags > is an optional array of record numbers which will
may be modified by the operator. If no valid array name is
passed and the Tag Mode option was enabled in < aOptions >
then the DCTAGS public array will be used for storing the
record tags. If browsing an array, then the tags are handled
by including a sub-element in the array being browsed.
< aData > is an optional multi-dimensional array to browse.
If any value other than an array is passed then the current
database workarea will be browsed. If tagging is enabled,
then one of the elements of each sub-array is used to hold
the logical tag value.
Returns:
A multi-dimensional array to be passed to DC_DBCHOICE() for
pick-list operations.
Description:
DC_DBCHCREATE() is used to create a database pick-list object
or an array pick-list object to be used with DC_DBCHOICE().
This function is used to create "fully-moused" database or
array pick-lists.
Examples:
-- Example 1 --
// Using DC_DBCHCREATE() / DC_DBCHOICE() as a main menu for
// help database
local aObject := ;
DC_DBCHCREATE( { 0, 0, MaxRow(), 79, ' Help Menu ',;
' Edit View Search Print' },;
{ { 'TYPE','Function Type', 15 } ,;
{ 'COMMAND','Command Syntax' },;
{ 'SHORT','Description' } } )
local nInkey, lPaintScrn := lExplode := .t.
do while .t.
select dchelp
aObject := ;
dc_dbchoice( aObject, @nInkey,, lPaintScrn, lExplode )
cCode := chr(nInkey)
store .f. TO lPaintScrn, lExplode
do case
case nInkey=27
exit
case nInkey <= -101
dc_mousekey( { {MaxRow(),0,MaxRow(),9,'E'},;
{MaxRow(),11,MaxRow(),20,'V'},;
{MaxRow(),22,MaxRow(),29,'S'},;
{MaxRow(),31,MaxRow(),37,'P'} } )
case cCode='E'
do editmenu
case cCode='V'
do viewmenu
case cCode='S'
do searchmenu
case cCode='P'
do printmenu
endcase
enddo
-- Example 2 --
// Using DC_DBCHCREATE() / DC_DBCHOICE() to pick a printer
// record.
local nInkey
local aObject := ;
DC_DBCHCREATE( { 2,15,MAXROW()-1, 65, 'Select a Printer' } ,;
{ {'PTR_DESC','Description'} ,;
{'STR(RECNO(),6)','Number' } } )
DC_DBCHOICE( aObject, @nInkey )
IF nInkey = K_ENTER
RETURN RECNO()
ELSE
RETURN 0
ENDIF
-- Example 3 --
// Using DC_DBCHCREATE() / DC_DBCHOICE() to create a
// directory pick-list with an array for tagging files.
local aObject, aDirectory := Directory('*.*'), nInkey, nChoice
local i
for i := 1 TO len(aDirectory)
aadd( aDirectory[i], .f. ) // add element for tag
next
aObject := ;
DC_DBCHCREATE( {2,7,20,73, ' Tag file(s) ',,,,,,,,,.t.,,.t.,,6},;
{ { 1,'Name',12 } ,;
{ 2,'Size',10 } ,;
{ 3,'Date',8 } ,;
{ 4,'Time',8 } ,;
{ 5,'Attr',5 } } ,, aDirectory )
aObject := DC_DBCHOICE( aObject, @nInkey,, .f., .f. )
for i := 1 to len(aDirectory)
if aDirectory[i,6] // tagged element
if dc_msgbox(,,{aDirectory[i,1],'Delete File?'},,,,.t.)
Ferase( aDirectory[i,1] )
endif
endif
next
Source/Library:
_DCDBCHOI.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_dbchoice()
dc_readdpick()
dc_dbchoice()
A browse-style, moused, database/array pick-list
Syntax:
DC_DbChoice ( < aObject >, ;
@< nInkey >, ;
[< cUdfName >], ;
[< lPaintItems >], ;
[< lPaintWindow >], ;
[< lExit >], ;
[< nStartRow >], ;
[< aTags >] ) - > aObject
Arguments:
< aObject > is an array of window and field information created
by DC_DBCHCREATE().
@< nInkey > is a memory variable (passed by reference) to store
the value of the key hit or mouse-event used to exit the
pick-list.
< cUdfName > is a User defined function to call between
keystrokes.
< lPaintItems > if .TRUE. will repaint all items in the display.
< lPaintWindow > if .TRUE. will repaint the entire display window
and all items.
< lExit > if .TRUE. will exit after painting the window and/or
items. If .FALSE. then DC_DBCHOICE() will exit only if a key is
hit that is a non-navigation key.
< nStartRow > is the display row to place the select bar.
< aTags > is an optional array of record numbers which will
may be modified by the operator. If no valid array name is
passed and the Tag Mode option was enabled in the < aObject >
then the DCTAGS public array will be used for storing the
record tags.
Description:
DC_DBCHOICE() is a database pick-list function that supports
one-to-many style picklists, Auto-seeking operation, record
tagging, and mouse.
DC_DBCHOICE() is used with an array object created by
DC_DBCHCREATE().
Examples:
-- Example 1 --
// Using DC_DBCHCREATE() / DC_DBCHOICE() as a main menu for
// help database
local aObject := ;
dc_dbchcreate( { 0, 0, MaxRow(), 79, ' Help Menu ',;
' Edit View Search Print' },;
{ { 'TYPE','Function Type' } ,;
{ 'COMMAND','Command Syntax' },;
{ 'SHORT','Description' } } )
local nInkey, lPaintScrn := lExplode := .t.
do while .t.
select dchelp
aObject := ;
DC_DBCHOICE( aObject, @nInkey,, lPaintScrn, lExplode )
cCode := chr(nInkey)
store .f. TO lPaintScrn, lExplode
do case
case nInkey=27
exit
case nInkey <= -101
dc_mousekey( { {MaxRow(),0,MaxRow(),9,'E'},;
{MaxRow(),11,MaxRow(),20,'V'},;
{MaxRow(),22,MaxRow(),29,'S'},;
{MaxRow(),31,MaxRow(),37,'P'} } )
case cCode='E'
do editmenu
case cCode='V'
do viewmenu
case cCode='S'
do searchmenu
case cCode='P'
do printmenu
endcase
enddo
-- Example 2 --
// Using DC_DBCHCREATE() / DC_DBCHOICE() to pick a printer
// record.
local nInkey
local aObject := ;
DC_DBCHCREATE( { 2,15,MAXROW()-1, 65, 'Select a Printer' } ,;
{ {'PTR_DESC','Description'} ,;
{'STR(RECNO(),6)','Number' } } )
DC_DBCHOICE( aObject, @nInkey )
IF nInkey = K_ENTER
RETURN RECNO()
ELSE
RETURN 0
ENDIF
Source/Library:
_DCDBCHO.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_dbchcreate()
dc_dbcontinue()
Continue Locating a record in a set of Scoped Records
Syntax:
DC_DbLocate( < bForCondition >, ;
[< bWhileCondition >], ;
[< nCount >], ;
[< xRecordID >], ;
[< lRest >] ) -- > lFound
Arguments:
< bForCondition > is a code block which contains the search
condition as a logical expression. The record pointer is moved
to the next data record until < bForCondition > provides the
value .T. (true) or until the end of the file is reached.
< bWhileCondition > is an optional code block containing a
condition as a logical expression. As long as this code block
provides the value .T. (true), the search continues. The
operation terminates as soon as < bWhileCondition > returns .F.
(false).
The optional argument < nCount > specifies the number of records
searched beginning with the current record.
< xRecordID > is a record ID (for DBF files it is the record
number) which can be optionally specified. If specified, only
this record is searched.
The optional logical value < lRest > specifies whether all data
records of a work area are searched (< lRest >==.F. ), or only
the records from the current to the last record (< lRest >==.T. ).
The default value is .F. (false), meaning all data records are
searched.
Returns:
A logical value.
Description:
The function DC_DbLocate() defines a search condition for each
work area that is the subject of a sequential search for matching
records in that work area. The search is also initiated by
DC_DbLocate() and continued using DC_DbContinue(). In this way
all records in a work area matching a search condition can be
found.
The function DC_DbContinue() moves the record pointer in the
work area until a matching record is found. The matching record
becomes the current record and DbContinue() returns the
value.T. (true). The function Found() can also be used to test
the result of a DbContinue(). If no matching record is found,
the return value is .F. (false) and the record pointer is
positioned after the last record. In this case, the function
Eof() returns the value .T. (true).
Notes:
DC_DbLocate() can be used as a direct replacement for dbLocate()
because all the parameters are simply passed on to dbLocate()
if no scope is set.
Examples:
. USE EXPRESS VIA FOXCDX INDEX EXPRESS
. SET SCOPE TOP TO 'DC_F'
. SET SCOPE BOTTOM TO 'DC_H'
. ? DC_DbLocate({||syntax$'DC_G'})
.T.
. ? DC_DbContinue()
.T.
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_setscope()
CONTINUE
dc_dblocate()
dc_dbcreate()
Create a database from structure in parallel-array format
Syntax:
DC_DbCreate( < cFileName >, ;
< aFields >, ;
< aTypes >, ;
< aLengths >, ;
< aDecimals >, ;
[< cDbe >] ) - > lStatus
Arguments:
< cFileName > is the name of the database to create.
< aFields > is an array of field names. Each must be a character
value of no more than 10 characters and must start with an
Alphabet character.
< aTypes > is a parallel array of field types. Each must be a
character value with a length of 1. Valid Types are:
"C" - Character
"D" - Date
"L" - Logical
"N" - Numeric
"M" - Memo
< aLengths > is a parallel array of field lengths. Each must be
a numeric value.
< aDecimals > is a parallel array of field decimals. Each must
be a numeric value.
< cDbe > is the name of the DBE to use to create the database.
If no parameter is passed, then the default DBE will be used.
Returns:
.TRUE. if database is successfully created, .FALSE. otherwise.
Description:
DC_DBCREATE() will create a .DBF style database from a set of
parallel arrays. This function is provided in lieu of the
Xbase++ DBCREATE() function which builds a database from a
ragged array. Sometimes it is more convenient to provide the
data in four "parallel" arrays or four "sub" arrays that in
"ragged" format.
Examples:
DC_DBCREATE( "CUSTOMER.DBF",;
{ "CUST_NAME","CUST_NMBR", "BALANCE" },;
{ "C", "C", "N" },;
{ 25, 5, 9 },;
{ 0, 0, 2 } )
Source/Library:
_DCAREA.PRG, DCLIP1.DLL
See Also:
dc_dbstruct()
dc_dbedit()
A Dual-Mode replacement for DBEDIT()
Syntax:
DC_DbEdit ( [< nTop >], ;
[< nLeft >], ;
[< nBottom >], ;
[< nRight >], ;
[< aColumns >], ;
[< cUserFunc > | < bUserFunc >], ;
[< acPicture >], ;
[< acHeading >], ;
[< acHeadSep >], ;
[< acColSep >], ;
[< acFootSep >], ;
[< acFooting >] ) - > nil
Arguments:
< nTop >, < nLeft >, < nBottom >, < nRight >
are the screen
text-based coordinates.
< cUserFunc > | < bUserFunc > is the name of an optional
User-Defined
function to call on exception keystrokes. See the Xbase++
documentation of ACHOICE() for more information on how to use
a UDF. If the parameter is passed as a character string then
the function must be a PUBLIC, not STATIC function.
< aColumns > is an array whose elements may contain only
character strings. The character strings contain field names
or expressions which can be macro expanded to determine the
value displayed in each column. DbEdit() displays a column
on screen for each element in < aColumns >. If < aColumns > is
missing, all fields of the work area are displayed.
< acPicture > contains either a parallel array with PICTURE
formats for formatting values in each individual column or a
character string containing a PICTURE format for all columns.
< acHeading > contains either a parallel array of character
strings specifying the column headings for each individual
column or a character string to be used as the heading for
all columns. Multiple row column headings are created when a
character string contains a semicolon. Where the semicolon
appears, the column heading is wrapped. When < acHeading > is
not included, the column headings are created from the
elements of < aColumns > . If < aColumns > is also missing,
the
field names in the work area are displayed as column headings.
< acHeadSep > contains either a parallel array of heading
separators to appear between the heading and data area for
each individual column, or a character expression which
defines the heading separator for all columns. Chr(205) is
used as the default character and displays a double line.
< acColSep > contains either a parallel array of characters used
to create a separator between each column or a character
expression defining the heading separator for all columns.
Chr(179) is used as the default character displays a single
line.
< acFootSep > contains either a parallel array of footing
separators to appear between the data area and footer line
for each individual column or a character expression defining
the footer separator for all columns. If < acFootSep > is missing,
no footing separators are displayed.
< acFooting > contains either a parallel array of character
strings specifying the footer lines for each individual column
or a character string specifying the footer line for all
columns. Multiple footer lines are created when a character
string contains a semicolon. Where this semicolon appears,
the footer line is wrapped. When < acFooting > is not included,
no footer lines are displayed.
Description:
DC_DBEDIT() is a Dual-mode replacement for Dbedit(). When
the GUI flag is ON, DC_DBEDIT() functions similiar to
DbEdit() except that it is displayed in GUI mode. When the
GUI flag is OFF, DC_DBEDIT() functions identical to DbEdit()
except it is also activated by a mouse. The left button of the
mouse is used to select the item in the window. The right button
or double-clicking works identical to the ENTER key.
Examples:
PROCEDURE XTest()
DC_Gui(.t.)
USE collect NEW SHARED
DC_DBEDIT( 5,10,20,75,,{||MyFunc()} )
RETURN
STATIC FUNCTION myfunc
do case
case lastkey() = asc('C')
DC_MsgBox('C button pressed')
case lastkey() = asc('D')
DC_MsgBox('D button pressed')
case lastkey() = asc('M')
DC_MsgBox('M button pressed')
endcase
return nil
Source/Library:
_DCDBED.PRG/.OBJ, DCLIPX.LIB
dc_dbeval()
Evaluate set of expression for a database with active Escape
Syntax:
DC_DbEval ( < bBlock >, ;
[< bForCondition >], ;
[< bWhileCondition >], ;
[< nCount >], ;
[< xRecordID >], ;
[< lRest >], ;
[< lAutoLock >], ;
[< lEscapeKey >] ) - > NIL
Arguments:
< bBlock > contains a code block which is executed for each data
record.
< bForCondition > is an optional code block containing a condition
as a logical expression. < bBlock > is only executed for the data
records where < bForCondition > returns the value .T. (true).
< bWhileCondition > is an optional code block containing a condition
as a logical expression. DbEval() terminates as soon as
< bWhileCondition > returns the value .F. (false).
The optional argument < nCount > specifies the number of records
for which < bBlock > is evaluated beginning with the current data
record.
The optional argument < xRecordID > specifies a record ID (for
DBF files it is the record number). If < xRecordID > is specified,
the evaluation of < bBlock > begins with the specified record.
The logical value < lRest > optionally specifies whether
< bBlock >
is evaluated for all records of a work area (< lRest >==.F. ),
or only for the records from the current to the last record
(< lRest >==.T. ). The default value is .F. (false), indicating
that < bBlock > is evaluated for all data records.
< lAutoLock > if .TRUE. will lock the record before evaluating
< bBlock >. The default is .FALSE.
< lEscapeKey > if .TRUE. will terminate the operation if the
user presses the ESCape key.
Returns:
NIL.
Description:
The database function DC_DbEval() evaluates a code block and
increments the record pointer of a work area after each execution
of the code block. When the function is used without the alias
operator, it moves the record pointer in the current work area.
By default, DC_DbEval() begins with the first logical record
and evaluates the code block <þbBlockþ> for each record until the
last logical record is reached. The number of records for which
the code block is evaluated can be influenced by the optional
arguments and the setting of the TOP/BOTTOM scope by the
DC_SetScope() function.
By specifying code blocks for <þbForConditionþ> or
<þbWhileConditionþ>,
a logical condition can be defined which must return the value
.T. (true) for the code block <þbBlockþ> to be evaluated. The
<þbForConditionþ> code block is evaluated for all data records.
When it returns .T. (true), <þbBlockþ> is executed. When
<þbWhileConditionþ> is specified, <þbBlockþ> is only executed
until
<þbWhileConditionþ> returns .F. (false), causing DbEval() to
terminate.
Alternatively the number of records can be explicitly determined
with <þnCountþ> or <þlRestþ> . Specifying <þxRecordIDþ>
positions the
record pointer on this record and the code block <þbBlockþ> is
evaluated for this and following records.
DC_DbEval() passes no arguments to the code blocks.
Examples:
#command CLEAN ;
[FOR <for>] ;
[WHILE <while>] ;
[<autolock:AUTOLOCK>] ;
[<escapekey:ESCAPEKEY>]
=> ;
DC_DBEVAL( {||clean()}, <{for}>, <{while}>,,, ;
<.autolock.>,<.escapekey.> )
DC_SetScope(0,'SMITH')
DC_SetScope(1,'ROGERS')
CLEAN FOR SHIP_DATE < DATE() AUTOLOCK ESCAPEKEY
Source/Library:
_DCEVAL.PRG/.OBJ, DCLIPX.LIB
dc_dbfile()
Open a database file in a work area
Syntax:
DC_DbFile( [< cDirectory >], ;
< cDataFile >, ;
[< lUserPrompt >], ;
[< lExclusive >], ;
[< nWait >], ;
[< cDbe >], ;
[< lReOpen >], ;
[< aStructure >], ;
[< cAlias >], ;
[< lNoErrorDisp >], ;
[< lCreateDbf >], ;
[@< lStruUpdated >], ;
[< lStruMessage >] ) - > lStatus
Arguments:
< cDirectory > is the directory to search for the database file.
If no argument is given or a null ("") argument is passed, then
the current default directory (SET DEFAULT) will be search,
followed by the current path directory (SET PATH).
< cDataFile > is the name of the database to open. If the file
extension is not included, then the default extension for the
designated DBE is used.
< lUserPrompt > will pop-up a menu to prompt the user if the file
cannot be found.
If < lExclusive > is .TRUE., the file will be opened in
EXCLUSIVE, mode, if .FALSE. it will be opened in SHARED mode.
If no argument is given the file will be opened in the default
system mode.
< nWait > is the number of seconds to wait if a SHARED file
cannot be opened until the user is notified of the error. ( 0
- wait forever ).
< cDbe > is the Database Driver to use. If no argument is given,
then the currently selected DBE will be used.
< lReOpen > if .TRUE. will reopen the file in the current work
area even if it is already opened in another work area.
< aStructure > multi-dimensional array that contains the
structure of the data base. This array is only required in
the event that the database could not be found or if you
want to update any existing database to the new structure.
A new database will be created from the information in the
array. If a code block is passed instead of an array, then it
will be evaluated. The code block must return an array of the
same structure as < aStructure >. If a fifth element is included
in each sub-array, then a single-record will be appended to
the newly created database with the default information in
element 5.
Element Type Length Description
------- ---- ------ ----------------------------
[1] C 1 Field Name
[2] C 1 Field Type (C,D,N,L,M)
[3] N 4 Field Length
[4] N 2 Field Decimals
[5] Any Any Field Default value. Must be
same type as Field Type.
< cAlias > is the alias to assign to the work area. If no
argument is given, then the name of the database (less the
extension) will be used as the alias.
< lNoErrorDisp > if .TRUE. will suppress any error window output
in the event that the file cannot be opened. If .FALSE.
(default) then errors will be displayed.
< lCreateDbf > if .TRUE. (default) will create the database
from the contents of < aStructure > if the database does not
exist, otherwise if .FALSE., the database will not be
created.
@< lStruUpdated > is a logical variable (passed by reference).
If the database structure was updated, this variable will be
set to .TRUE., otherwise it will be set to .FALSE.
< lStruMessage > if .TRUE. will prompt the user before updating
the structure. IF .FALSE. the structure will be updated with
no prompt.
Returns:
Logical .TRUE. if the file is opened, .FALSE. otherwise.
Description:
DC_DBFILE() is used to open a database file in a manner that
will prevent runtime errors. If the file can't be found, the
user will be prompted to enter a directory path to search, or
to abort.
If a structure array is passed then the behavior of DC_DBFILE()
is as follows:
1. If the database is not found in the specified or default
directory, it will be created from the contents of the
array.
2. If the database is opened but any of the fields do not
match the structure of the passed array, then the
database structure will be updated to the array structure
and the old data will be retained.
Examples:
local aStructure := ;
{{'DBF_NAME','C',8,0},;
{'DESC','C',30,0},
{'QUERY','C',1000,0}}
if !DC_DBFILE( DC_SETDCLIP(),'DCQUERY.DBF',.t.,,,'DBFNTX',,;
aStructure)
return .F.
endif
Source/Library:
_DCDBFIL.PRG, DCLIP1.DLL
See Also:
dc_usearea()
USE
dc_dbfile2record()
Copy a file to a record object.
Syntax:
DC_DbFile2Record( < cFileName > ) - > oRecord
Arguments:
< cFileName > is the full path name of the file.
Returns:
A record object.
Description:
DC_DbFile2Record() is used to create a record object from a
file that was saved by DC_DbRecord2File().
Notes:
A work area must be opened and the structure of the database in
the work area must be the same as the structure of the database
record that was saved.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_dbrecord()
dc_dbrecord2file()
dc_dbfname()
Get the full path database name of an open work area
Syntax:
DC_DbfName ( [< nArea >] ) - > cDbfFileName
Arguments:
< nArea > is the work area. If no argument is given, then the
current selected work area is default.
Returns:
A character string.
Description:
DC_DBFNAME() returns the full file name of the database file
for any work area.
Examples:
. select 2
. use C:\DCLIP3\DCPRINT
. select 4
. use F:\CUSTOMER\INVOICE
. ? DC_DBFNAME(2)
C:\DCLIP3\DCPRINT.DBF
. ? DC_DBFNAME(4)
F:\CUSTOMER\INVOICE.DBF
Source/Library:
_DCAREA.PRG, DCLIP1.DLL
See Also:
dc_dbfile()
dc_usearea()
USE
dc_dbfsel()
Select a database from a picklist of open files
Syntax:
DC_DbfSel() - > nWorkArea
Arguments:
None.
Returns:
The numeric value of the work area selected.
Description:
DC_DBFSEL() will pop-up a picklist of all work areas and
display the alias and database file name open in each work
area. It will also allow the user to select an unused work
area to open a new database.
Examples:
. DC_DbfSel()
Source/Library:
_DCDBFIL.PRG, DCLIP1.DLL
dc_dbgather()
Gather data from a Record Object to the current data record
Syntax:
DC_DbGather( < oRecord >, ;
[< lNew >], ;
[< lCommit >], ;
[< bLock >], ;
[< cRecNoField > ) - > < lStatus >
Arguments:
< oRecord > is a record object.
< lNew > if .TRUE. will append a new record. The default is .FALSE.
< lCommit > if .TRUE. will dbCommit() the change to disk. The
default is .FALSE.
< bLock > is an optional code block which is called to determine
how a new record is added. The default is to append a new record
to the database. < bLock > can be used to override the default
behavior. This can be used to reuse deleted or blank records
instead of always appending a new record.
< cRecNoField > isTthe name of a numeric field that contains the
current record number. It will be updated with the RecNo().
This is handy when a record number field is required in SQL
queries and it needs to be maintained.
Returns:
An array.
Description:
DC_DbGather() is used to gather the data in the iVars of a
record object into the current record of the currently used
database, or to create a new record.
Examples:
FUNCTION XTest()
LOCAL oRecord
USE COLLECT
oRecord := COLLECT->(DC_DbRecord():new())
COLLECT->(DC_DbScatter(oRecord))
@ 1,1 DCSAY 'Description' GET oRecord:descript
@ 2,1 DCSAY 'Type' GET oRecord:type
@ 3,1 DCSAY 'Sub-Type' GET oRecord:subtype
DCREAD GUI
COLLECT->(DC_DbGather(oRecord))
RETURN nil
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_dbrecord()
dc_dbscatter()
dc_dbgatherlog()
dc_dbgatherlock()
Get-Set function to set default lock behavior for DC_DbGather()
Syntax:
DC_DbGatherLock( [< bLock >] - > bOldLock
Arguments:
< bLock > is an optional code block which is called to determine
how a new record is added. The default is to append a new record
to the database. < bLock > can be used to override the default
behavior. This can be used to reuse deleted or blank records
instead of always appending a new record.
Returns:
A code block or a NIL.
Description:
DC_DbGatherLock() is a Get-Set function that is used to post a
code block which is read by DC_DbGather(). This is the default
value for the <þbLockþ> parameter that is passed to DC_DbGather().
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_dbrecord()
dc_dbgather()
dc_dbgatherlog()
Establish logging data for dc_dbgather()
Syntax:
DC_DbGatherLog( < aParams > ) - > < aParams >
Arguments:
< aParams > is an array of 6 elements.
Element Type Description
------- ---- --------------------------------------------------------
[1] C The name of the logging database Default is 'DATALOG.DBF'
[2] C The alias of the logging database. Default is 'DATALOG'
[3] C The DBE of the logging database. Defaultis dbeSetDefault().
[4] A An array of database aliases to exclude or include from
logging.
This may be a single dimensional array of only aliases (for
logging if any field changed) or a multi dimensional array
of aliases and field names (for logging if only one or more of
specified fields changed).
[5] B A code block to evaluate. This code block must return a
character string to store in the "LOGIN" field of the
logging file.
[6] L Array (element 4) is list of included aliases, otherwise it
is a list of excluded databases. Default is .FALSE.
Returns:
An array.
Description:
DC_DbGatherLog() is used to establish the name, alias and dbe of the
log file when wishing to log all DC_DbGather() transactions.
DC_DbGatherLogBrowse() will browse the log file and display 2
windows that are used to show the contents of the record before and
after the write operation.
Examples:
Look at the sample program in \exp19\samples\dbrecord\logging.prg.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_dbgather()
dc_dbrecord()
dc_dbscatter()
dc_dbgatherlogbrowse()
Browse the dc_dbgatherlog() database
Syntax:
DC_DbGatherLogBrowse() - > nil
Arguments:
None.
Returns:
Nil
Description:
DC_DbGatherLogBrowse() will browse the log file and display 2
windows that are used to show the contents of the record before and
after the write operation.
Examples:
See the sample program in \exp19\samples\dbrecord.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_dbgatherlog()
dc_dbgather()
dc_dbrecord()
dc_dbscatter()
dc_dbgobottom()
Go to the Bottom of a set of Scoped Records
Syntax:
DC_DbGoBottom () - > nil
Arguments:
None.
Returns:
Nil.
Description:
DC_DBGOBOTTOM() is used to go to the first record in a group of
"scoped" records. Scopes are set via the DC_SetScope() function.
If a scope is not set or the ADSDBE is being used as the data
driver for the current workarea, then DC_DBGOBOTTOM() simply
calls dbGoBottom() therefore it can be used as a replacement
for dbGoBottom().
Notes:
Examples:
#include 'dcdialog.ch'
#include 'appevent.ch'
PROCEDURE XTest()
LOCAL GetList := {}, oBrowse, aPres, cScopeTop, cScopeBot
USE ..\XDOC\EXPRESS INDEX ..\XDOC\EXPRESS.CDX ;
VIA FOXCDX ALIAS XDOC
OrdSetFocus('COMMAND')
DC_KeyStat(.t.)
@ 3,1 DCBROWSE oBrowse ALIAS 'XDOC' ;
SIZE 77,11.8 ;
FREEZELEFT {1}
DCBROWSECOL FIELD XDOC->command ;
HEADER "Command" PARENT oBrowse
DCBROWSECOL FIELD XDOC->type ;
HEADER "Type" PARENT oBrowse
DCBROWSECOL FIELD XDOC->short ;
HEADER "Short Description" PARENT oBrowse
DCBROWSECOL FIELD XDOC->module ;
HEADER "Module" PARENT oBrowse ;
DCBROWSECOL FIELD XDOC->category ;
HEADER "Category" PARENT oBrowse
DCBROWSECOL FIELD XDOC->see_also ;
HEADER "See Also" PARENT oBrowse
DCREAD GUI ;
FIT ;
ADDBUTTONS ;
TITLE 'Browse Scoping Demo' ;
EVAL {||_SetNavBlocks(oBrowse),;
DC_SetScope(0,'DC_G'),;
DC_SetScope(1,'DC_K'),;
DC_DbGoTop(),;
oBrowse:RefreshAll() }
RETURN
/* -------------------- */
STATIC PROCEDURE _SetNavBlocks( oBrowse )
oBrowse:skipBlock := {|n| DC_DbSkip(n) }
oBrowse:goTopBlock := {| | DC_DBGoTop() }
oBrowse:goBottomBlock := {| | DC_DBGOBOTTOM() }
oBrowse:phyPosBlock := {| | Recno() }
oBrowse:posBlock := {| | DC_KeyNo() }
oBrowse:lastPosBlock := {| | DC_KeyCount() }
oBrowse:firstPosBlock := {| | 1 }
RETURN
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_setscope()
dc_dbgoposition()
Moves the record pointer to a percent position in a work area
Syntax:
DC_DbGoPosition( < nPercent > ) - > nil
Arguments:
< nPercent > is a numeric value in the range between 0 and 100.
Zero is equivalent to the first record and 100 indicates the
last record in a work area.
Returns:
NIL
Description:
DC_DBGOPOSITION() is a replacement (wrapper) for the Xbase++
function dbGoPosition(). This corrects a problem in
dbGoPosition() in which the record pointer can be moved to a
deleted or filtered record thereby causing deleted or filtered
records to appear in a browse when the vertical scroll thumb
is used.
Notes:
Examples:
#include 'dcdialog.ch'
#include 'appevent.ch'
PROCEDURE XTest()
LOCAL GetList := {}, oBrowse, aPres
USE ..\XDOC\EXPRESS INDEX ..\XDOC\EXPRESS.CDX ;
VIA FOXCDX ALIAS XDOC
OrdSetFocus('COMMAND')
@ 3,1 DCBROWSE oBrowse ALIAS 'XDOC' ;
SIZE 77,11.8 ;
FREEZELEFT {1}
DCBROWSECOL FIELD XDOC->command ;
HEADER "Command" PARENT oBrowse
DCBROWSECOL FIELD XDOC->type ;
HEADER "Type" PARENT oBrowse
DCBROWSECOL FIELD XDOC->short ;
HEADER "Short Description" PARENT oBrowse
DCBROWSECOL FIELD XDOC->module ;
HEADER "Module" PARENT oBrowse ;
DCBROWSECOL FIELD XDOC->category ;
HEADER "Category" PARENT oBrowse
DCBROWSECOL FIELD XDOC->see_also ;
HEADER "See Also" PARENT oBrowse
DCREAD GUI ;
FIT ;
ADDBUTTONS ;
EVAL {||_SetNavBlocks(oBrowse),;
DC_DbGoTop(),;
oBrowse:RefreshAll() }
RETURN
/* -------------------- */
STATIC PROCEDURE _SetNavBlocks( oBrowse )
oXbp:firstPosBlock := {| | 1 }
oXbp:lastPosBlock := {| | 100 }
oXbp:PosBlock := {| |DC_DbPosition() }
oXbp:GoPosBlock := {|n|DC_DbGoPosition(n)}
oXbp:skipBlock := {|n|DC_DbSkipper(n) }
oXbp:goTopBlock := {| |DC_DbGoTop() }
oXbp:goBottomBlock := {| |DC_DbGoBottom() }
oXbp:phyPosBlock := {| |Recno() }
RETURN
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
dc_dbgotop()
Go to the Top of a set of Scoped Records
Syntax:
DC_DbGoTop () - > nil
Arguments:
None.
Returns:
Nil.
Description:
DC_DBGOTOP() is used to go to the first record in a group of
"scoped" records. Scopes are set via the DC_SetScope() function.
If a scope is not set or the ADSDBE is the data driver in the
current workarea, then DC_DBGOTOP() simply calls dbGoTop()
therefore it can be used as a replacement for dbGoTop().
Notes:
Examples:
#include 'dcdialog.ch'
#include 'appevent.ch'
PROCEDURE XTest()
LOCAL GetList := {}, oBrowse, aPres, cScopeTop, cScopeBot
USE ..\XDOC\EXPRESS INDEX ..\XDOC\EXPRESS.CDX ;
VIA FOXCDX ALIAS XDOC
OrdSetFocus('COMMAND')
DC_KeyStat(.t.)
@ 3,1 DCBROWSE oBrowse ALIAS 'XDOC' ;
SIZE 77,11.8 ;
FREEZELEFT {1}
DCBROWSECOL FIELD XDOC->command ;
HEADER "Command" PARENT oBrowse
DCBROWSECOL FIELD XDOC->type ;
HEADER "Type" PARENT oBrowse
DCBROWSECOL FIELD XDOC->short ;
HEADER "Short Description" PARENT oBrowse
DCBROWSECOL FIELD XDOC->module ;
HEADER "Module" PARENT oBrowse ;
DCBROWSECOL FIELD XDOC->category ;
HEADER "Category" PARENT oBrowse
DCBROWSECOL FIELD XDOC->see_also ;
HEADER "See Also" PARENT oBrowse
DCREAD GUI ;
FIT ;
ADDBUTTONS ;
TITLE 'Browse Scoping Demo' ;
EVAL {||_SetNavBlocks(oBrowse),;
DC_SetScope(0,'DC_G'),;
DC_SetScope(1,'DC_K'),;
DC_DbGoTop(),;
oBrowse:RefreshAll() }
RETURN
/* -------------------- */
STATIC PROCEDURE _SetNavBlocks( oBrowse )
oBrowse:skipBlock := {|n| DC_DbSkip(n) }
oBrowse:goTopBlock := {| | DC_DBGOTOP() }
oBrowse:goBottomBlock := {| | DC_DbGoBottom() }
oBrowse:phyPosBlock := {| | Recno() }
oBrowse:posBlock := {| | DC_KeyNo() }
oBrowse:lastPosBlock := {| | DC_KeyCount() }
oBrowse:firstPosBlock := {| | 1 }
RETURN
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_setscope()
dc_dblocate()
Locate a record in a set of Scoped Records
Syntax:
DC_DbLocate( < bForCondition >, ;
[< bWhileCondition >], ;
[< nCount >], ;
[< xRecordID >], ;
[< lRest >] ) -- > lFound
Arguments:
< bForCondition > is a code block which contains the search
condition as a logical expression. The record pointer is moved
to the next data record until < bForCondition > provides the
value .T. (true) or until the end of the file is reached.
< bWhileCondition > is an optional code block containing a
condition as a logical expression. As long as this code block
provides the value .T. (true), the search continues. The
operation terminates as soon as < bWhileCondition > returns .F.
(false).
The optional argument < nCount > specifies the number of records
searched beginning with the current record.
< xRecordID > is a record ID (for DBF files it is the record
number) which can be optionally specified. If specified, only
this record is searched.
The optional logical value < lRest > specifies whether all data
records of a work area are searched (< lRest >==.F. ), or only
the records from the current to the last record (< lRest >==.T. ).
The default value is .F. (false), meaning all data records are
searched.
Returns:
A logical value.
Description:
DC_DBLOCATE() is used to LOCATE a record in a group of "scoped"
records. Scopes are set via the DC_SetScope() function. This
functions identical to the Xbase++ dbLocate() function except
the locate is accomplished only within the set of scoped
records. If no scope is set, then the parameters are passed
on to dbLocate().
Notes:
DC_DbLocate() can be used as a direct replacement for dbLocate()
because all the parameters are simply passed on to dbLocate()
if no scope is set.
Examples:
. USE EXPRESS VIA FOXCDX INDEX EXPRESS
. SET SCOPE TOP TO 'DC_F'
. SET SCOPE BOTTOM TO 'DC_H'
. ? DC_DbLocate({||syntax$'DC_G'})
.T.
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_setscope()
dc_dbcontinue()
dc_dbrecord2file()
Copy a record object to a file
Syntax:
DC_DbRecordCompare( < oRecord1 >, < oRecord2 > ) - >
lStatus
Arguments:
< oRecord > is an object created by DC_DbRecord().
Returns:
A TRUE if the contents of the record objects are exactly equal,
otherwise FALSE.
Description:
DC_DbRecord2File() is used to copy a record object that was
created by DC_DbRecord() to a file.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_dbrecord()
dc_dbfile2record()
dc_dbrecordclone()
Clone a Database Record Object
Syntax:
DC_DbRecordClone(oRecord) - > < oNewRecord >
Arguments:
< oRecord > is a record object created by DC_DbRecord().
Returns:
A record object.
Description:
DC_DbRecordClone() will create a clone of a record object.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_dbrecord()
dc_dbrecordcompare()
Compare two record objects created by DC_DbRecord()
Syntax:
DC_DbRecordCompare( < oRecord1 >, < oRecord2 > ) - >
lStatus
Arguments:
< oRecord1 > and < oRecord2 > are record objects created by
DC_DbRecord().
Returns:
A TRUE if the contents of the record objects are exactly equal,
otherwise FALSE.
Description:
DC_DbRecordCompare() is used to compare the contents of two
record objects created by DC_DbRecord().
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_dbrecord()
dc_dbrecordcopy()
Copy a Database Record Object
Syntax:
DC_DbRecordCopy( < oRecordFrom >, < oRecordTo > ) - > nil
Arguments:
< oRecordFrom > is a record object created by DC_DbRecord().
< oRecordTo > is a record object that contains fields of the same
names as < oRecordFrom >. Only field names of the same name and
type will be copied, all others will be ignored.
Returns:
Nil.
Description:
DC_DbRecordCopy() will copy the contents of a record object that
was created by DC_DbRecord() into another record object.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_dbrecord()
dc_dbscatter()
dc_dbgather()
dc_dbrecordcompare()
dc_dbrecordedit()
An editor for a record object
Syntax:
DC_DbRecordEdit( < oRecord > ) - > lUpdated
Arguments:
< oRecord > is a record object created by DC_DbRecord().
Returns:
A logical .T. if the record was updated.
Description:
DC_DbRecordEdit() is a gui editor for modifying the contents of
a record object.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_dbrecord()
dc_dbrecordisempty()
Test if a record object is empty
Syntax:
DC_DbRecordIsEmpty(oRecord) - > < lStatus >
Arguments:
A record object that was created with DC_DbRecord().
Returns:
A logical .TRUE. if all fields are empty, .FALSE. otherwise.
Description:
DC_DbRecordIsEmpty() will test if all fields of a record object
are empty.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_dbrecord()
dc_dbrecordtrim()
Trims all character string values in a record object
Syntax:
DC_DbRecordTrim( < oRecord > ) - > nil
Arguments:
< oRecord > is a record object that was created with DC_DbRecord()
and filled with DC_DbScatter().
Returns:
Nil
Description:
DC_DbRecordTrim() is used to trim the trailing spaces off all
character string values in a record object created with DC_DbRecord().
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_dbrecord()
dc_dbscatter()
dc_dbscatter()
Scatter data from current record to a Record Object
Syntax:
DC_DbScatter( < oRecord > ) - > < oRecord >
Arguments:
< oRecord > is a record object.
Returns:
A pointer to the passed in record object.
Description:
DC_DbScatter() is used to scatter the data in all fields of the
currently selected record into the iVars of a record object
previously created by DC_DbRecord().
Two additional iVars are added to the record object:
RECORD_NUMBER - A numeric container for the current record number that
is set when DC_DbScatter() is used.
RECORD_DELETED - A logical container for the Deleted() flag is
set when DC_DbScatter() is used.
Examples:
FUNCTION XTest()
LOCAL oRecord
USE COLLECT
oRecord := COLLECT->(DC_DbRecord():new())
COLLECT->(DC_DbScatter(oRecord))
@ 1,1 DCSAY 'Description' GET oRecord:descript
@ 2,1 DCSAY 'Type' GET oRecord:type
@ 3,1 DCSAY 'Sub-Type' GET oRecord:subtype
DCREAD GUI
COLLECT->(DC_DbGather(oRecord))
RETURN nil
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_dbrecord()
dc_dbgather()
dc_dbseek()
Seek a record in a set of Scoped Records
Syntax:
DC_DbSeek ( [< xValue >], ;
[< lSoftSeek >], ;
[< cIndexTag >], ;
[< lSeekLast >] ) - > lStatus
Arguments:
< xValue > is any value of the same type as the index key for
the selected order.
< lSoftSeek > if .TRUE. will perform a softseek. .FALSE. is default.
< cIndexTag > is the Index Tag to select for the seek. The default
is the current order.
< lSeekLast > if .TRUE. will seek the last record that matches
< xValue >.
The default is .FALSE.
Returns:
A logical value.
Description:
DC_DBSEEK() is used to SEEK a record in a group of "scoped"
records. Scopes are set via the DC_SetScope() function. This
functions identical to the Xbase++ dbSeek() function except if
the record is not found or is outside the range of the scope,
it behaves as follows:
1. If the record is not found the record pointer is placed at
Eof() and a .FALSE. is returned.
2. If the record is found but the indexkey() value is less
than the top scope, the record pointer is placed at the
beginning record of the scope and a .FALSE. is returned.
3. If the record is found but the indexkey() value is greater
than the bottom scope, the record pointer is placed at the
last record of the scope and a .FALSE. is returned.
4. If the record is found and the indexkey() value is within
the range of the top and bottom scope, the record pointer
is placed at the found record and a .TRUE. is returned.
If no scope is set or the ADSDBE is used as the data driver for
the current workarea DC_DbSeek() simply calls dbSeek() therefore
it can be used as a replacment for dbSeek().
Examples:
. USE EXPRESS VIA FOXCDX INDEX EXPRESS
. SET SCOPE TOP TO 'DC_F'
. SET SCOPE BOTTOM TO 'DC_H'
. ? DC_DbSeek('DC_G')
.T.
. ? DC_DbSeek('DC_R')
.F.
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_setscope()
dc_dbskip()
Skip records in a set of Scoped Records
Syntax:
DC_DbSkip ( [< nRecords >] ) - > nil
Arguments:
< nRecords > is any positive or negative value.
Returns:
The actual number of records that were skipped. This number may
be less than the number of records requested in the event that
the first or last record in the scoped group was encountered.
DC_DBSKIP() will not skip past the bottom record or previous
the top record in a scoped group.
Description:
DC_DBSKIP() is used to SKIP <þnþ> records in a group of
"scoped" records. Scopes are set via the DC_SetScope() function.
If a scope is not set, then DC_DBSKIP() simply calls dbSkip()
therefore it can be used as a replacement for dbSkip().
Notes:
Examples:
#include 'dcdialog.ch'
#include 'appevent.ch'
PROCEDURE XTest()
LOCAL GetList := {}, oBrowse, aPres, cScopeTop, cScopeBot
USE ..\XDOC\EXPRESS INDEX ..\XDOC\EXPRESS.CDX ;
VIA FOXCDX ALIAS XDOC
OrdSetFocus('COMMAND')
DC_KeyStat(.t.)
@ 3,1 DCBROWSE oBrowse ALIAS 'XDOC' ;
SIZE 77,11.8 ;
FREEZELEFT {1}
DCBROWSECOL FIELD XDOC->command ;
HEADER "Command" PARENT oBrowse
DCBROWSECOL FIELD XDOC->type ;
HEADER "Type" PARENT oBrowse
DCBROWSECOL FIELD XDOC->short ;
HEADER "Short Description" PARENT oBrowse
DCBROWSECOL FIELD XDOC->module ;
HEADER "Module" PARENT oBrowse ;
DCBROWSECOL FIELD XDOC->category ;
HEADER "Category" PARENT oBrowse
DCBROWSECOL FIELD XDOC->see_also ;
HEADER "See Also" PARENT oBrowse
DCREAD GUI ;
FIT ;
ADDBUTTONS ;
TITLE 'Browse Scoping Demo' ;
EVAL {||_SetNavBlocks(oBrowse),;
DC_SetScope(0,'DC_G'),;
DC_SetScope(1,'DC_K'),;
DC_DbGoTop(),;
oBrowse:RefreshAll() }
RETURN
/* -------------------- */
STATIC PROCEDURE _SetNavBlocks( oBrowse )
oBrowse:skipBlock := {|n| DC_DBSKIP(n) }
oBrowse:goTopBlock := {| | DC_DbGoTop() }
oBrowse:goBottomBlock := {| | DC_DbGoBottom() }
oBrowse:phyPosBlock := {| | Recno() }
oBrowse:posBlock := {| | DC_KeyNo() }
oBrowse:lastPosBlock := {| | DC_KeyCount() }
oBrowse:firstPosBlock := {| | 1 }
RETURN
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_setscope()
dc_bof()
dc_eof()
dc_dbskipunique()
Skip to the next unique record
Syntax:
DC_DbSkip () - > nil
Arguments:
None.
Returns:
Nil.
Description:
DC_DBSKIPUNIQUE() is used to SKIP to the next record in the
database that is unique within the controlling index.
Examples:
/* This example will load an array with every city in
the database */
PROCEDURE XTest()
LOCAL aCity[0]
dbeSetDefault('FOXCDX')
USE xtest INDEX xtest
OrdSetFocus('CITY')
DO WHILE !Eof()
AAdd( aCity, XTEST->city )
DC_DbSkipUnique()
ENDDO
RETURN aCity
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_dbskip()
dc_bof()
dc_eof()
dc_dbstru()
Display the structure of the selected database
Syntax:
DC_DbStru() - > cFieldName
Arguments:
None.
Returns:
The name of the field selected by the user, a character string.
Description:
DC_DbStru() is used to display the structure of the selected
database file. A GUI dialog window displays the structure in
a scrollable window with options to Print or save to a File.
Examples:
. USE COLLECT
. DC_DbStru()
Source/Library:
_DCDBSTR.PRG, DCLIP1.DLL
See Also:
DISPLAY STRUCTURE
dc_dbstruw()
dc_dbstruct()
Get the structure of a database in various formats
Syntax:
DC_DbStruct ( [< nMode >] ) - > aStructure
Arguments:
< nMode > is used to select the style of structure to be returned:
< nMode > Description
---------- ------------------------------------------------
0 DEFAULT Returns four (4) parallel sub-arrays rather than
ragged arrays.
1 Returns a ragged array similar to dbStruct()
except each sub-array consists of 7 elements
instead of 4 elements:
Element Type Description
------- ------ -------------------------------
1 C Field Name
2 C Field Type
3 N Field Length
4 N Field Decimals
5 C Field Name
6 C Field Type
7 X Default value (the value in the
field of the current record)
Returns:
A Multi-dimensional array.
Description:
DC_DBSTRUCT() is similar to the Xbase++ DBSTRUCT() function,
except that it returns the structure in an arrays of various
formats.
Examples:
-- Example 1 --
// use a Database
. use express via foxcdx
// save the structure
aStru := DC_DBSTRUCT(0)
// create a .DBF of the same structure
dc_dbcreate( 'express2.dbf', ;
aStru[1], aStru[2], aStru[3], aStru[4] )
-- Example 2 --
// use a Database with a new structure
. use newdata
// save the structure
. aStru := DC_DBSTRUCT(1)
// close the database
. CLOSE
// use the Database with structure to be updated from new
// structure
. use olddata
// update the structure with new fields and default data
. DC_StruUpdate( aStru,, .t. )
Source/Library:
_DCAREA.PRG, DCLIP1.DLL
See Also:
dc_dbcreate()
dc_struupdate()
dc_isstru()
dc_dbstruw()
Display the structure of the selected database (wide format)
Syntax:
DC_DbStruW() - > cFieldName
Arguments:
None.
Returns:
The name of the field selected by the user, a character string.
Description:
DC_DbStruW() is used to display the structure of the selected
database file in a Wide format. A GUI dialog window displays
the structure in a scrollable window with three columns of
fields.
Examples:
. USE COLLECT
. DC_DbStruW()
Source/Library:
_DCDBSTR.PRG, DCLIP1.DLL
See Also:
DISPLAY STRUCTURE
dc_dbstru()
dc_dbu()
A Gui Database Management Utility
Syntax:
DC_Dbu( [< cParm1 >],... [< cParm15 >] ) - > nil.
Arguments:
< cParm1 > thru < cParm15 > may be any of the following
arguments:
/an - Load ADSDBE driver (.NTX/.DBT support)
/ac - Load ADSDBE driver (.CDX/.IDX/.FPT support)
/dbe:< default dbe name >
/tbl:< database name >
/ind:< index list (separated by commas)
/odbc - Load ODBC driver
/dsn:< data source name > - ODBC (use a + for each space in name)
/uid:< user id > - ODBC
/pwd:< password > - ODBC
/dbq:< database name > - ODBC
/dll:< dllname > - Load a dynamic link library
/srv:< server name or drive letter > - ADSDBE
/obj:< objfilename > - Load an .OBJ file
/proc:< procedure > - Run a procedure ( with parameters)
Description:
DC_Dbu() is a database management utility that can be used to
edit databases using any DBE including ADSDBE and ODBCDBE.
DC_Dbu() is an MDI-based dialog that contains a status window at
the top of the dialog. This status window displays information
about the currently selected work area and also contain some
pushbuttons to popup further status windows.
A menu at the top of the dialog provides a complete set of
database utilities, searching features and printing features.
It also allows for an MDI child browse/edit window to be created
for each open work area. When a browse/edit window is given
focus with the mouse, the work area of that window is selected
and the status of the selected work area is displayed at the
top of the dialog window.
All MDI child windows are opened in the same thread as the
parent window.
Examples:
DC_Dbu('/odbc','/dsn:dBASE Files','/adsntx','/obj:TEST.OBJ', ;
'/proc:MyMenu()' )
Source/Library:
_DCDBU.PRG,DCLIP1.DLL
See Also:
dc_dot()
dbu
dc_debugbrowse()
Send debug information to a browse-style debugging window
Syntax:
DC_DebugBrowse ( { < xExpr1,...xExprN >}, ;
[< aExprTitle >], ;
[< nWindow >], ;
[< nbFgColor >], ;
[< nBgColor >], ;
[< lbPause >] ) - > NIL
Arguments:
< xExpr1 > through < xExprN > is any expression.
The return value of each expression will be displayed in column
1 of the browse.
< aExprTitle > is an optional array of character strings to display
in column 2 of the browse. There should be 1 item for each exprX
item. These may be used as descriptors of the data being displayed.
< nWindow > is the debug window to send the information.
If this clause is not used then the information is sent to debug
window # 1.
< nbFgColor > and < nBgColor > are the foreground and
background
colors of the information to display in the window. If < nbFgColor >
is a code block, then < nBgColor > is ignored. The code block must
return an array of two numeric elements, ie a foreground color
and a background color.
< lbPause > may be a logical variable or a code block. If
< lbPause >
is a logical .TRUE. then the program execution will be stopped until
the "Continue" button on the debug window is activated. If
< lbPause >
is a codeblock then the program execution will be stopped if the
codeblock returns a .TRUE. when evaluated.
Description:
DC_DebugBrowse() is used to send data to a browse-style debugging
window when debugging GUI applications.
A list of expressions may be included and the output of each
expression will be displayed in a new row in the browse window.
This is a major improvement over DC_DebugQout() because it uses an array
browse rather than a memo to show debug information. Improvements:
a. Updating the window is much faster therefore does not slow
down application.
b. Data is in resizeable and moveable columns
c. Each debug line may have its own color.
d. Supports multiple windows.
e. Double-Clicking on debug item in window displays more info
about that item, such as array browsing, object inspecting,
etc.
f. Information doesn't scroll off the window. No limit to amount
of debugging information.
Notes:
DC_DebugQoutAppendBlock() is a get-set function used to setup
additional information to append to each debug line.
Examples:
#include "dcdialog.ch"
USE COLLECT NEW SHARED
DC_DebugBrowse( { Alias(), RecNo(), {'Alias','Record #'}, ;
2, {||IIF(RecNo()==3,;
{GRA_CLR_RED,GRA_CLR_WHITE}
{GRA_CLR_BLACK,GRA_CLR_WHITE})} )
DC_DebugBrowse( { SetAppWindow() } )
DC_DebugBrowse( { Directory() } )
Source/Library:
_DCQOUT.PRG, DCLIPX.DLL
See Also:
DCBDEBUG
dc_debugbrowseenable()
Enable debugging with an environment variable
Syntax:
DC_DebugBrowseEnable ( < aEnvirVars > ) - > nil
Arguments:
< aEnvirVars > is an array of character strings which are the names
of environment variables to test. If any of the environment
variables contains a YES, ON, HO or JA, then DCBDEBUG commands
will be enabled, otherwise they will be disabled.
Returns:
Nil.
Description:
DC_DebugBrowseEnable() is used to disable all DCBDEBUG commands
unless a specified environment variable exists.
Examples:
IF lRunningAsService
// No environment variable named ABCDEFGHI exists, so disable debug
DC_DebugBrowseEnable( {"ABCDEFGHI"} )
ELSE
// Disable debug if there is no env var named DEBUG=YES
DC_DebugBrowseEnable( {"DEBUG"} )
ENDIF
Source/Library:
_DCQOUT.PRG, DCLIPX.DLL
See Also:
DCBDEBUG
dc_debugbrowse()
dc_debuglogfile()
Set the name of the Debug Log file.
Syntax:
DC_DebugLogFile( [< cFileName >] ) - > cOldFileName
Arguments:
< cFileName > is the name of the log file.
Returns:
A character string.
Description:
DC_DebugLogFile() is a Get-Set function that is used to
set the name of the log file when using the DC_DebugLog()
function or DCLDEBUG* commands.
Examples:
DC_DebugLogFile('E:\temp\debug.log')
DCLDEBUG Date(), Time()
Source/Library:
_DCQOUT.PRG
See Also:
DCLDEBUG
dc_debuglogout()
Send debug information to a debugging log file
Syntax:
DC_DebugLogOut( < xExpr1 > ) - > NIL
Arguments:
< xExpr1 > through < xExprN > is any expression.
Description:
DC_DebugLogOut() is used to send data to a log file when
debugging GUI applications.
A list of expressions may be included and the output of each
expression will be displayed on a new line in the file.
Notes:
DC_DebugQoutAppendBlock() is a get-set function used to setup
additional information to append to each debug line.
Examples:
#include "dcdialog.ch"
USE COLLECT NEW SHARED
DC_DebugLogOut( { Alias(), IndexOrd() } )
Source/Library:
DCDIALOG.CH
See Also:
DCQDEBUG
DCLDEBUG
dc_debugqout()
Send debug information to a debugging window
Syntax:
DC_DebugQout( {< xExpr1 >,...< xExprN >} ) - > NIL
Arguments:
< xExpr1 > through < xExprN > is any expression.
Description:
DC_DebugQout() is used to send data to a debugging window when
debugging GUI applications.
A list of expressions may be included and the output of each
expression will be displayed on a new line in the window.
Notes:
DC_DebugQoutAppendBlock() is a get-set function used to setup
additional information to append to each debug line.
Examples:
#include "dcdialog.ch"
USE COLLECT NEW SHARED
DC_DebugQout( { Alias(), IndexOrd() } )
Source/Library:
DCDIALOG.CH
See Also:
DCQDEBUG
dc_debugqoutappendblock()
dc_qout()
DCQOUT
dc_debugqoutappendblock()
Post a codeblock for information to append to debug window
Syntax:
DC_DebugQoutAppendBlock( < bExpr > ) - > bOldExpr
Arguments:
< bExpr > is a code block that returns a character string.
Returns:
A Code Block.
Description:
DC_DebugQoutAppendBlock() is a get-set function used to setup
additional information to append to each debug line.
The default code block returns the call stack.
{||' <þ- Called From: ' + ;
ProcName(2) + '('+Alltrim(Str(ProcLine(2)))+'), ' + ;
ProcName(3) + '('+Alltrim(Str(ProcLine(3)))+'), ' + ;
ProcName(4) + '('+Alltrim(Str(ProcLine(4)))+')' }
Examples:
#include "dcdialog.ch"
DC_DebugQoutAppendBlock( {||' <- Called From: ' + ;
ProcName(2) + '('+Alltrim(Str(ProcLine(2)))+')' }
USE COLLECT NEW SHARED
DC_DebugQout( { Alias(), IndexOrd() } )
Source/Library:
DCDIALOG.CH
See Also:
DCQDEBUG
dc_debugqout()
dc_qout()
DCQOUT
dc_debugwindowbrowsefont()
Sets font for the debug window
Description:
DC_DebugWindowBrowseFont() is a Get-Set function that is used to
set the font for the debug window created by the WTF command.
Source/Library:
_DCQOUT.PRG, DCLIPX.DLL
See Also:
WTF
dc_debugbrowse()
dc_dec2hex()
Returns a hexidecimal number from a numeric value
Syntax:
DC_Dec2Hex( < nDecimal > ) - > cHexidecimal
Arguments:
< nDecimal > is a numeric value from 0 to 255.
Returns:
A character string. Example: 5D
Description:
DC_DEC2HEX() will convert a numeric value to Hexidecimal.
Source/Library:
_DCAND.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_bittest()
dc_andbits()
dc_dec2longint()
Converts Long Integer (32 bits) to binary character
Syntax:
DC_Dec2LongInt( < nDecimal > ) - > cBinaryString
Arguments:
< nDecimal > is a numeric value from 0 to 4294967295.
Returns:
A character string that is the binary equivalent of the passed
argument (32 characters).
Description:
DC_Dec2LongInt() converts a Long Integer (32 bits) TO binary character
representation
Source/Library:
_DCFUNCT.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_dec2hex()
dc_xorbitslong()
dc_delete()
Mark record(s) for deletion
Syntax:
DC_Delete() - > lStatus
Arguments:
None.
Returns:
A logical .TRUE. if records were deleted successfully, .FALSE.
otherwise.
Description:
DC_Delete() is used to mark records for deletion based on a set
of conditions. A GUI dialog is displayed for the user to select
the conditions.
Examples:
. USE EXPRESS INDEX EXPRESS.CDX SHARED
. DC_Delete()
Source/Library:
_DCDELE.PRG, DCLIP1.DLL
See Also:
DELETE
dc_recall()
dc_dimscreen()
Dim and disable a screen or the entire desktop.
Syntax:
DC_DimScreen( < oDialog >, ;
[< nColor >], ;
[< nTransparency >], ;
[< bGets >] ) - > < oDialog2 >
Arguments:
< oDialog > is the dialog window to dim. To dim the entire
desktop, this should be AppDeskTop().
< nColor > is the color to use for the dimming. Default is
GRA_CLR_BLACK.
< nTransparency > is the amount of transparency to use.
Default is 50.
< bGets > is a code block to evaluate that will add items
to the overlaying static. The code block will receive 2
parameters: (1) The Getlist array, (2) the Static object.
Returns:
A pointer to the overlaying window.
This window must be destroyed with the :destroy() method.
Description:
DC_DimScreen() will dim and disable a gui screen or the entire desktop.
Use this function fo force the user to focus on a new window or
process.
This function creates a new window with a DCSTATIC child object
to overlay the target screen. The new window is set to a specified
color and transparency to give the illusion that the target screen is
being changed, but it is only being overlayed.
Examples:
See the sample program in .\samples\dimmer\dimmer.prg.
Source/Library:
_DCFUNCT.PRG
dc_dir()
Display a directory of files or databases
Syntax:
DC_Dir( [< cFileSpec >] ) - > lStatus
Arguments:
< cFileSpec > is the specification of the files to display including
path and extension. The file dialog shows the file name, date,
size and time.
If no argument is passed, then only .DBF database files will be
displayed. This dialog allows for the file to be automatically
opened when the item is selected. The database dialog shows the
file name, date, size, number of records, and type of database.
Returns:
A logical .TRUE. if any files were displayed, .FALSE. otherwise.
Description:
DC_Dir() is used to display a directory of files or databases.
Examples:
. DC_Dir() // display all database files
. DC_Dir('*.TXT') // display all text files
Source/Library:
_DCDIR.PRG, DCLIP1.DLL
dc_dispbegin()
Begin buffering screen output
Syntax:
DC_DispBegin () - > nil
Arguments:
None
Returns:
nil
Description:
Clipper's DISPBEGIN() and DISPEND() functions will not behave
properly if they are not nested properly, i.e. the same number
of DISPBEGIN() calls and DISPEND() calls. DC_DISPBEGIN()
and DC_DISPEND() are simply front-end calls to the associated
Clipper functions that keep a static counter ensuring that
DC_DISPCLEAR() can properly clear out the buffers in the error
handler.
Notes:
Use DC_DISPBEGIN() and DC_DISPEND() in place of Clipper's
DISPBEGIN() and DISPEND() when using DC_DISPCLEAR() to
clear the display buffers.
Examples:
See Clipper 5.x Guides DISPBEGIN(), DISPEND()
Source/Library:
_DCDISP.PRG/.OBJ, DCLIPX.LIB
dc_dispclear()
Clear the screen output buffers
Syntax:
DC_DispClear () - > nil
Arguments:
None
Returns:
Nil
Description:
DC_DISPCLEAR() is used in your error handler to clear the
display buffers during an error. This function is needed
only if you use Clipper's DISPBEGIN() and DISPEND() in your
application.
Clipper's DISPBEGIN() and DISPEND() functions will not behave
properly if they are not nested properly, i.e. the same number
of DISPBEGIN() calls and DISPEND() calls. DC_DISPBEGIN()
and DC_DISPEND() are simply front-end calls to the associated
Clipper functions that keep a static counter ensuring that
DC_DISPCLEAR() can properly clear out the buffers in the error
handler.
Notes:
Use DC_DISPBEGIN() and DC_DISPEND() in place of Clipper's
DISPBEGIN() and DISPEND() when using DC_DISPCLEAR() to
clear the display buffers.
Examples:
See Clipper 5.x Guides DISPBEGIN(), DISPEND()
Source/Library:
_DCDISP.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_dispbegin()
dc_dispend()
dc_dispend()
End buffering screen output
Syntax:
DC_DispEnd () - > nil
Arguments:
None
Returns:
Nil
Description:
Clipper's DISPBEGIN() and DISPEND() functions will not behave
properly if they are not nested properly, i.e. the same number
of DISPBEGIN() calls and DISPEND() calls. DC_DISPBEGIN()
and DC_DISPEND() are simply front-end calls to the associated
Clipper functions that keep a static counter ensuring that
DC_DISPCLEAR() can properly clear out the buffers in the error
handler.
Notes:
Use DC_DISPBEGIN() and DC_DISPEND() in place of Clipper's
DISPBEGIN() and DISPEND() when using DC_DISPCLEAR() to
clear the display buffers.
Examples:
See Clipper 5.x Guides DISPBEGIN(), DISPEND()
Source/Library:
_DCDISP.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_dispbegin()
dc_dispmem()
Display the contents of a memory file or current memory
Syntax:
DC_DispMem( [< cMemFileName >] ) - > lStatus
Arguments:
< cMemFileName > is the name of the memory file. If no extension
is given then .XPF is assumed.
If no argument is passed then the current contents of memory
are saved to a file named EXPRESS.XPF and the contents of
EXPRESS.XPF are displayed. NOTE: If any PUBLIC or PRIVATE
memory variables exist containing non-persistent data such as
objects or some type of code blocks, a runtime error will
result and the contents of memory cannot be displayed.
Returns:
A logical .TRUE. if successful.
Description:
DC_DispMem() is used to display the contents of an .XPF
(memory) file or the current contents of memory
(PUBLICS/PRIVATES only) in a GUI scrolling browse window.
Examples:
. custname := 'Donnay Software'
. product := 'eXPress++ 2.0'
. DC_DispMem()
. DC_DispMem('PRODUCT.XPF')
Source/Library:
_DCMEM.PRG, DCLIP2.DLL
See Also:
dc_xpftoarray()
DISPLAY MEMORY
dc_dlllist()
List all loaded dynamic .DLLs
Syntax:
DC_DllList() - > nil
Arguments:
< cDllName > is the name of the .DLL to load. If this argument
is not passed a GUI dialog will be displayed prompting for the
name.
< lMessage > if .TRUE. (default) will display a GUI message box
if the .DLL could not be loaded.
Returns:
Nil.
Description:
DC_DllList() is used to list all the dynamic .DLLs that are
currently loaded. These .DLLs must have been loaded with
DC_DllLoad() or DLL LOAD.
Examples:
. DC_DllLoad('MYTEST')
. DC_DllLoad('MYFUNCS')
. DC_DllList()
Source/Library:
_DCDLL.PRG, DCLIP1.DLL
See Also:
DLL LIST
dc_dllload()
Load a dynamic .DLL
Syntax:
DC_DllLoad( [< cDllName >], ;
[< lMessage >] ) - > lStatus
Arguments:
< cDllName > is the name of the .DLL to load. If this argument
is not passed a GUI dialog will be displayed prompting for the
name.
< lMessage > if .TRUE. (default) will display a GUI message box
if the .DLL could not be loaded.
Returns:
A logical .TRUE. if the .DLL was successfully loaded, .FALSE.
otherwise.
Description:
DC_DllLoad() is used to load a dynamic .DLL and save away
information about the .DLL in a static array to be used later
with DC_DllUnload().
Examples:
. DC_DllLoad('MYTEST')
. DO test
. DC_DllUnload('MYTEST')
Source/Library:
_DCDLL.PRG, DCLIP1.DLL
See Also:
DLL LOAD
dc_dllunload()
dc_dlllist()
dc_dllunload()
UnLoad a dynamic .DLL
Syntax:
DC_DllUnload( < cDllName > ) - > lStatus
Arguments:
< cDllName > is the name of the .DLL to unload.
Returns:
A logical .TRUE. if the .DLL was successfully unloaded.
Description:
DC_DllUnload() is used to unload a dynamic .DLL that was previously
loaded with DLL LOAD or DC_DllLoad().
Examples:
. DC_DllLoad( 'MYTEST' )
. DO test
. DC_DllUnload( 'MYTEST' )
Source/Library:
_DCDLL.PRG, DCLIP1.DLL
See Also:
dc_dllload()
DLL UNLOAD
dc_do()
A handy method of creating a late-binding call to a function
Syntax:
DC_Do ( < cProgToDo >, ;
[< cProgToCall >] ) - > xValue
Arguments:
< cProgToDo > is the name of the procedure or function to execute
in "quotes".
< cProgToCall > is the name of any additional procedure or
function to execute in the event that DC_DO() cannot find
procedure < cProgToDo > in the .EXE or in a dynamic library.
Returns:
The value returned by the function called.
Description:
DC_DO() is used to run any program or function. DC_DO() is
used in place of DO <þprocþ> or <þfunctionþ> in applications
where
the developer wishes to control which procedures or functions
get linked into an application by simple EXTERNAL tables.
DC_DO() runs procedures or functions, but does not force the
linker to link them into the .EXE program. For example, the
command: DO ACCTSPAY in an application would always force the
module or object ACCTSPAY to be linked into the .EXE by your
linker. If however, you replace DO ACCTSPAY with
DC_DO('ACCTSPAY'), then the ACCTSPAY module will only be linked
in to the .EXE with an EXTERNAL ACCTSPAY command or by the
dCLIP "dynamic-linker". DC_DO() should be used when calling
procedures or functions which are in dynamic libraries (.DLBs).
With DC_DO() the developer can create an application with many
OPTIONS yet use common source code. The options for a
specific customer or product configuration can be controlled
through EXTERNAL tables.
Examples:
. ? DC_DO( "dc_assist()" )
Source/Library:
_DCDO.PRG/.OBJ, DCLIPX.LIB
dc_docase()
Evaluate a list of expressions based on a CASE condition
Syntax:
DC_DoCase ( < aCase >, ;
< aEval > ) - > Nil
Arguments:
< aCase > is an array of code blocks to evaluate.
< aEval > is an array of code blocks to execute. The first code
block in array < aCase > that evaluates true will force the
corresponding code block in the parallel array < aeval > to be
evaluated.
Returns:
Nil.
Description:
DC_DOCASE() is a "function" replacement for DO CASE...ENDCASE
when a function is needed, i.e. for calling via macro, code
blocks, etc.
Notes:
Only one (1) code block in the <þaEvalþ> array will be evaluated.
Examples:
aCase := { { || lastkey()=27 }, { || lastkey()=13 } }
aEval := { { || abort() }, { || accept() } }
inkey(0)
DC_DOCASE( aCase, aEval )
Source/Library:
_DCEVAL.PRG, DCLIP1.DLL
See Also:
dc_ifelse()
dc_dowhile()
dc_dot()
A Dot-Prompt Interpreter
Syntax:
DC_Dot( [< lModal >], ;
[< nTimerRefresh >] ) - > NIL
Arguments:
< lModal > runs the Dot-Prompt in "Psuedo-Modal" mode. It is not
actually modal but instead disables the SetAppWindow(). When
the EXIT button is pressed or the EXIT command is entered at the
dot-prompt, the user is given the option of closing the window
or exiting and returning control to the calling program.
< nTimerRefresh > is the refresh interval, in 1/100 of a second,
to refresh the status area at the top of the window.
Description:
DC_Dot() is a dot-prompt interpreter that is used to execute any
Xbase++ command, eXPress++ command or User-Defined command.
DC_Dot() will open a new Dialog Window and allow the user to enter
and interpret commands.
The standard eXPress++ command set is DCSTD.CH. This file must
exist in your INCLUDE path or no commands can be interpreted.
When DCSTD.CH is loaded, it also loads the most common Xbase++
include files like STD.CH, INKEY.CH, etc, the dialog command set,
DCDIALOG.CH and file named DCCUSTOM.CH.
DCCUSTOM.CH is where all custom user-defined commands are entered,
including references to other .CH files, thus allowing virtually
an unlimited command set.
Commands entered at the dot-prompt may reference any manifest
constant that has also been defined in one of the files that are
part of the INCLUDE set.
To return from DC_Dot() type EXIT at the dot-prompt.
To quit the application type QUIT at the dot-prompt.
DC_Dot() is an interpreter which provides similar functionality
to the dBASE/FoxPro/dCLIP dot-prompt. The heart of the
interpreter is the runtime pre-processor and the DCSTD.CH/STD.CH
command sets.
If you grew up with dBASE-II or dBASE-III and graduated to
Clipper, you will find yourself in familiar territory when you
use DC_Dot(). The dot prompt is similar to the dBASE interactive
programming environment that allows any of the built-in command
set to be invoked from the dot prompt. DC_Dot() is slightly
different however, because it combines the best of 3 worlds.
This "integration" of a pre-processor, intepreter, compiler and
robust library allows unsurpassed speed and compatability in
accomplishing Xbase++/eXPress++ development tasks.
When a command is entered at the dot-prompt, it's first passed
through the Xbase++ pre-processor to convert it to a set of
expressions. The expression list is then "macro-compiled" and
evaluated.
The eXpress++ dot prompt is fully-interactive, meaning that you get
an instant response to the command at the moment you enter it
from the keyboard.
EXAMPLE:
Assume that your client wants to get a quick average of all
sales within a specified date period. Then he wants to
replace the sales representative for all his CALIFORNIA
customers. If you did not accomodate this capability in your
executable program, your client is out of luck or must
accomplish the task without the aid of your program. With
the DC_DOT() function linked into your program, this task can
be accomplished in seconds by entering the following commands
at the dot:
. USE \ACCTSPAY\CUSTOMER VIA FOXCDX
. AVER SALES TO TOTSALES FOR SHIPDATE þ> DATE()-30
. ? TOTSALES 12677.52
. REPL SALESREP WITH 'JONES' FOR STATE='CA'
If you like working from a command-line, then the DOT is the
starting place or "home" for just about everything you need to
do in an Integrated Development Environment. You can run any
other executable program (regardless of size), run any DOS command,
run any Xbase++ or user-defined command, evaluate any Xbase++
expression, execute any batch file, edit source files, even compile
and run object code without ever leaving the interactive environment
of the dot prompt. When you run an application program, you will
return to the DOT. When you run another executable program such as
your own editor, word- processor, spread-sheet, calendar, etc.
you will return to the DOT. When you compile your source code,
you will return to the DOT.
The dot-prompt is also a medium for experimenting with commands,
functions, classes and language elements by allowing the user or
programmer to create memory variables, arrays or objects
"on-the-fly".
Examples:
/* -- Example 1 Calling the dot-prompt from in-line code -- */
IF lDebugOn
DC_Dot()
ENDIF
/* -- Example 2 Calling the dot-prompt from a Hot-Key -- */
SET KEY K_ALT_D TO DC_DOT
@ 1,1 SAY 'Enter Name' GET cName
READ
SET KEY K_ALT_D TO nil
/* -- Example 3 Calling the dot-prompt from eXPress++ dialog -- */
DCHOTKEY xbeK_ALT_D ACTION {||DC_Dot(.f.)}
DCREAD GUI FIT ADDBUTTONS
Source/Library:
_DCDOT.PRG,DCLIP1.DLL
See Also:
dc_interpret()
dc_dotsize()
dc_dotdoskey()
Set DC_Dot() command stack operation to Dos-Key emulation
Syntax:
DC_DotDosKey ( < lMode > ) - > nSize
Arguments:
< lMode > if .TRUE. will set the Dos-Key emulation on. If
.FALSE. the command stack operation will be restored to
the normal (default) operation.
Returns:
A logical value equivalent to the last setting of the value.
Description:
DC_DOTDOSKEY() is used to set the behavior of the dot-prompt
command stack navigator to emulate that of DOS command stack
navigators like Dos-Key or OS/2.
The normal behavior allows commands to be reissued in
sequence and expedite processes that are used again and
again. Dos-Key emulation automatically copies the selected
command to the bottom of the stack after execution and
creates a blank command line for input.
Source/Library:
_DCDOT.PRG
See Also:
dc_dot()
dc_dothotkey()
Set the Dot-Prompt hot key
Syntax:
DC_DotHotKey ( [< nHotKey >] ) - > nOldHotKey
Arguments:
< nHotKey > is any keyboard key defined in APPEVENT.CH.
Returns:
A numeric value.
Description:
DC_DOTHOTKEY() is used to establish the hot key to use to
call up the dot prompt when in the GUI reader or in the standard
event loop function: DC_ReadGuiEventLoop(). The default key
is ALT-D.
If the DCLIP1.DLL and DCLIP2.DLL libraries (eXPress++ 2.0) are
statically linked to your application using DCLIP1.LIB and
DCLIP2.LIB then the DC_Dot() function will be called directly,
otherwise an attempt will be made to dynamically load DCLIP1.DLL
and DCLIP2.DLL before calling DC_Dot().
Examples:
DC_DotHotKey(xbeK_F12)
Source/Library:
_DCGETBX.PRG
See Also:
dc_readguieventloop()
dc_dotsize()
Set the size of the Dot-Prompt command stack
Syntax:
DC_DotSize ( [< nSize >] ) - > nSize
Arguments:
< nSize > is a number from 100 to 4000
Returns:
A numeric value equal to the previous setting of the command
stack size.
Description:
DC_DOTSIZE() is used to increase the length of the Dot-Prompt
command stack array to a value greater than the default value
of 100 commands. This is desirable in the event that it is
necessary to save and restore more than the last 100 commands
with the HISTORY=<þfileþ> command in your DCLIP.SYS.
Examples:
DC_DOTSIZE(500)
Source/Library:
_DCDOT.PRG
See Also:
dc_dot()
dc_dotvar()
Returns a pointer to an array of passed info to DC_Dot()
Syntax:
DC_DotVar() - > aArray
Returns:
An array of 3 elements:
1. A pointer to the DC_XbpDialog1() object.
2. A pointer to the GetList array.
3. A pointer to the DC_GetList() object.
Description:
DC_DotVar() returns an array of info about the dialog window and Getlist
for the dialog that invokes the dot-prompt when using DC_DotHotKey().
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
See Also:
dc_dothotkey()
dc_dot()
dc_dowhile()
Evaluate a list of expressions based on a CASE condition
Syntax:
DC_DoWhile ( < bWhile >, ;
< bEval > ) - > nil
Arguments:
< bWhile > is a code-block to evaluate in each iteration of the
WHILE loop. The loop will be terminated when < bWhile >
evaluates .FALSE. or when the ESCape key is pressed.
< bEval > is a code-block to evaluate in each iteration of the
WHILE loop.
Returns:
Nil.
Description:
DC_DOWHILE() is a "function" replacement for DO WHILE..ENDDO
loops to be used when a function is needed, i.e. for calling
via macro, code blocks, etc.
Examples:
bWhile := { || !EOF() }
bEval := { || dbskip(1), qout( recno(), &(field(1)) ) }
setkey( -1, { || DC_DOWHILE( bWhile, bEval } )
Source/Library:
_DCEVAL.PRG, DCLIP1.DLL
See Also:
dc_ifelse()
dc_docase()
dc_drag()
Drag window coordinates and return a coordinate array
Syntax:
DC_Drag ( < nStRow >, ;
< nStCol >, ;
< nEnRow >, ;
< nEnCol >, ;
< nDragMode >, ;
[< nMinWidth >],
[< nMinHeight >] ) - > aCoordinates
Arguments:
< nStRow >, < nStCol >, < nEnRow >, < nEnCol >
are the screen
coordinates that you want to start the drag or window sizing
from. If no coordinates are passed then the dragging will
start from the extreme coordinates of the display.
< nDragMode > : DRAG_UPPER_LEFT 1
DRAG_UPPER_RIGHT 2
DRAG_LOWER_LEFT 3
DRAG_LOWER_RIGHT 4
DRAG_LEFT 5
DRAG_RIGHT 6
DRAG_UPPER 7
DRAG_LOWER 8
DRAG_ENTIRE_BOX 9
< nMinWidth > is the minimum width of the new box.
< nMinHeight > is the minimum height of the new box.
Returns:
An array of four (4) elements with the coordinates selected by
the user.
Description:
DC_DRAG() is used to designate an area of the screen you want
to use by giving the operator a box to drag around with the
cursor keys or the mouse. After the operator has chosen the
screen coordinates, pressing the <þenterþ> key or releasing the
mouse button will return the 4 coordinates in an array.
During the dragging process if the drag was not invoked by
the mouse, then the TAB key will switch between the 9
dragging modes.
Examples:
// get a set of screen coordinates from the operator.
aCoord := DC_DRAG( aCoord )
// Explode a window to the passed coordinates.
DC_EXPL( aCoord[1], aCoord[2], aCoord[3], aCoord[4] )
Source/Library:
_DCDRAG.PRG/.OBJ, DCLIPX.LIB
dc_drive2unc()
Returns a UNC from a mapped drive letter
Syntax:
DC_Drive2UNC( < cDrive > ) - > cUNC
Arguments:
< cDrive > is the drive letter.
Returns:
A Character String.
Description:
DC_Drive2UNC() returns the UNC from a mapped drive letter.
Source/Library:
_dcfunct.prg, dclipx.lib, dclipx.dll
See Also:
dc_unc2drive()
dc_editconfig()
Edit a source file
Syntax:
DC_EditConfig( [< cEditorFileName >] ) - > cEditorFileName
Arguments:
< cEditorFileName > is the full-path file name of your editor
or the name of a .BAT file that calls your editor. This
file name is passed the name of the file to edit and the line
number.
Returns:
The name of the editor previously stored in memory.
Description:
DC_EDITCONFIG() is used to configure the name of your editor.
Functions like DC_CallStack() and DC_EditPrg() will call your
editor if it has been properly configured. When the dot prompt
is called for the first time in a program or a call to DC_Init()
is made, a file named DCLIP.SYS is read to configure the
environment. An EDITOR=<þeditor file nameþ> statement in DCLIP.SYS
will pass the <þeditor file nameþ> to DC_EditConfig() to set up
your default editor.
Notes:
If the drive and directory is not included in the <þcFileNameþ>
argument, then DC_EDITPRG() will search for the file first in
the SET DCLIP directory followed by the SET PDIR directory (if
file is a .PRG).
Examples:
. DC_EDITCONFIG( 'C:\mew\mew.bat' )
. DC_EDITPRG( 'test' )
Contents of me.bat (used to call Multi-Edit for Windows):
@ECHO OFF
@IF '%2'=='' C:\mew\mew32 %1
@IF NOT '%2'=='' C:\mew\mew32 %1 /l%2
Source/Library:
_DCEDPRG.PRG, DCLIP1.DLL
See Also:
dc_editprg()
dc_callstack()
dc_editcontrollastfocus()
Returns last edit control that had focus
Syntax:
DC_EditControlLastFocus() - > oLastFocus
Arguments:
None
Returns:
An object.
Description:
DC_EditControlLastFocus(). will return a pointer to the last
edit control that had focus. Handy for returning to a Get after
hitting a hot key or clicking a pushbutton.
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
dc_editprg()
Edit a source file
Syntax:
DC_EditPrg( < cFileName >, ;
[< nLineNmbr >], ;
[< cParameters >] - > lStatus
Arguments:
< cFileName > is the name of the ascii file to edit. If no
argument is given, then the user will be prompted for the name
of the file. If no extension is included, then .PRG is
assumed.
< nLineNmbr > is the line number to go to. If no parameter is
passed then the editing will start at line 1.
< cParameters > is an optional set of parameters to pass to the
editor.
Returns:
A logical .TRUE. if editor was called successfully.
Description:
DC_EDITPRG() is used to edit a source code file. This function
will use the editor defined as the "system" editor via the
EDITOR= command in DCLIP.SYS or the DC_EDITCONFIG() function.
If no external editor is defined, then an imbedded GUI text
editor will be used.
Notes:
If the drive and directory is not included in the <þcFileNameþ>
argument, then DC_EDITPRG() will search for the file first in
the SET DCLIP directory followed by the SET PDIR directory (if
file is a .PRG).
Examples:
. dc_editconfig( 'ME.BAT' )
. DC_EDITPRG( 'test' )
Source/Library:
_DCEDPRG.PRG, DCLIP1.DLL
See Also:
EDIT FILE
dc_enabletabpagecolors()
Get-Set function for enabling/disabling tab page colors
Syntax:
DC_EnableTabPageColors( < lEnable > ) - > lOldEnable
Arguments:
< lEnable > if .TRUE. will enable tab page colors (default). If
.FALSE. will disable tab page colors.
Description:
DC_EnableTabPageColors() is a Get-Set function that is used to
enable or disable the painting of Tabpage colors when tabpages
are created with the @ DCTABPAGE command.
By default, tab page colors are always enabled.
All tabpage colors may be disabled throughout the application
by call DC_EnableTabPageColors(.F.). This would be desirable
when using the CodeJock SkinFramework system when tab colors from
the skin are preferable.
Source/Library:
_dcclass.prg, dclipx.dll
See Also:
@ DCTABPAGE
dc_enterexitmode()
Get/Set behavior of ENTEREXIT clause
Syntax:
DC_EnterExitMode( [< nMode >] ) - > nOldMode
Arguments:
< nMode > sets the new mode in accordance with the below table.
* - Default
< nMode > Description
------- -----------------------------------------------------
0 * Standard Enter-Exit (exits if ENTER is pressed on last Get)
1 ENTER pressed on last Get gives focus to OK button.
2 Exits if ENTER is pressed any time.
Returns:
A numeric value.
Description:
DC_EnterExitMode() is a Get/Set function used to establish the
behavior of the ENTEREXIT clause of DCREAD GUI.
Examples:
DC_EnterExitMode(1) // Pressing enter in last get gives focus to OK button.
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
See Also:
DCREAD GUI
dc_envirrest()
Restore the environment from an array or file
Syntax:
DC_EnvirRestore ( < aEnvir > | < cEnvirFile > ) - > NIL
Arguments:
< aEnvir > is an array of environment variables that was saved by
DC_ENVIRSAVE().
< cEnvirSave > is an array file containing the contents of the
environment that was saved by DC_ENVIRSAVE( < cEnvirSave > ).
Returns:
NIL
Description:
DC_ENVIRREST() is used to restore all 38 Clipper environment
variables from an array or a file created by DC_ENVIRSAVE().
The Clipper environment consists of everything from SET CURSOR,
SET DEFAULT, to SET ALTERNATE, etc.
Use this function to restore the Clipper environment after
running a task that may have altered the environment.
Examples:
-- EXAMPLE 1 --
aEnvir := dc_envirsave()
do something
DC_ENVIRREST( aEnvir )
-- EXAMPLE 2 --
dc_envirsave( 'ENVIR.AR' )
do something
DC_ENVIRREST( 'ENVIR.AR' )
Source/Library:
_DCENVIR.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_envirsave()
dc_envirsave()
Save the entire environment to an array or file
Syntax:
DC_EnvirSave ( < cFileName > ) - > nil
Arguments:
< cFileName > the name of the file to save the Clipper
environment to.
If no argument is passed then no file will be created, however
the current Clipper environment will still be returned in an
array.
Returns:
The 38 Clipper environment variables in an array. See ARRAY.CH
(included in Clipper distribution) for the values.
Description:
DC_ENVIRSAVE() is used to save all 38 Clipper environment
variables to an array or a file for later restoring by
DC_ENVIRREST().
The Clipper environment consists of everything from SET CURSOR,
SET DEFAULT, to SET ALTERNATE, etc.
Examples:
-- Example 1 --
aEnvir := DC_ENVIRSAVE()
do something
dc_envirrest( aEnvir )
-- Example 2 --
DC_ENVIRSAVE( 'ENVIR.AR' )
do something
dc_envirrest( 'ENVIR.AR' )
Source/Library:
_DCENVIR.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_envirrest()
dc_eof()
Is the record pointer at the end of the file?
Syntax:
DC_Eof() - > lStatus
Arguments:
None.
Returns:
A logical value.
Description:
DC_EOF() is used to test whether or not DC_DbSkip() attempted
to move the record pointer past the bottom record in a "scoped"
set of records when using a positive skip value. If no scope
is set or the ADSDBE is being used as the data driver for the
current work area this function simply calls Eof() therefore
it can be used as a replacement for Eof().
Notes:
Examples:
DC_SetScope(0,'12001')
DC_SetScope(1,'12001')
DC_DbGoTop()
DO WHILE !DC_Eof()
DC_DbSkip(1)
ENDDO
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_setscope()
dc_bof()
dc_dbskip()
dc_dbgotop()
dc_dbgobottom()
dc_erase()
Delete a file
Syntax:
DC_Erase()
Arguments:
None.
Returns:
A logical .TRUE. if the file was successfully deleted, .FALSE.
otherwise.
Description:
DC_Erase() is used to delete a file from the disk. A GUI user
dialog is displayed to choose a file name to delete.
Examples:
. DC_Erase()
Source/Library:
_DCERASE.PRG, DCLIP1.DLL
See Also:
DELETE FILE
dc_error2string()
Converts an Error() object to a string
Description:
DC_Error2String() will generate a string of error information from
the info in an Error() object.
The string will also contain stack info, environment info and
status of all open workareas.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_errormsg()
Display an array of error messages in a window
Syntax:
DC_ErrorMsg ( < aMessage >, ;
[< lSound >], ;
[< cTitle >] ) - > nil
Arguments:
< aMessage > is an array of messages to display in the popup
box.
< lSound > - if .FALSE. don't sound error beep; default is
.TRUE.
< cTitle > is the title displayed in top line center of popup
box; defaults to 'ERROR'
Returns:
nil
Description:
DC_ERRORMSG() is used to display a popup error box onscreen.
You can override the defaults for sound and title as optional
params. The box is self centering onscreen; the text array
is centered inside the box. Pressing any key or mouse
button will remove the popup box.
Notes:
dc_errormsg ( <þaMessageþ>, [lSound], [cTitle] ) -þ> Nil
Examples:
if !isprinter()
DC_ERRORMSG( {'Printer Is Offline - Please Ensure Power',;
'Is On And Paper Is Inserted Properly'},;
'',;
' Printer Error ')
else
...
...
endif
Source/Library:
_DCMSG.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_msgbox()
dc_alert()
dc_excel2array()
Create a 2-dimensional array from an Excel file
Syntax:
DC_Excel2Array( < cFileName >, [< bEval >] ) - > aData
Arguments:
< cFileName > is the name of the Excel XLS file including the full
path.
< bEval > is a code block to evaluate after the Excel file is opened.
The Excel object and book automation object are passed to the code
block. This can be used for formatting cells before the array is
created.
Returns:
A 2-dimensional array.
Description:
DC_Excel2Array() will create a 2-dimensional array from the
contents of an Excel file.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_array2excel()
dc_workarea2excel()
dc_excel2workarea()
dc_expandtree()
Expand all nodes of a TreeView branch
Syntax:
DC_ExpandTree( < oTreeItem > | < oTreeRoot >, ;
[< lExpand >] ) - > nil
Arguments:
< oTreeItem > is any tree view branch object that is derived from
XbpTreeViewItem() or < oTreeRoot > is an object that is derived
from XbpTreeView().
If < lExpand > is .TRUE. (default) then the tree branch will be
expanded otherwise it will be collapsed.
Returns:
Nil.
Description:
DC_ExpandTree() will expand or collapse all sub branches of a
specified tree branch in an XbpTreeView.
Source/Library:
_DCARRAY.PRG, DCLIPX.DLL
dc_expl()
Explode a Text or GUI dialogue window
Syntax:
DC_Expl( < nStartRow >, ;
< nStartCol >, ;
< nEndRow >, ;
< nEndCol >, ;
[< cTitle >], ;
[< lNoShadow >], ;
[< lPaintOnly >], ;
[< lCenter >], ;
[< lRelative >], ;
[< cFont >], ;
[< lGui >] ) - > aObject
Arguments:
< nStartRow >, < nStartCol >, < nEndRow >,
< nEndCol > are the screen
coordinates, relative to 0,0 of the physical screen.
< cTitle > is the title heading on the top of the dialogue box.
If no argument is given, then there will be no title area.
< lNoShadow > if .TRUE. will prevent the shadow from being
created. Default is .FALSE. (shadow enabled). This parameter
is used in TEXT mode only.
< lPaintOnly > if .TRUE. will paint the box on the screen but not
perform the "exploding" process. Default is .FALSE. (explode).
This parameter is used in TEXT mode only.
< lCenter > will center the dialogue box on the screen and use
the coordinates only for determining the height and width
of the window.
< lRelative > if .TRUE. (default) assumes that coordinates
passed by DC_SAY() to this window are relative to location
0,0 of the window, otherwise they are relative to 0,0 of
the screen.
< cFont > is a valid font name for this window. This font will
be used as the default for all Says in this window via DC_SAY().
If no font parameter is passed, the default it 10.Courier.
This parameter is used in GUI mode only.
< lGui > is used to override the setting of DC_GUI(). If
< lGui >
is .TRUE. then this will be a GUI dialogue. IF < lGui > is
.FALSE. it will be a TEXT dialogue, otherwise it will follow
the setting of DC_GUI().
Returns:
An array of information about the screen object that is used
with DC_Say(), DC_Cls() and DC_Impl().
Description:
DC_EXPL() is a Dual-Mode function that is used to explode a
dialogue box on the screen. In TEXT mode, this function is
a front-end to DC_EXPLODE() that uses pre-defined system
colors which are part of the DCCOLOR color array. See
DCCOLOR.CH for a definition of the color manifest constants.
In GUI mode, it creates a GUI dialogue window. In both
modes, it returns an array of information that is passed to
compatible Dual-Mode functions like DC_Say(), DC_Cls(), and
DC_Impl().
DC_EXPL() also stores the array of screen information in a
static array so the functions DC_Say(), DC_Cls() and DC_Impl()
can be called without passing the screen array.
Notes:
Use DC_EXPLMODE(.f.) to disable the exploding process when you
want screens to display "instantly" instead of "explode".
This is particularly useful when running the application on a
slower computer.
Use DC_ALTSHADOW(.t.) to display the shadow on the right
side of the box.
Examples:
-- Example 1 --
aSaveScreen := DC_EXPL( 10,10,12,70, ' Enter a command ' )
cCommand := SPACE(50)
@ 11,12 get cCommand
read
dc_impl( aSaveScreen )
-- Example 2 --
aSaveScreen := ;
DC_EXPL( 10,10,15,70,'A Gui SAY Window',,,,,,.t. )
dc_say(aSaveScreen,2,5,'This is 3/5')
dc_say(aSaveScreen,4,10,'This is 4/10')
dc_impl(aSaveScreen)
Source/Library:
_DCEXPL.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_say()
dc_cls()
dc_impl()
dc_explode()
dc_implode()
dc_explmode()
Enable/Disable exploding windows
Syntax:
DC_ExplMode ( < lExplode > ) - > lMode
Arguments:
< lExplode > if .TRUE. will force all windows created with
DC_EXPL() and DC_EXPLODE() to "explode" (default). If .FALSE.
then all windows will be painted in "instant on" mode.
Returns:
A logical value. .T. - Instant On Mode, .F. - Explode Mode.
Description:
Use DC_EXPLMODE(.f.) to disable the exploding process when you
want screens to display "instantly" instead of "explode".
This is particularly useful when running the application on a
slower computer. DC_EXPLMODE() affects the operation of the
following functions:
DC_EXPL(), DC_EXPLODE(), DC_IMPL(), DC_IMPLODE()
Examples:
DC_EXPLMODE( .t. ) // Set instant on mode
dc_browtile() // Paint all the browse windows
DC_EXPLMODE( .f. ) // Set explode mode
Source/Library:
_DCEXPL.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_expl()
dc_explode()
dc_explode()
Explode a window
Syntax:
DC_Explode( < nSrow >, ;
< nScol >, ;
< nErow >, ;
< nEcol >, ;
< cColor1 >, ;
< cColor2 >, ;
[< lTone >], ;
[< cTitle >], ;
[< nSlideRate >], ;
[< lShadow >], ;
[< lPaintOnly >], ;
[< lDouble >] ) - > cSaveScreen
Arguments:
< nSrow >, < nScol >, < nErow >, < nEcol > are
the screen coordinates.
< cColor1 > is the color of the window frame.
< cColor2 > is the color of the window contents.
< lTone > if .TRUE. will create a warning tone. .FALSE. is
default.
< cTitle > is the a title to display at the top of the box.
< nSlideRate > is a number from 1 to 10 to determine the speed at
which a small box starting at the current cursor location moves
across the screen to start the explode process. A value of 0
(default) will disable the sliding box. The smaller the number
the faster the sliding box will move.
< lShadow > if .TRUE. (default) will paint a shadow on the
screen.
< lPaintOnly > if .TRUE. will override the setting of
DC_EXPLMODE() and "instantly" paint the box on the screen
rather than "exploding" the box.
< lDouble > if .TRUE. will paint a double line border. A single
line border (.FALSE.) is default.
Returns:
A character string that is a "composite" of the coordinates,
colors, etc. to be used later to restore the screen with
DC_IMPLODE().
Description:
DC_EXPLODE() is used to explode a window on the screen with
optional border, colors, tone, shadow, etc.
Examples:
cSaveScrn := DC_EXPLODE(5,10,7,70,'B/W','N/W',.F.,;
' Enter a Command ',10)
cCommand := space(50)
@ 6,12 get cCommand
read
dc_implode( cSaveScrn )
Source/Library:
_DCEXPL.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_implode
dc_expressbuttonstyle()
Get or Set the default style for eXpress++ push buttons
Syntax:
DC_ExpressButtonStyle( [< oConfig >] ) - > oOldConfig
Arguments:
< oConfig > is an object of the DC_XbpPushButtonXPConfig() class.
Description:
DC_ExpressButtonStyle() is a Get-Set function that is used
to Set or Get the default configuration object for pushbuttons
that are automatically added to eXpress++ windows via the
ADDBUTTONS clause of DCREAD GUI command or the BUTTONS clause
of the DCGETOPTIONS command.
Examples:
oConfig := DC_XbpPushButtonXPConfig():new()
oConfig:radius := 20
oConfig:bgColor := GRA_CLR_CYAN
DC_ExpressButtonStyle( oConfig )
Source/Library:
_dcxbutt.prg, dclipx.dll
See Also:
dc_xbppushbuttonxpconfig()
DCREAD
DCGETOPTIONS
dc_fancybuttonmode()
Enable or disable FANCY pushbuttons
Syntax:
DC_FancyButtonMode( < nMode > ) - > nOldMode
Arguments:
< nMode > is a numerical value from 0 to 2.
0 - Buttons behave the way they were defined in the DCTOOLBAR
or @..DCPUSHBUTTON command. If the FANCY clause was used,
then the button will be FANCY otherwise it will be NORMAL.
1 - Buttons are all NORMAL.
2 - Buttons are all FANCY.
Returns:
A numerical value from 0 to 2.
Description:
DC_FancyButtonMode() is used to enable or disable FANCY buttons
when using the @..DCPUSHBUTTON or DCTOOLBAR commands.
FANCY buttons are "mouse-aware" pushbuttons that display when
the mouse is moved over the static area of the pushbutton.
Examples:
DC_FancyButtonMode(2) // make all buttons FANCY
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
See Also:
DCADDBUTTON
dc_fielddel()
Delete a field group from the field group dictionary
Syntax:
DC_FieldDel ( [< cFieldGroup >], ;
[< lImport >] ) - > lStatus
Arguments:
< cFieldGroup > is the name of the field group to delete. If this
parameter is empty, a picklist of all field groups will be
displayed to choose the group to delete.
< lImport > if .TRUE. will display the list of field groups in
the DXFIELDS.DBF (import) dictionary, otherwise the list will
come from the DCFIELDS.DBF dictionary.
Returns:
A logical .TRUE. if the field group was successfully deleted,
.FALSE. otherwise.
Description:
DC_FieldDel() is used to delete a field group from the Field
Group dictionary file.
Notes:
The DCFIELDS.DBF database and its associated indexes will
be created by DC_FieldOpen() if they do not already exist.
Examples:
// delete a field group from the DXFIELDS.DBF import file.
cFieldGroup := DC_FieldPick(.t.)
DC_FieldDel(cFieldGroup,.t.)
Source/Library:
_DCFLDS.PRG, DCLIP1.LIB
See Also:
dc_fieldedit()
dc_fieldload()
dc_fieldsave()
dc_fieldpick()
dc_fieldedit()
Field Dictionary Editor
Syntax:
DC_FieldEdit ( [ < cFieldGroup > | < aFieldGroup > ] )
- > aFieldGroup
Arguments:
< cFieldGroup > | < aFieldGroup > is the name of the field
group
in DCFIELDS.DBF to load and edit (up to 8 characters) or
< aFieldGroup > is a Field Group array. See RETURNS for a
specification of this array. If no parameter is passed, a
pick-list of all Field Groups in DCFIELDS.DBF will be displayed.
Returns:
An array consisting of 2 sub-arrays:
Sub-array #1 contains general information about this field
group.
* - Maximum Length allowed, Minimum Length is 0
Element Type Len Description
------------- ---- --- -------------------------------
1 C 8* Field Group Name
2 C 10* File Alias
3 C 50* Field Group Description
Sub-array #2 contains one sub-array for each field
definition.
See DCFIELDS.CH for the definitions of the array elements.
Element Type Len Description
------------- ---- --- --------------------------------
DCFLD_ALIAS C 10* Alias of database
DCFLD_NAME C 10* Field Name
DCFLD_TYPE C 2* Field Type ( C,D,L,N,M,CA,A,V )
DCFLD_LEN N Field Length
DCFLD_DEC N Field Decimals
DCFLD_DESC C 50* Field Descriptor (used in browse
column headings and edit screens)
Use semi-colons (;) for multiple
lines.
DCFLD_PROMPT C 200* Field Prompt (used in message box)
DCFLD_PICT C 100* Field Picture Clause
See Xbase++ TRANSFORM() function
DCFLD_VALTYPE C 1 Field Validation Type
See DC_FieldValidate() for more info
N - None
F - Calculated Field
X - Logical Expression
R - Range
D - Database Look-Up
T - Table Look-Up
V - View (Browse) Look-Up
A - Auto-Fill
C - Choice
E - Case
M - Memo Window
DCFLD_DEFAULT C 150* Field Default value code block.
Code block must return a value that
is the same type as the field.
DCFLD_WHEN C 100* Field When code block. Code block
must return a logical value. Used
to enable/disable field editing based
on condition. Will gray out disabled
items.
DCFLD_PROTECT C 100* Field Protect code block. Code block
must return a logical value. Used
to enable/disable field editing based
on condition. Will not gray out
disabled items.
DCFLD_VALID M 10* Field Valid Clause or Formula. This
must be a code block that returns a
logical value or a set of parameters
separated by the | delimeter. The
parameters must conform to the type
of validation. See DCFLD_VALTYPE
above.
DCFLD_EMPTY L Empty Value Allowed
DCFLD_EDIT L Editing Allowed
DCFLD_ACCESS C 5* Access Key
DCFLD_SORT N Sorting element (reserved)
DCFLD_HELPCODE C 22* Help Code
DCFLD_EDOPT C 50* Edit Option String
DCFLD_VALUE X Place to store Old Field Value
DCFLD_OLDNAME C 10* Old field name
DCFLD_OLDTYPE C 2* Old field type
DCFLD_ENCRYPT C 8* Encryption password
DCFLD_PROGRAM C Program Validation (memo)
DCFLD_FLAG L 1 Logical flag (reserved)
DCFLD_COMPILE C 100* Compile Code Block. Must return
a logical value. Used to enable
or disable inclusion of this
field in data-entry screen based
on a condition.
DCFLD_FONT C 50* Default Font Compound Name
DCFLD_TOOLTIP C 100* ToolTip. Use semicolons for
multiple lines. May also be a
code block.
DCFLD_CARGO A Cargo Array
DCFLD_ORDER N Field Order in Database
DCFLD_POPUP C 100* PopUp Code Block. Must return a
value that is the same type as
the field. This code block
receives the value of the GET as
a parameter. The code block is
evaluated when the user clicks on
the PopUp button next to the GET.
Description:
DC_FieldEdit() is a field definition editor that maintains
the definition of each database field and their browsing,
editing and validation properties. The field definitions
are stored to an array and/or the DCFIELDS.DBF data-
dictionary file.
DC_FieldEdit() will also update the structure of a database
if a field definition has been changed and retain all
existing data even if a field type or name has been changed.
Notes:
The DCFIELDS.DBF database and its associated indexes will
be created by DC_FieldOpen() if they do not already exist.
Examples:
-- Example 1 --
// Load a field group from the dictionary and edit it //
DC_FIELDEDIT()
-- Example 2 --
// Edit field group "CUSTOMER"
DC_FIELDEDIT("CUSTOMER")
-- Example 3 --
// Edit a field group array //
aFieldGroup := DC_FieldPick()
aFieldGroup := DC_FIELDEDIT( aFieldGroup )
Source/Library:
_DCFLDS.PRG, DCLIP1.LIB
See Also:
dc_fieldload()
dc_fieldvalidate()
dc_fieldload()
Load a field Group Array from the Field Dictionary
Syntax:
DC_FieldLoad ( [< cGroupName >], ;
[< lCache >], ;
[< lMessage >], ;
[< lCreateDbf >], ;
[< lErrorOk >], ;
[< lImport >] ) - > aFieldGroup
Arguments:
< cGroupName > is the name of the field group in DCFIELDS.DBF
to load (up to 8 characters). If no parameter is passed, a
pick-list of all Field Groups in the DCFIELDS.DBF dictionary
will be displayed.
< lCache > if .TRUE. (default) will save the group to a static
(cache) array so the next time it is requested it will
be reloaded from the cache for faster speed. If .FALSE. then
it will not be saved to the static array.
< lMessage > if .TRUE. (default) will display an error message
if the Field Group could not be loaded or does not exist
in the dictionary file. If .FALSE, then no error message
will be displayed.
< lCreateDbf > if .TRUE. (default) will create any empty
DCFIELDS.DBF if it cannot be found. If .FALSE. the
database will not be created.
< lErrorOk > if .FALSE. (default) will return a NIL if the
field array being loaded does not match the structure of the
currently selected database. If .TRUE. then the field array
loaded from the dictionary will always be returned.
< lImport > if .TRUE. will attempt to load the array from a
an import file named DXFIELDS.DBF. If .FALSE. (default) then
the array will be loaded from the standard DCFIELDS.DBF
dictionary.
Returns:
An array consisting of 2 sub-arrays:
See the RETURNS section of DC_FieldEdit() for a specification
of this array.
Description:
DC_FieldLoad() is used to retrieve a field group from the
DCFIELDS.DBF field group dictionary and store it to an array.
Notes:
The DCFIELDS.DBF database and its associated indexes will
be created by DC_FieldOpen() if they do not already exist.
Examples:
aFieldGroup := DC_FIELDLOAD()
aFieldGroup := DC_FieldEdit( aFieldGroup )
DC_FieldSave( aFieldGroup )
Source/Library:
_DCFLDS.PRG, DCLIP1.LIB
See Also:
dc_fieldedit()
dc_fieldvalidate()
dc_fieldsave()
dc_fieldpick()
Choose a field group or browse the field group dictionary
Syntax:
DC_FieldPick ( [< cTitle >], ;
[< lImport >], ;
[@< aGroupList >], ;
[< lNoPick >] ) - > cGroupName
Arguments:
< cTitle > is the title to display in the pick list window.
< lImport > if .TRUE. will display the list of field groups in
the DXFIELDS.DBF (import) dictionary, otherwise the list will
come from the DCFIELDS.DBF dictionary.
@< aGroupList > is a variable, passed by reference, to store an
array of all group names and descriptions.
< lNoPick > if .TRUE. is used in conjunction with
< aGroupList >.
This is used to only return the array of Group names and not
display the picklist.
Returns:
A Character string containing the name of the chosen group.
This will contain a null string if <þlNoPickþ> is .TRUE. or if
the operator aborts the choice.
Description:
DC_FieldPick() is used to pop up a list of field groups in the
field group dictionary.
Notes:
The DCFIELDS.DBF database and its associated indexes will
be created by DC_FieldOpen() if they do not already exist.
Examples:
cFieldGroup := DC_FieldPick()
aFieldGroup := DC_FieldLoad(cFieldGroup)
aFieldGroup := DC_FieldEdit( aFieldGroup )
DC_FIELDSAVE( aFieldGroup )
Source/Library:
_DCFLDS.PRG, DCLIP1.LIB
See Also:
dc_fieldedit()
dc_fieldload()
dc_fieldsave()
dc_fieldsave()
Save a Field Group Array to the Field Dictionary
Syntax:
DC_FieldSave ( < aFieldGroup >, ;
[< lExport >] ) - > lStatus
Arguments:
< aFieldGroup > is a field group array that conforms to the
specification in the RETURNS section of DC_FieldEdit().
< lExport > if .TRUE. will save the field group to a file named
DXFIELDS.DBF, otherwise it will be save to DCFIELDS.DBF.
Returns:
A logical .TRUE. if the field group was successfully saved,
.FALSE. otherwise.
Description:
DC_FieldSave() is used to save a field array to the DCFIELDS.DBF
field group dictionary.
Notes:
The DCFIELDS.DBF database and its associated indexes will
be created by DC_FieldOpen() if they do not already exist.
Examples:
aFieldGroup := DC_FieldLoad()
aFieldGroup := DC_FieldEdit( aFieldGroup )
DC_FIELDSAVE( aFieldGroup )
Source/Library:
_DCFLDS.PRG, DCLIP1.LIB
See Also:
dc_fieldedit()
dc_fieldvalidate()
dc_fieldload()
dc_fieldvalidate()
Validate a value in a field during data entry
Syntax:
DC_FieldValidate ( < xFieldGet >, ;
< aFields >, ;
< nPos >, ;
[< lPopUp >] ) - > lValid
Arguments:
< xFieldGet > is the value to validate. This is the value from
the data entry GET.
< aFields > is a field array that conforms to the specification
for a field array created by DC_FieldEdit(). The field array
defines all the properties of all fields for the currently
selected work area including validation types and formulas.
< nPos > is the field position in the Field Array that points to
the field being validated.
< lPopUp > if .TRUE. will force picklists to be displayed even if
the field validates correctly.
Returns:
A logical .TRUE. if the field validates, otherwise a logical
.FALSE.
Description:
DC_FieldValidate() is used to validate the value entered into
a field during data entry. Validation types are entered in the
field editor using DC_FieldEdit().
Notes:
Validation Types:
Validations are entered as formulas. Each validation type
requires a different formula. A formula is simply a list of
parameters separated by the vertical bar | character. The
Validation type and formula are entered into the Field Array
by using the Field Editor : DC_FieldEdit() or the dot prompt
command FIELD EDIT.
An easier method of entering the formula and preventing mistakes
is to use the FORMULA EDITOR by pressing CTRL-ENTER or clicking
on the PopUp button after the formula field in the field editor.
==============================================================
VALIDATION TYPE X - Expression
Validation type "X" is used to evaluate an expression that
returns a logical .TRUE. or .FALSE. based on the operator
input and/or other field data. When entering the VALIDATION
FORMULA, it must be a valid expression that when macro-expanded,
returns a "logical" value of .TRUE. for a valid entry or a
.FALSE. for an invalid entry.
For example you may have a field named "HOURS" that is allowed
to have a range of 0-4 when the DATE field has a week-end date
or a range of 0-8 when the DATE field has a weekday date.
The expression for creating this type of validation is:
IIF(DOW(DATE)=1.OR.DOW(DATE)=7,HOURS<þ=4,HOURS<þ=8)
If the operator attempts to enter more than 8 hours for a
weekday or more than 4 hours for a weekend, a message similar
to the following will appear:
"Invalid Input. Must meet following Condition"
==============================================================
VALIDATION TYPE V - Browse Lookup
Validation type "V" is used to seek a value from another
database based on a passed value and then optionally choose a
value from a BROWSE pick-list whose configuration was previously
created and stored in the DCBROWSE.DBF Browse Catalog using the
BROWSE editor.
If the entered value already matches a "seek" value in the
target database, or if the "allow override" flag is "YES",
then the database browse will not be displayed unless the
operator clicks on the popup button at the end of the field
when in data-entry mode or presses CTRL-ENTER when editing the
field. A "V" validation also provides for moving data between
fields of different databases upon completion of the successful
validation by referencing a previously created "Field Map".
Param 1 - The TAG NAME of the "Look-Up" FILE GROUP that must be
opened for performing this validation. This must be a
valid File Group Name in the DCFILES.DBF database that
was assigned by the FILE EDITOR via the command
"FILE EDIT" or the function "DC_FILEEDIT()". A FILE
GROUP is a set of database files, indexes and/or
relations required to perform the validation. If no
TAG NAME is entered, then it is assumed that the
"Look-Up" file is already opened.
Param 2 - The TAG NAME of the "Look-Up" BROWSE CONFIGURATION to
use for choosing a record from the target (Look-Up)
database(s). This must be a valid Browse Configuration
in the DCBROWG.DBF database that was assigned by the
BROWSE EDITOR from the command "BROWSE GUI" or the
function "DC_BrowseGuiDb()". If NO Tag Name is entered,
then a DEFAULT BROWSE will be created for the target
(Look-Up) database that will consist of all database
fields.
Param 3 - The FILE ALIAS of the "Look-Up" File to select for
performing the validatiion.
Param 4 - The SEARCH INDEX NUMBER of the controlling index to
use when "seeking" to the record in the "Look-Up"
database. The key of this index must match the value
of the Look-Up field or Expression to seek the value.
Param 5 - The LOOK-UP FIELD OR EXPRESSION to use for extracting
the value to "seek" in the "Look-Up" database. This
expression must return a value of the same type as
the index key of the controlling index to seek the
value.
Param 6 - The RETURN FIELD OR EXPRESSION to use for extracting
the value to return into the field being validated.
This expression must return a value of the same type
as the database field being validated.
Param 7 - START SCOPE Expression or Code Block. This is an
optional expression or code block that when evaluated
returns a value that matches the type of the selected
index for the top scope value or first record to be
displayed in the browse window.
Param 8 - STOP SCOPE Expression or Code Block. This is an
optional expression or code block that when evaluated
returns a value that matches the type of the selected
index for the bottom scope value or last record to be
displayed in the browse window.
Param 9 - A Y for YES or N for NO to establish whether or not
the operator is allowed to OVERRIDE the value returned
from the browse. If YES and the operator presses
ESCAPE, then nothing is returned, otherwise if NO
then the selected value is returned regardless of the
method of exiting the browse by the operator.
Param 10 - The 'optional' FIELD MAP TAG NAME to use for moving
information from the Look-Up database to the current
database or from any other open database to any other
open database. This must be a valid field map tag name
that exists in the DCMAPS.DBF database which is
maintained by the command "FMAP EDIT" or the function
"DC_FMAPEDIT()".
Param 11 - The 'optional' FIELD NAME to extract information to
pass to the FIELD MAP as the FIELD MAP SUBGROUP. Only
the items in the Field Map that match the value in this
field will be evaluated when performing the mapping
process. This parameter is ignored if parameter 9 is
empty.
NOTE: A type "V" validation will leave the Look-up database
record pointer at the record selected by the operator
or at the record automatically found that matches the
data entered in the field. This record can then be used
to transfer information from any set of fields in the
Look-Up database to any set of fields in the current
database by using a type "A" validation on each field.
An easier method of entering the formula and preventing mistakes
is to use the FORMULA EDITOR by pressing CTRL-ENTER, clicking
the popup button or leaving the formula empty. The FORMULA
EDITOR reads the existing formula and provides a series of data-
entry fields and pick-lists to simplify the creating of
validations.
Example:
Look-up Files Tag :CUSTOMER :
Look-up Browse Tag :CUSTOMER1 :
Look-up File Alias :CUSTOMER :
Look-up Index # : 2:
Look-up Field/Expr :CUST_NMBR :
Return Field/Expr :CUST_NMBR :
Start Scope : {||INVOICE-þ>CUST_NMBR}
Stop Scope : {||INVOICE-þ>CUST_NMBR}
Allow Override? :N:
==============================================================
VALIDATION TYPE T - Code Table Lookup
Validation type "T" is used to choose a value from a code
table in the DCCODES.DBF Code-Table dictionary and enter it
into the field. If the entered value already matches a
value in the code table, or if the "allow override" flag is
"YES", then the pick-list of codes will not be displayed
unless the operator clicks on the popup button at the end of
the field or presses CTRL-ENTER when editing the field.
A "T" validation also provides for moving data between fields
of different databases upon completion of the successful
validation by referencing a previously created "Field Map".
Example of a Code-Table table:
1B First Base
2B Second Base
3B Third Base
P Pitcher
SS Short Stop
RF Right Field
LF Left Field
CF Center Field
C Catcher
DH Designated Hitter
When the operator chooses an item from the code-table pick-list,
the value in the CODE field of the DCCODES.DBF database item
selected will be returned into the data field. Code-Tables
are allowed only for validating character-type fields.
Param 1 - The CODE TABLE name to open.
Param 2 - A Y for YES or N for NO to establish whether or not
the operator is allowed to OVERRIDE the value returned
from the browse. If YES and the operator presses
ESCAPE, then nothing is returned, otherwise if NO
then the selected value is returned regardless of the
method of exiting the pick-list by the operator.
Param 3 - An 'optional' FIELD MAP TAG NAME to use for moving
information from the Code Table database to the current
database or from any other open database to any other
open database. This must be a valid field map tag name
that exists in the DCMAPS.DBF database which is
maintained by the command "FMAP EDIT" or the function
"DC_FMAPEDIT()". The value returned by the code table
will be passed to the Field Mapping routine to select
a mapping "Sub-Group". If the Map data does not
include Sub-Groups, then all items in the map will be
evaluated.
Param 4 - TOKENIZED LIST. Enter a Y if you want each pick from
the code table to be appended to the value in the GET
as a list of tokens rather than replacing the value
in the GET with the selected code.
Param 5 - Enter the delimeter to use between the tokens.
NOTE: A type "T" validation will leave the DCCODES.DBF database
(code-table) record pointer at the selected code table
record. This record can then be use to transfer the
value in CODE_DESC to any other field using a type "A"
validation.
Example:
Code Table No. :BASEBALL :
Allow Override? :N:
Field Map Tag : :
Tokenized List? : Y
Token Delimiter : ,
==============================================================
VALIDATION TYPE R - Range
Validation type "R" is used to validate that the entered
field value falls between a specified range of values. If
the operator fails to enter a proper value, an error message
similar to "Entry must be in the Range between 100 and 500"
will be displayed and the operator will not be allowed to
exit the field other than by entering a correct value or
pressing ESCape.
Example :
Starting Range :100 :
Ending Range :500 :
==============================================================
VALIDATION TYPE P - Program
Validation type "P" is used to validate a field entry based
on the results returned by executing a specified program.
The program may be a function that is linked into the
.EXEcutable engine or an "interpreted" program that exists
in the DCPROG.DBF program catalog. The program may return
a value to place into the field or a logical value to validate
proper data input.
To create a type "P" validation, enter "P" as VALIDATION TYPE
when using the FIELD EDITOR via the command "FIELD EDIT" or
function "DC_FIELDEDIT()". When entering the VALIDATION FORMULA,
each formula item is separated by a vertical bar | character.
Item 1 - The PROGRAM NAME. This is a program name of up to
10 characters. This program must exist in the
DCPROG.DBF Program Catalog. To create or maintain
this program use the command "PROGRAM MAINTENANCE"
or the function "DC_PROGMAINT()". If you wish to
use a compiled and linked function rather than an
interpreted program, then include parenthesis ()
after the PROGRAM NAME. If you wish to write a
small program and save it in the memo field of the
field dictionary enter "MEMO".
Item 2 - Enter Y for YES or N for NO if this is a LOGICAL
validation rather than a return value. A LOGICAL
validation returns a .TRUE. or .FALSE. to validate
whether or not the data-entry was valid. If a
.FALSE. is returned, then the operator will not be
allowed to move to the next field until a valid
input is received. If a NO is entered, then it is
assumed that the program is returning a value that
is the same type as the field being validated and
that this value will be placed into the field.
Items 3 thru 17 - Enter up to 15 PARAMETERS to pass to the
program. These may be literal values, functions,
field names, or expressions. Each value in each item
will be macro-expanded before being passed on to the
program.
==============================================================
VALIDATION TYPE I - Increment on Append
Validation type "I" is used to assign a default value to a
field, when appending a new record to the database, that is
equivalent to an "incremented" value extracted from another
field in the same database or any other database. For example,
if you wish to automatically assign a new invoice number to
a new record, a type "I" validation can be used to go to the
last record of the file, extract the last invoice number,
increment it by a value of 1 and store the new value in the
field. Type "I" validations will increment both character
and numeric fields.
Examples:
Type Last Value Incremented Value
---- ---------- -----------------
N 2345 2346
C 56710 56711
C AX-389-BL AX-390-BL
Param 1 - The FILE ALIAS NAME of the "Look-Up" FILE that must be
opened for extracting the last value. This must be a
valid ALIAS for a file that is already opened when the
record is being added. Leave this parameter empty
if extracting a value from the last record in the
current database.
Param 2 - The LOOK-UP FIELD OR EXPRESSION to use for extracting
the value to "seek" in the "Look-Up" database. This
expression must return a value of the same type as
the index key of the controlling index to seek the
value. Leave this parameter empty if extracting a
value from the last record in the current database
or if the record is already at the correct location,
such as a 1-record "SYSTEM.DBF".
Param 3 - The RETURN FIELD OR EXPRESSION to use for extracting
the value to return and increment into the field being
initialized. This expression must return a value of the
same type as the database field being validated. Leave
this parameter empty if extracting a value from the
last record in the current database. If not extracting
a value from the current database, then the new value
will be stored in the return field of the related
database in addition to the storing in the validated
field of the current database.
Param 4 - The SEARCH INDEX NUMBER of the controlling index to
use when "seeking" to the record in the "Look-Up"
database. The key of this index must match the value
of the Look-Up field or Expression to seek the value.
Leave this as 0 if the record in the Look-up database
does not need to be seeked.
Param 5 - The DEFAULT or STARTING value to enter into the
database field in the event that an empty value is
returned from the target (Look-Up) database.
Example :
Lookup File Alias :DCFILES :
Lookup Field/Expr :"INVOICE" :
Return Field/Expr :REF_NO :
Seek Index No. : 1:
Start Value : IN-10001 :
==============================================================
VALIDATION TYPE F - Calculate value from Expression
Validation type "F" is used to calculate a value from an
expression that includes references to other fields in the
database and automatically insert the value returned by
the expression. Use a type "F" validation to update "non-
entry" fields whenever the value in another field changes.
When entering the VALIDATION FORMULA, it must be a valid
expression that when macro-expanded, returns a value of the
same "type" as the field being validated.
For example you may have a field named "HOURS" that is
automatically filled-in whenever the operator changes the value
of another field named "MINUTES". The expression for creating
this type of calculation is: MINUTES/60.
Example :
Formula :MINUTES/60 :
==============================================================
VALIDATION TYPE C - Choice from Pick List
Validation type "C" is used to choose a value from a pick-list
table of up to 15 choices. If more than 15 choices are
required, then use Validation type "T". If the entered value
already matches a value in the choice pick-list, or if the
"allow override" flag is "YES", then the pick-list of choices
will not be displayed unless the operator clicks on the popup
button at the end of the field or presses CTRL-ENTER when
editing the field.
When the operator chooses an item from the pick-list, the number
of characters in the chosen item will be truncated (cut-off) to
the length of the field. Choice Pick-lists are allowed only for
character-type fields.
Example:
Choice # 1 :1B - First Base :
Choice # 2 :2B - Second Base :
Choice # 3 :3B - Third Base :
Choice # 4 :P - Pitcher :
Choice # 5 :SS - Short Stop :
Choice # 6 :RF - Right Field :
Choice # 7 :LF - Left Field :
Choice # 8 :CF - Center Field :
Choice # 9 :C - Catcher :
Choice #10 :DH - Designated Hitter :
Choice #11 : :
Choice #12 : :
Choice #13 : :
Choice #14 : :
Choice #15 : :
Allow Override? :Y:
==============================================================
VALIDATION TYPE A - AutoFill
Validation type "A" is used to automatically fill the
field with a value from a relational file after the
operator entered data in an associated field in the field
list. A type "A" validation is also referred to as
"AUTOFILL" and must also be associated with a type "V"
"D", or "T" validation elsewhere in the data-field table.
AUTOFILL validations are "triggered" by a "V", "D", or "T"
validation in the following manner:
1. The operator chooses a record from a relational file
or a code table while validating a field that has a
type "V" or "T" validation. After the data record is
selected from the relational file, a pointer to the
relational file is stored away in a variable, the
relational file remains open, and the record pointer in
the relational file is pointing to the selected record.
2. The field list is then scanned to see if there are any
fields with type "A" validations that also have a
reference to the field name that triggered the "V" or "T"
validation. For each field that has a reference, the
data from the specified relational file field will be
written to that field.
Fields that have been filled by an AUTOFILL validation may
be overwritten when the field is entered provided that it
is an "editable" field.
Param 1 - The name of the field in the field list that triggered
the AUTOFILL with a type "V" or "T" validation.
Param 2 - The name of the field in the relational file chosen
by the type "V" or "T" validation that contains the
data to be written to this field. If the "V" or
"T" validation uses only a single relational file
then it is not necessary to use the alias in front
of the field name, however, it is always a good
idea.
Example:
Lookup Field/Expr :CUST_NMBR :
Return Field/Expr :CUSTOMER-þ>NAME :
Examples:
FUNCTION XTest()
/* This example shows how to use the field dictionary to
display a data-driven browse and data-entry screen */
LOCAL GetList := {}, i, aFieldGroup, oBrowse, cAlias, aFieldOpt, ;
aFieldItems, oTabPage1, oTabPage2, oTabPage2Static, bGetSet, ;
bKeyBlock, bPopUp, GetOptions, bCompile
DC_FileRest('COLLECT')
aFieldGroup := DC_FieldLoad('COLLECT')
aFieldOpt := aFieldGroup[1]
aFieldItems := aFieldGroup[2]
cAlias := 'COLLECT'
@ 0,0 DCTABPAGE oTabPage1 SIZE 84,18 CAPTION 'Browse' ;
GOTFOCUS {||oBrowse:RefreshAll()}
@ 0,0 DCTABPAGE oTabPage2 RELATIVE oTabPage1 CAPTION 'Edit' ;
STATICAREA oTabPage2Static ;
GOTFOCUS {||DC_RecLock(), ;
DC_GetRefresh(GetList)}
@ 2,2 DCBROWSE oBrowse SIZE 80,15 ALIAS 'COLLECT' ;
PRESENTATION DC_BrowPres() PARENT oTabPage1
FOR i := 1 TO Len(aFieldItems)
bCompile := DC_GetBlock(aFieldItems[i,DCFLD_COMPILE])
IF Valtype(bCompile) = 'B' .AND. !Eval(bCompile)
LOOP
ENDIF
DCBROWSECOL DATA &('{||' + cAlias + '->' + ;
aFieldItems[i,DCFLD_NAME] + '}') ;
PARENT oBrowse HEADER aFieldItems[i,DCFLD_DESC] ;
MESSAGE aFieldItems[i,DCFLD_PROMPT] ;
PROTECT aFieldItems[i,DCFLD_PROTECT] ;
WHEN aFieldItems[i,DCFLD_WHEN] ;
FONT aFieldItems[i,DCFLD_FONT] ;
HELPCODE aFieldItems[i,DCFLD_HELPCODE]
IF aFieldItems[i,DCFLD_TYPE] = 'M'
bGetSet := 'MEMO'
bKeyBlock := {|a,b,o|o:undo()}
bPopUp := MemoBlock(i,cAlias,aFieldItems[i,DCFLD_DESC])
ELSE
bGetSet := DC_FieldWBlock(aFieldItems[i,DCFLD_NAME],cAlias)
bKeyBlock := nil
IF !Empty(aFieldItems[i,DCFLD_POPUP])
bPopUp := aFieldItems[i,DCFLD_POPUP]
ELSEIF aFieldItems[i,DCFLD_VALTYPE] $ 'TCVD' // table, choice, view,
datapick
bPopUp := PopupBlock(i,aFieldItems)
ELSEIF aFieldItems[i,DCFLD_TYPE] = 'D'
bPopUp := {|d|DC_PopDate()}
ELSE
bPopUp := nil
ENDIF
ENDIF
@ i-.5,2 DCSAY aFieldItems[i,DCFLD_DESC] ;
GET bGetSet ;
POPUP bPopUp ;
PARENT oTabPage2Static ;
KEYBLOCK bKeyBlock ;
PICTURE aFieldItems[i,DCFLD_PICT] ;
MESSAGE aFieldItems[i,DCFLD_PROMPT] ;
EDITPROTECT aFieldItems[i,DCFLD_PROTECT] ;
WHEN aFieldItems[i,DCFLD_WHEN] ;
VALID ValidBlock(i, aFieldItems, ;
aFieldItems[i,DCFLD_VALTYPE],aFieldItems[i,DCFLD_VALID],cAlias) ;
HELPCODE aFieldItems[i,DCFLD_HELPCODE] ;
GETFONT aFieldItems[i,DCFLD_FONT]
NEXT
@ 18,0 DCMESSAGEBOX TYPE XBPSTATIC_TYPE_RECESSEDBOX ;
FONT '12.Arial Bold' COLOR GRA_CLR_DARKBLUE ;
SIZE 84,1.2
DCGETOPTIONS SAYWIDTH 150 SAYRIGHT AUTORESIZE
DCREAD GUI FIT ADDBUTTONS MODAL ;
TITLE aFieldOpt[DCFLDGROUP_DESC] ;
CLEAREVENTS ;
OPTIONS GetOptions ;
EVAL {|o|SetAppWindow(o)}
RETURN nil
* -----------------------------
STATIC FUNCTION MemoBlock( i, cAlias, cDesc )
RETURN {|c,x|x:=(cAlias)->(FieldGet(i)), ;
x:=DC_MemoBase(x,{,,,,,,,,,,,,,'Editing Memo: ' + cDesc}), ;
FieldPut(i,x),c}
* -----------------------------
STATIC FUNCTION PopUpBlock( i, aFieldItems )
RETURN {|c|DC_FieldValidate(@c, aFieldItems, i, .t. ),c}
* -----------------------------
STATIC FUNCTION ValidBlock( i, aFieldItems, cValtype, cFormula, cAlias )
IF Empty(cValtype)
RETURN cFormula
ENDIF
RETURN {||DC_FieldValidate( (cAlias)->(FieldGet(i)),
aFieldItems, i ) }
*
Source/Library:
_DCFLDSV.PRG, DCLIP1.LIB
See Also:
dc_fieldload()
dc_fieldwblock()
A replacement for FieldWBlock() for debugging
Syntax:
DC_FieldWBlock( < cFieldName >, ;
[< cAlias >] ) - > bGetSet
Arguments:
< cFieldName > is a character string containing the name of the
field whose data the code block will read or modify.
< cAlias > is a character string containing the alias name for
the work area holding the field which the code block will
access. If this parameter is NIL then the alias of the current
work area will be used.
Description:
DC_FieldWBlock() is a debugging replacement for the Xbase++
function FieldWBlock().
The code block function FieldWBlock() creates a code block
providing (when it is evaluated) read and write access to a
field in the specified work area. If no value is passed to the
code block when it is evaluated, the current value from the
field <þcFieldNameþ> is read and returned. Otherwise, the code
block writes the passed value into the field and returns this
new value.
When FieldWBlock() is called, no file needs to be opened in the
specified work area. However, when the code block is evaluated,
the file containing the field the code block is accessing must
be open. If the field <þcFieldNameþ> does not exist when the code
block is evaluated, a runtime error occurs.
The replacement function DC_FieldWBlock() includes a call to a
debugging function which echoes call stack information and
read/write information into a debug window whenever the codeblock
is evaluated. Debugging event driven programs that use Get/Set
codeblocks can be cumbersome. Often times a Get/Set codeblock
may be called more times than desired thereby affecting performance.
This is usually the case when refreshing systems are used. The
display of debugging info is enabled and/or disabled by the
DC_FieldWDebug() function.
Examples:
/* In this example, every time the field COLLECT->TYPE
is updated during cell-editing, information about
the field will be echoed to the debug window */
FUNCTION Xtest()
LOCAL GetList := {}, oBrowse
USE COLLECT VIA DBFNTX
DC_FieldWDebug(.t.,'TYPE',.t.)
@ 0,0 DCBROWSE oBrowse ALIAS 'COLLECT' SIZE 50,9 ;
EDIT xbeBRW_ItemSelected
DCBROWSECOL DATA DC_FieldWBlock( 'descrip', 'collect' ) ;
PARENT oBrowse WIDTH 20 HEADER 'Description'
DCBROWSECOL DATA DC_FieldWBlock( 'type', 'collect' ) ;
PARENT oBrowse WIDTH 10 HEADER 'Type'
DCREAD GUI FIT ADDBUTTONS
RETURN nil
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_fieldwdebug()
dc_fieldwdebug()
Enable debug window for Get/Set field code blocks
Syntax:
DC_FieldWDebug( < lDebugOn >, ;
[< cFieldName >], ;
[< lWriteOnly >] ) - > lStatus
Arguments:
< lDebugOn > is a logical .TRUE. to turn the debug window ON, a
logical .FALSE. to turn it OFF.
< cFieldName > is an optional character string. This is the name
of a field to debug when there are many code blocks that all
use DC_FieldWBlock() and you only want to see Get/Set transactions
that relate to a specific field, otherwise all Get/Set transactions
will be echoed to the debug window.
< lWriteOnly > is an optional logical value. Set this to .TRUE.
if you want to only see Get/Set transactions that write to the
field.
Returns:
NIL.
Description:
DC_FieldWDebug() is used to establish the debugging mode when
using DC_FieldWBlock() for creating Get/Set code blocks.
Examples:
/* In this example, every time the field COLLECT->TYPE
is updated during cell-editing, information about
the field will be echoed to the debug window */
FUNCTION Xtest()
LOCAL GetList := {}, oBrowse
USE COLLECT VIA DBFNTX
DC_FieldWDebug(.t.,'TYPE',.t.)
@ 0,0 DCBROWSE oBrowse ALIAS 'COLLECT' SIZE 50,9 ;
EDIT xbeBRW_ItemSelected
DCBROWSECOL DATA DC_FieldWBlock( 'descrip', 'collect' ) ;
PARENT oBrowse WIDTH 20 HEADER 'Description'
DCBROWSECOL DATA DC_FieldWBlock( 'type', 'collect' ) ;
PARENT oBrowse WIDTH 10 HEADER 'Type'
DCREAD GUI FIT ADDBUTTONS
RETURN nil
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_fieldwblock()
dc_filearray()
Capture work area(s) to a file definition array
Syntax:
DC_FileArray ( [< lAllAreas >] ) - > aFileGroup
Arguments:
< lAllAreas > if .TRUE. (default) will also include all the
files in all open work areas, otherwise only the files in the
currently selected area will be returned in the array.
Returns:
An array consisting of three sub-arrays:
Sub-array #1 is an array of two elements: Element #1
contains the ALIAS() of the current work area and element
#2 is a null string.
Sub-array #2 is a 2-dimensional array consisting of one
sub-array for each file, index or relation. See RETURNS in
the documentation of DC_FILEEDIT() for a definition of this
array.
Sub-array #3 is a set of 3 sub-arrays:
Element #1 is an array containing the current Browse
configuration of all work areas (DCBROWSE).
Element #2 is an array containing the current Edit
configuration of all work areas (DCEDIT).
Element #3 is an array containing the current Import
configuration of all work areas (DCIMPORT).
Description:
DC_FILEARRAY() will return a file definition array of
file information captured from the current work area. A
file definition array is used to define files, indexes and
relations for later restoring the work areas from the
contents of the array.
Examples:
use customer shared readonly
set index to custname, custnmbr
aFileGroup := DC_FILEARRAY()
Source/Library:
_DCFILES.PRG
See Also:
dc_fileedit()
dc_filerest()
dc_filecompare()
Compares the contents of two files
Syntax:
DC_FileCompare( < cFile1 >, < cFile2 > ) - > lStatus
Arguments:
< cFile1 > and < cFile2 > are the full path names of the two
files
to compare.
Returns:
A logical .TRUE. if the files are identical, .FALSE. otherwise.
Description:
DC_FileCompare() is used to do a byte by byte comparison of the
contents of two files.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_filecopy()
Copy or move a set of files to a common location
Syntax:
DC_FileCopy( < aFile >, ;
< cToPath >, ;
< aMessage >, ;
@< aErrors >, ;
< lMove > ) - > lStatus
Arguments:
< aFile > is a single-dimensional array of fully-pathed file names.
< cToPath > is the full path of the directory that receives the files.
< aMessage > is a single-dimensional array of message strings to
display
in the dialog window.
@< aErrors > is an array that receives error information.
< lMove > if .TRUE. will MOVE the files to the new location, otherwise
they will be copied.
Returns:
A logical .TRUE. if all files were successfully copied or moved, .FALSE.
otherwise.
Description:
DC_FileCopy() is used to copy or move a set of files to a common location.
This function displays a dialog window with a progress bar and an option
to cancel the copy or move.
This function is handy when there are a set of very large files that
could take a lot of time to copy or move across a network path.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_filedel()
Delete a file group from the DCFILES.DBF dictionary
Syntax:
DC_FileDel( [< cFileGroup >] ) - > lStatus
Arguments:
< cFileGroup > is the name of the file group in DCFILES.DBF
to delete (up to 8 characters).
Returns:
A logical .TRUE. if the file group was successfully deleted.
Description:
DC_FileDel() is used to delete a file group from the DCFILES.DBF
file dictionary.
Examples:
// Delete the file group named JUNK
DC_FileDel('JUNK')
Source/Library:
_DCFILES.PRG
See Also:
FILE DELETE
dc_fileedit()
dc_fileedit()
A Database File / Work area Definition editor
Syntax:
DC_FileEdit( [< acFileGroup >] ) - > aFileGroup
Arguments:
< acFileGroup > is the name of the file group in DCFILES.DBF
to load and edit (up to 8 characters) or < acFileGroup > is a
File Group array. See RETURNS for a specification of this
array. If no parameter is passed, a pick-list of all File
Groups in DCFILES.DBF will be displayed.
Returns:
An array consisting of 2 sub-arrays:
See DCFILES.CH for the definitions of the array elements.
Sub-array #1 contains general information about this file
group.
* - Maximum Length allowed, Minimum Length is 0
Element Type Len Description
------------- ---- --- ------------------------------
DCFILE_GROUPNAME C 8* File Group Name
DCFILE_GROUPDESC C 50* File Group Description
DCFILE_GROUPDEFA C 100* Default Directory for files
Sub-array #2 contains one sub-array for each file, index
or relation definition.
Element Type Len Description
------------- ---- --- --------------------------------
DCFILE_TYPE C 1 Item Type
E - Open Database exclusive
S - Open Database shared
I - Open Index
R - Set a relation
F - Open a File Group
DCFILE_NAME C 150* File Name
DCFILE_DESC C 50* Description of File
DCFILE_ALIAS C 10* Alias Name
DCFILE_RELALIAS C 10* Relational Alias Name
DCFILE_FIELD1 C 10* Relational Field
DCFILE_KEY C 300* Index Key Expression
DCFILE_RECNO N Database record to select
DCFILE_FILTER C 500* Database filter expression
DCFILE_RDD C 10* Name of RDD (Data-Driver to use)
DCFILE_SUPERRDD C 10* Name of SUPER RDD (Data-Driver)
DCFILE_INDEXNO N Index Order to select
DCFILE_TAGNAME C 10* Index Tag Name to select
DCFILE_INDEXFOR C 500* Index Condition expression
DCFILE_DESCEND L Descending Index - .T.
DCFILE_UNIQUE L Unique Index - .T.
DCFILE_ISCDX L Combined Index - .T.
DCFILE_BROWSE C 10* Browse Configuration Name
DCFILE_EDIT C 10* Edit (Data-Entry) Configuration
DCFILE_IMPORT C 10* Import Configuration
DCFILE_DICT C Unused (reserved)
Description:
DC_FILEDEDIT() is an editor that maintains the definition of
each database and it's indexes and relations.
Each file group is stored in the DCFILES.DBF dictionary file.
A file group contains all the information necessary to
restore work areas for editing and browsing. The data
dictionary contains information for opening databases and
indexes (or creating indexes that do not exist).
Examples:
-- Example 1 --
// Load a file group from the dictionary and edit it //
DC_FILEEDIT()
-- Example 2 --
// Edit file group "CUSTOMER"
DC_FILEEDIT("CUSTOMER")
-- Example 3 --
// Edit a file group array //
aFileGroup := DC_FilePik()
aFileGroup := DC_FILEEDIT( aFileGroup )
Source/Library:
_DCFILES.PRG
See Also:
dc_filerest()
dc_fileimp()
Import File Group(s) from the Import File Dictionary
Syntax:
DC_FileImp ( [< cFileGroup > | "ALL"] ) - > lStatus
Arguments:
< cFileGroup > is the name of the file group. This is a name of
up to eight (8) digits. If a group name is passed then
the DXFILES.DBF database will be searched and all group
items that match the group name be imported into DCFILES.DBF.
If no name is passed, then a pick-list of all file groups stored
in the DXFILES.DBF database will be displayed.
If "ALL" is passed as the group name, then all groups in the
DXFILES.DBF will be imported into DCFILES.DBF.
Returns:
A logical .TRUE. if the file group was imported successfully.
Description:
DC_FILEIMP() is used to import file group configurations from a
DXFILES.DBF file into the DCFILES.DBF file.
Notes:
The DCFILES.DBF file is the data-dictionary database that
contains all file group configurations. If this file does not
exist in your default directory or path then it will be created.
The DXFILES.DBF file is the data-dictionary database that contains
all file groups that were exported from another system.
Source/Library:
_DCFILES.PRG
See Also:
dc_fileedit()
dc_filerest()
dc_fileload()
Load a file group array from the file dictionary
Syntax:
DC_FileLoad ( [< cGroupName >], ;
[< lCache >], ;
[< lWorkFile >] ) - > aFileGroup
Arguments:
< cGroupName > is the name of the file group in DCFILES.DBF
to load. If no parameter is passed, a pick-list of all
file Groups in the DCFILES.DBF dictionary will be displayed.
< lCache > if .TRUE. (default) will save the group to
a static array so the next time it is requested it will
be reloaded from the static array (cache) for faster speed.
If .FALSE. then it will not be save to the cache.
< lWorkFile > if .TRUE. will restore the file group from the
currently open database rather than the DCFILES.DBF data
dictionary. The currently open database must have the same
structure as DCFILES.DBF. If .FALSE.(default) then the file
group is restored from the DCFILES.DBF dictionary.
Returns:
A file group array that conforms to the specifications in
the RETURNS section of the function DC_FILEEDIT().
Description:
DC_FILELOAD() is used to retrieve a file (work area) group
from the DCFILES.DBF file group dictionary and store it to an
array.
Examples:
-- Example 1 --
/* Restore Work areas from file dictionary */
DC_FILELOAD( 'CUSTOMER' )
-- Example 2 --
/* Restore and Edit a file group array //
cFileGroup := DC_FilePik()
aFileGroup := DC_FILELOAD( cFileGroup )
aFileGroup := DC_FileEdit( aFileGroup )
Source/Library:
_DCFILES.PRG
See Also:
dc_filerest()
dc_fileedit()
dc_filenamedupe()
Returns the next file name in a series
Syntax:
DC_FileNameDupe( < cFileName > ) - > cNewFileName
Arguments:
< cFileName > is the fully-pathed file name.
Returns:
A character string.
Description:
DC_FileNameDupe() returns the next file name in a series so multiple
files of the same name may be saved in the same directory.
This function is used when saving a file name that may already exist.
For example, if a file named C:\Download\test.prg already exists,
DC_FileNameDupe( "C:\Download\test.prg" ) will return the string:
"C:\Download\test (1).prg".
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_filepik()
Pick a file (work-area) group from the file dictionary
Syntax:
DC_FilePik ( [< cTitle >] ) - > cFileGroup
Arguments:
< cTitle > is the title to display on the pick-list box.
Returns:
A character string.
Description:
DC_FILEPIK() is used to pick the name of a file group from
the File Group (Work Area) dictionary.
Examples:
cFileGroup := DC_FILEPIK()
IF !Empty(cFileGroup)
aFileGroup := DC_FileEdit( cFileGroup )
ENDIF
Source/Library:
_DCFILES.PRG
See Also:
dc_fileload()
dc_fileedit()
dc_filerest()
dc_filerest()
Restore work areas, indexes, relations, from dictionary
Syntax:
DC_FileRest ( < acFileGroup >, ;
[< lAdditive >], ;
[< lExclusive >], ;
[< cTagName >] ) - > lStatus
Arguments:
< acFileGroup > is the name of a file group in the DCFILES.DBF
dictionary or an array that conforms to the specifications of
the array returned by DC_FileEdit().
< lAdditive > is an optional clause which will insure that
currently used work areas are not affected. If a database is
already opened in a work area, it will not be reopened in a new
work area. If the < lAdditive > parameter is not passed, then
all work areas will be closed before restoring the old work.
< lExclusive > if .TRUE. will override the settings in the DCFILES.DBF
file for the file group and open the files EXCLUSIVE. If the
parameter is not passed or is .FALSE., then files will be
opened in the default mode.
< cTagName > if passed as a character string or numeric value will
override the tag name or index order in the DCFILES.DBF file
group.
Returns:
A file group array that conforms to the specifications in
the RETURNS section of the function DC_FILEEDIT().
Description:
DC_FILEREST() is used to restore a complete work area
environment from a the DCFILES.DBF data dictionary. This
function will accomplish the following:
* Re-open all databases, using the required RDD (Replaceable
Data Driver).
* Open all indexes or rebuild indexes that don't exist or have
not been properly updated.
* Set parent-child relations.
* Restore record, index and tag pointers.
* Restore browse windows. (optional)
* Restore filters.
* Restore Database environment such as PATH, DEFAULT, UNIQUE,
etc.
Examples:
use maillist via 'ADSDBE"
index on zip tag zip
index on phone tag phones
use customer via 'ADSDBE' new index custnmbr
use invoice via 'ADSDBE' new index invoice
set relation to cust_nmbr into customer
dc_filesave( nil, nil, .t., 'MYWORK' )
close all
DC_FILEREST( 'MYWORK' )
Source/Library:
_DCFILES.PRG
See Also:
dc_fileload()
dc_fileedit()
dc_filesave()
Save Work area definition array to dictionary
Syntax:
dc_filesave ( [< aFileGroup >], ;
[< lWorkFile >], ;
[< lWorkAreas >], ;
[< cFileGroup >] ) - > lStatus
Arguments:
< aFileGroup > is a file group array that conforms to the
specification of the array returned by DC_FILEEDIT().
< lWorkFile > if .TRUE. will save the file group to the
currently open database rather than the DCFILES.DBF data
dictionary. The currently open database must be empty and
have the same structure as DCFILES.DBF. If .FALSE. (default)
then the file group is saved to the DCFILES.DBF dictionary and
will overwrite any file group with the same name.
< lWorkAreas > if .TRUE. will save the information about
currently open workareas rather than a passed array. The
< aFileGroup > parameter is not needed and will be ignored if
< lWorkAreas > is .TRUE. The default is .FALSE.
< cFileGroup > is needed only if < lWorkAreas > is .TRUE. This
is the name of the file group (up to 8 characters) to assign
to the file group.
Returns:
A logical .TRUE. if the file group was saved to the dictionary,
.FALSE. otherwise.
Description:
DC_FILESAVE() is used to save the contents of a file group
array or the current workareas to the DCFILES.DBF
data-dictionary.
Examples:
-- Example 1 --
/* Save Work areas to file dictionary */
DC_FILESAVE( ,.f.,.t.,'CUSTOMER' )
-- Example 2 --
/* Edit and Save a file group array //
cFileGroup := DC_FilePik()
aFileGroup := DC_FileEdit( cFileGroup )
DC_FILESAVE( aFileGroup )
Source/Library:
_DCFILES.PRG
See Also:
dc_fileload()
dc_fileedit()
dc_filerest()
FILE RESTORE
dc_filock()
Lock the current file
Syntax:
DC_FiLock ( [< nWaitTime >], ;
[< lDisplayError >] ) - > lStatus
Arguments:
< nWaitTime > is the number of seconds to wait for the system to
return a lock before returning the status or the error message.
(0 = wait forever).
< lDisplayError > if .true. will display an operator error
message if the file cannot be locked. (default) or if .false.
will not display an error message to the operator.
Returns:
A logical .TRUE. if the file was successfully locked.
Description:
DC_FILOCK() is used to lock the currently selected file before
attempting to perform database operations that modify the data
in mulitiple records.
Examples:
use customer
if DC_FILOCK( 5 )
replace print_flag with .F. for print_flag
dc_unlock()
endif
Source/Library:
_DCLOCK.PRG, DCLIPX.DLL
See Also:
dc_reclock()
dc_find()
GUI dialog for finding a record using an index
Syntax:
DC_Find() - > lStatus
Arguments:
None.
Returns:
A logical .TRUE. if a new record was selected.
Description:
DC_FIND() is a high-level function that scans all index keys
and creates an input screen to allow the user to find
information by simply typing in the value in the box next to
the associated index key. This is a quick method of finding
information in a database that has multiple index files open or
multiple index tags in a combined index.
After the user enters in the value next to the referenced
index, the database is checked to see if more than one record
matches the entered value. If duplicates are found, then a
pick-list of records is displayed to allow the user to choose
one.
Examples:
. USE EXPRESS VIA FOXCDX INDEX EXPRESS.CDX
. DC_Find()
Source/Library:
_DCFINDX.PRG, DCLIPX.DLL
See Also:
dc_hunt()
FIND
dc_findbrowse()
A browse-window find utility that uses AutoSeek
Syntax:
DC_FindBrowse( < aFields >, ;
[< oParent >], ;
[< nRow >], ;
[< nCol >], ;
[< nWidth >], ;
[< nHeight >], ;
[< cTitle >], ;
[< lAutoSeek >], ;
[< lHeaders >],;
[< lPixel >], ;
[< acbData >], ;
[@< nPointer >], ;
[< bEval >], ;
[< aPres >], ;
[< lHorizScroll >], ;
[< lVertScroll >], ;
[< lExit >], ;
[< nSeekDelay >], ;
[< cFont >], ;
[< lLeftButtonSort >], ;
[< bPopUp >], ;
[< cSayIndexFont >] ) - > lStatus
Arguments:
< aFields > is a multidimensional array that defines the columns
of data to browse.
Element Type Description
------- ----- ---------------------------------------------
[1] B Code Block (ex: {||CUSTOMER- >name})
[2] C Header (ex: "Customer Name")
[3] N Column Width (ex: 10)
[4] C Index Name or Tag (ex: "CUSTNAME")
[5] C Index Prompt (ex: "Customer Name")
[6] C/B Prefix for AutoSeek
[7] B Seek string code block. User input buffer
is passed to this code block and return
value of code block is used for the seek.
ex: {|c|Right(Space(7)+Alltrim(cString),7)}
[8] C Picture clause.
Note: Only elements 1 and 2 are required.
< oParent > is the Parent window to paint the objects. If no
parameter is passed a modal window will be created.
< nRow > and < nCol > are the starting coordinates from the
top
left of the parent window to paint the objects. These are text
based coordinates which may include decimals. If no parent
parameter is passed, these arguments are not needed.
< nWidth > and < nHeight > are the width and height of the
window
in text-based coordinates. The defaults are 65 columns and
15 rows.
< cTitle > is the title to display in the titlebar area of the
dialog window.
< lAutoSeek > if .TRUE. (default) will include a GET for the
user to enter keys to seek automatically. If .FALSE. then only
a browse will be displayed. The prefix value of the selected
column is inserted before the seek string. This may be a code
block or a string. If it is a code block it must return a string
when evaluated.
< lHeaders > if .TRUE. (default) will display headers and a
horizontal scroll bar in the browse. If .FALSE. no headers or
horizontal scroll bar will be displayed.
< lPixel > if .TRUE. assumes coordinates are pixel-based, otherwise
they are text-based.
< acbData > is the data source. If it is a code block it must
return an Alias() or an array when evaluated. If it is an alias
the database must already be opened. If it is an array, the
array must be two-dimensional.
@< nPointer > is a numeric variable (passed by reference) to store
the array element selected when the user double-clicks on the
browse or presses ENTER.
< bEval > is a code block to evaluate after the Browse object is
created and just before invoking the event handler. The parent
dialog object and the browse object are passed as parameters:
{|oDlg,oBrowse|...}
< aPres > is a two-element array of two subarrays. The first
element is a Presentation Parameters array that follows the Xbase++
specification for Browse Presentation parameters. The second
element is a two-element array :
{ aHeaderFG, aHeaderBG }
< aHeaderFG > and < aHeaderBG > are the foreground and
background
colors of the selected column. This is the column selected by
the user for sorting or selecting an index.
< lHorizScroll > if .TRUE. (default) will include a horizontal
scrollbar and allow resizing of columns.
< lVertScroll > if .TRUE. (default) will include a vertical scroll
bar.
< lExit > if .TRUE. will exit without destroying the dialog window.
< nSeekDelay > is the number of seconds after a key is pressed to
wait before performing the seek. This allows a string to be
typed without performing a seek everytime a key is pressed.
The default is .1 seconds.
< cFont > is the font compound name of the font to use for the
browse columns.
< lLeftButtonSort > if .TRUE. will allow the operator to use the
left mouse button on the column headers to select the sort order,
otherwise if .FALSE. (default), only the right button will be
enabled for sorting and the left button will allow for sizing
the columns.
< bPopUp > is a code block to evaluate. If this variable is a
code block, a popup button will be placed to the right of the
GET used for entering a seek value. If the user clicks on this
button or presses CTRL-ENTER while in the GET, the code block
will be evaluated. The value in the GET is passed to the code
block and the value returned by the code block is stuffed back
into the GET.
< cSayIndexFont > is the font of the Index Name prompt to the right
of the search window.
Description:
DC_FINDBROWSE() is a utility program that paints a browse
with user-defined columns and a entry GET for the user to
enter keyboard characters. The keys entered will automatically
seek the selected index and refresh the browse. The user can
click the right mouse button on a column heading to select a
different index. The Up, Down, Page Up, Page Down, Ctrl Page Up,
Ctrl Page Down and Enter keys are all enabled while the user
is in the entry GET to allow the user to navigate the browse
with keys or the mouse or enter keys for seeking.
Examples:
// Example 1 - Popup a Browse with multiple columns and AutoSeek
FUNCTION XTest()
LOCAL aFields
SET DEFA TO ..\XDOC
USE EXPRESS VIA FOXCDX EXCLUSIVE ALIAS 'XDOC'
SET INDEX TO EXPRESS.CDX
OrdSetFocus('COMMAND')
SET DEFA TO
aFields := ;
{ ; // field Header Width Index Prompt
{ {||XDOC->type}, 'Type', 8, "TYPE", 'Type' } ,
;
{ {||XDOC->command}, 'Command', 8, 'COMMAND', 'Command' },
;
{ {||XDOC->category}, 'Category', 8, 'CATEGORY', 'Category'
}, ;
{ {||XDOC->module}, 'Module', 8, 'MODULE', 'Module' },
;
{ {||XDOC->SHORT}, 'Short Description', 25, nil, nil } ;
}
DC_FindBrowse( aFields, nil, nil, nil, 85, 20, ;
'Find Record by AutoSeek (Click Right Mouse Button in Header to change
Index)' )
RETURN nil
// Example 2 - Use DC_FindBrowse() for Combo-box style picklists
LOCAL GetList := {}, cType, oType, cCommand, oCommand, cCategory, oCategory
SET DEFA TO ..\XDOC
USE EXPRESS VIA FOXCDX EXCLUSIVE ALIAS 'XDOC'
SET INDEX TO EXPRESS.CDX
OrdSetFocus('COMMAND')
SET DEFA TO
cType := Space(20)
@ 1,0 DCSAY 'Type'
@ 2,0 DCGET cType POPUP {|c|_XTest(1,oType,c)} GETSIZE 20
@ 3,0 DCSTATIC XBPSTATIC_TYPE_RECESSEDBOX SIZE 20,6 ;
OBJECT oType EVAL {|o|o:hide()}
cCommand := Space(20)
@ 1,25 DCSAY 'Command'
@ 2,25 DCGET cCommand POPUP {|c|_XTest(2,oCommand,c)} GETSIZE 20
@ 3,25 DCSTATIC XBPSTATIC_TYPE_RECESSEDBOX SIZE 20,6 ;
OBJECT oCommand EVAL {|o|o:hide()}
cCategory := Space(20)
@ 1,50 DCSAY 'Category'
@ 2,50 DCGET cCategory POPUP {|c|_XT est(3,oCategory,c)} GETSIZE 20
@ 3,50 DCSTATIC XBPSTATIC_TYPE_RECESSEDBOX SIZE 20,6 ;
OBJECT oCategory EVAL {|o|o:hide()}
DCREAD GUI FIT ADDBUTTONS ;
TITLE 'Using DC_FindBrowse() for a Database Pick-List (Pull-Down style)'
RETURN nil
/* ----------------------------- */
STATIC FUNCTION _XTest( nMode, oXbp, c )
LOCAL aFields
oXbp:show()
IF nMode = 1
OrdSetFocus('TYPE')
aFields := { { {||XDOC->type}, 'Type', 15, nil, nil } }
ELSEIF nMode = 2
OrdSetFocus('COMMAND')
aFields := { { {||XDOC->command}, 'Command', 15, nil, nil } }
ELSEIF nMode = 3
OrdSetFocus('CATEGORY')
aFields := { { {||XDOC->category}, 'Category', 15, nil, nil } }
ENDIF
IF DC_FindBrowse( aFields, oXbp, 0, 0, 20, 6, nil, .f., .f. )
c := Eval(aFields[1,1])
ENDIF
oXbp:hide()
RETURN c
Source/Library:
_DCFINDX.PRG, DCLIPX.DLL
See Also:
dc_browseautoseek()
@ DCFINDBROWSE
DCFINDADDCOL
dc_findbrowsesort()
dc_findbrowsesort()
Set Sort Header options for DC_FindBrowse()
Syntax:
DC_FindBrowseSort( [< aSortOptions >] ) - > aOldOptions
Arguments:
< aSortOptions > is an array of 7 elements.
Element Description
------- -------------------------------------------------------
1 / 2 Used to set the foreground and background color of the
column heading that is chosen as the controlling sort
order when clicking the mouse in the column heading.
See the SORT clause of DCBROWSECOL.
3 / 4 Used to set the foreground and background color of the
column headings that are not the controlling sort order.
5 / 6 Use to set the UP arrow and DOWN arrow bitmaps that are
used in the column header of the sorted column when
the order is "ascending" or "descending" respectively.
7 Used to set the color of the box drawn around the SEEK
Get (default is GRA_CLR_RED).
Returns:
An array containing the old sort options.
Description:
DC_FINDBROWSESORT() is used to set the column heading options
for DC_FindBrowse() when using the sort feature that is activated
by clicking in the header column.
Examples:
aSort := Array(6)
aSort[1] := GRA_CLR_WHITE // Sort Selected Color (Foreground)
aSort[2] := GRA_CLR_RED // Sort Selected Color (Background)
aSort[3] := GRA_CLR_WHITE // Sort Unselected Color (Foreground)
aSort[4] := GRA_CLR_DARKGRAY // Sort Unselected Color (Background)
aSort[5] := BITMAP_RD_UP_RED // Sort UP Bitmap
aSort[6] := BITMAP_RD_DOWN_RED // Sort DOWN Bitmap
aSaveSort := DC_FindBrowseSort(aSort)
DC_FindBrowse( aFields, nil, nil, nil, 85, 20, ;
'Find Record by AutoSeek (Click Right Mouse Button in Header to change
Index)', ;
nil, nil, nil, nil, nil, nil, { aPres, { GRA_CLR_DARKGRAY, GRA_CLR_RED } },
;
nil, nil, nil, .5 )
Source/Library:
_DCFINDX.PRG, DCLIPX.DLL
See Also:
dc_findbrowse()
@ DCFINDBROWSE
dc_fontcompoundname()
Return the Font Compound name from a font object
Syntax:
DC_FontCompoundName( < oFont > ) - > cCompoundName
Arguments:
< oFont > is an XbpFont() object.
Returns:
A character string.
Description:
DC_FontCompoundName() will build a string containing the
Compound Name of a font from it's XbpFont() object.
Examples:
FUNCTION XTest()
LOCAL oFont
oFont := XbpFont():new()
oFont:familyName := 'Arial'
oFont:nominalPointSize := 12
oFont:bold := .t.
oFont:italic := .t.
oFont:underScore := .t.
oFont:create()
? DC_FontCompoundName( oFont )
12.Arial Bold Italic Underscore
oFont:destroy()
RETURN nil
Source/Library:
_DCFONT.PRG, DCLIPX.DLL
See Also:
dc_fontconfigure()
dc_fontconfigure()
Configure a Font object from a Compound Name
Syntax:
DC_FontConfigure( < oFont >, ;
< cFontCompoundName >, ;
[< nCodePage >] ) - > oFont
Arguments:
< oFont > is an XbpFont() object.
< cFontCompoundName > is a character string containing the
compound name of the font.
Examples:
11.Arial
12.Courier New
14.Courier New Bold
20.Lucida Console Italic Underscore
< nCodePage > is the optional code page of the font to select.
Returns:
The configured font object.
Description:
DC_FontConfigure() will configure a font objects properties
from a Font Compound name.
Examples:
oFont := GraSetFont(oPS)
cSaveFont := DC_FontCompoundName(oFont))
DC_FontConfigure(oFont,'12.Arial Underscore')
GraSetFont(oPS,oFont)
GraStringAt('This is some text in "12.Arial Underscore" font')
DC_FontConfigure(oFont,cSaveFont)
GraSetFont(oPS,oFont)
Source/Library:
_DCFONT.PRG, DCLIPX.DLl
See Also:
dc_fontcompoundname()
dc_formatmemotowidth()
Format a memo to fit within a specified area
Syntax:
DC_FormatMemoToWidth( < cString >, ;
< nWidth >, ;
< oPS | cFont > ) - > cString
Arguments:
< cString > is the memo to format.
< nWidth > is the width, in pixels.
< oPS > is the presentation space object that contains the font,
or alternately < cFont > is the font compound name.
Returns:
A character string.
Description:
DC_FormatMemoToWidth() is used to create a memo that fits
perfectly within a specified area based on the font used. CR
characters will be removed and reinserted in the location required
to format each line to the desired width.
Examples:
Run XDEMO.EXE - Sample Group 6 - Memo Format
Source/Library:
_DCFUNCT.PRG, DCLIPX.LIB, DCLIPX.DLL
dc_fornext()
Evaluate a list of expressions in a FOR..NEXT loop
Syntax:
DC_ForNext ( < nStart >, ;
< nEnd >, ;
[< nStep >], ;
< bEval >, ;
[< bWhile >] ) - > NIL
Arguments:
< nStart > is the starting value to be assigned to a variable
which will be incremented for each iteration of a FOR...NEXT
loop.
< nEnd > is the ending value.
The incremental value will be passed to the < bEval > code block
for each iteration of the loop.
< nStep > is the incremental value. The default is 1.
< bEval > is a code block to evaluate for each iteration of the
loop.
< bWhile > is an code block which must evaluate to .true. to
continue the loop, otherwise the loop will be terminated.
Returns:
Nil.
Description:
DC_FORNEXT() is a "function" replacement for FOR...NEXT loops
to be used when a function is needed, i.e. for calling via
macro, code blocks, etc.
Examples:
bEval := { | x | qout(x, sqrt(x) ) }
bWhile := { || inkey()#27 }
DC_FORNEXT( 100, 1000, 5, bEval, bWhile )
Source/Library:
_DCEVAL.PRG, DCLIP1.DLL
See Also:
dc_ifelse()
dc_docase()
dc_dowhile()
dc_getactive()
Return the currently active GET object
Syntax:
DC_GetActive () - > oGet
Arguments:
NONE
Returns:
DC_GETACTIVE() returns the current active Get object within the
current READ by DC_READMODAL(). If there is no READ active when
DC_GETACTIVE() is called, it returns NIL.
Description:
DC_GETACTIVE() is an environment function that provides access
to the active GET object during a READ. The current active Get
object is the one with input focus at the time DC_GETACTIVE() is
called.
Notes:
DC_GETACTIVE() works with DC_READMODAL() in the same way that
Clipper's GETACTIVE() works with READMODAL().
Examples:
// This code uses a WHEN clause to force control to branch to a
// special reader function. Within this function, DC_GETACTIVE()
// retrieves the active Get object:
GetList := {}
@ 10, 10 GET x
@ 11, 10 GET y WHEN MyReader()
@ 12, 10 GET z
dc_readmodal( GetList )
// Called just before second get (above)
// becomes current
FUNCTION MyReader
LOCAL objGet // Active Get holder
objGet := DC_GETACTIVE() // Retrieve current
// active Get
BarCodeRead( objGet )
RETURN (.F.) // Causes Get to be
// skipped in READ
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_getactiveinfo()
Return the currently active GET object
Syntax:
DC_GetActiveInfo( [< oXbp >] ) - > aInfo
Arguments:
< oXbp > is a pointer to any object. If this parameter is not
passed or is not an object, then the object in focus is the
default.
Returns:
A single dimensional array of 4 elements:
Element Type Description
------- ---- ----------------------------------------
[1] C Variable name associated with object
[2] C Procedure name that object was defined
[3] N Procedure line that object was defined
[4] O A pointer to the object
Description:
DC_GETACTIVEINFO() is an environment function that provides
access to the active dialog object during a READ GUI. The
current active object is the one with input focus at the time
DC_GETACTIVEINFO() is called.
Notes:
DC_GETACTIVEINFO() works with DC_READGUI() in a similar way
to the way Xbase++ GETACTIVE() works with READMODAL().
Examples:
. STORE Space(10) TO cGet1, cGet2, cMemo1
. @ 1,1 DCSAY 'Get 1' GET cGet1
. @ 2,1 DCSAY 'Get 2' GET cGet2
. @ 4,1 DCMULTILINE cMemo1 SIZE 30,10
. DCHOTKEY xbeK_ALT_I ACTION {||DC_MsgBox(DC_GetActiveInfo()}
. DCREAD GUI FIT ADDBUTTONS
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readgui()
dc_getanchorcb()
Create a codeblock to anchor local variables to the GetList
Syntax:
DC_GetAnchorCB ( < uVar >, ;
[< cType >], ;
[< xValue >], ;
[< cPicture >] ) - > bAnchor
Arguments:
< uVar > is the local variable. IF neither the < cType > or
< xValue > parameters are used, then the code block converts
a character string to the type of the variable. This is
needed by the GUI get system because XbpGet() objects can
only work with character strings.
< cType > is the type of value the codeblock is expecting
when it is evaluated.
< xValue > is the value of the variable to return when the
code block is evaluated.
< cPicture > is an optional picture clause to use with
numeric or date variables.
Returns:
A Code Block.
Description:
DC_GETANCHORCB() is used to create a code-block that will
anchor a local variable to a GetList array. This allows
a reference to a local variable to be passed to a text or
GUI reader via a GetList array to be used as a :dataLink
for Xbase Parts.
Examples:
#command GET <uVar> => ;
AAdd( myGetlist, DC_GETANCHORCB(@<uVar>) )
#command GET <uVar> PICT <cPict> => ;
AAdd( myGetlist, DC_GETANCHORCB(@<uVar>,,,<cPict>)
#command CHECKBOX <lVar> => ;
AAdd( myGetlist, DC_GETANCHORCB(@<uVar>,'L')
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readgui()
dc_getbitmap()
Create a bitmap object from any source
Syntax:
DC_GetBitMap( < xBitMap >, ;
[< nType >], ;
[< cResType >], ;
[< cResFile >], ;
[< anScale >], ;
[< aAllowIcons >], ;
[< aSize >] ) - > xBitMap
Arguments:
< xBitMap > is any of the following variable types:
C - Character. This is a string that may contain a file name.
The contents of the string is tested to see if it contains a
valid .BMP, .JPG or .GIF file. If it does and the file exists,
it is loaded to an XbpBitMap() object and the object is returned.
If it is not a valid .BMP, .JPG or .GIF file, the original string
passed in (< xBitMap >) is returned.
N - Numeric. This is a numeric resource that has been linked
into the executable program. It is tested to insure that it is
a valid bitmap resource and then is converted to an XbpBitMap()
object. If it is not a valid bitmap resource or < nType > is
anything other than 0 or XBPSTATIC_TYPE_BITMAP (defined in XBP.CH)
then the original numeric value passed in (< xBitMap >) is returned.
O - Object. If < xBitMap > is an XbpBitMap() object, it is returned
without being modified.
B - Code Block. If < xBitMap > is a code block, then the code block
will be evaluated. The return value must be an objec of the
XbpBitmap() class.
< cResType > provides support for bitmap resources of type
BMP, PNG, GIF and JPEG that have been linked into a .RES file to
be used as the caption.
Example:
< cResType > = 'GIF'
// myres.arc
USERDEF GIF
2000 = FILE ".\GIFChart.GIF"
< cResFile > is the name of the .DLL that contains the resource
stated in the RESTYPE < cResType > clause. If this parameter
is not used, then the resource must be in the .EXE.
If < anScale > is a numeric value, then < anScale > is the
scaling
factor to use for the new bitmap, based on the original bitmap
size. For example, if the original bitmap size is 25x25 pixels
and < anScale > is 2, then the new bitmap size is 50x50 pixels.
If < anScale > is an array, then it must contain 2 numeric elements,
the new X size and the new Y size of the bitmap.
Note: For < anScale > to produce a bitmap with a proper color
palette, it is recommended that the original bitmap be created
using a 24-bit palette.
< lAllowIcons >, if .T. will return an XbpIcon() object instead
of an XbpBitmap() object if xBitmap is an icon resource. The
default is .F.
< aSize > is a 2-dimensional array of 2 numeric values that will
set the size of the icon, if < lAllowIcons > is .T. If
< aSize >
is not used, then the size will be determined by the original
resource size.
Returns:
An XbpBitMap() object.
Description:
DC_GetBitMap() returns an XbpBitMap() object from a variety of
input sources.
Notes:
If DC_BitMapTransparentColor() has been set to a value, it will
be applied to the XbpBitMap() object that is returned.
Examples:
DC_BitmapTransparentColor({192,192,192})
@ 137,275 DCSTATIC XBPSTATIC_TYPE_BITMAP OBJECT oRedFlag ;
ID "RedFlag" SIZE 19,19 PIXEL ;
TOOLTIP {||IIF(empty(dc_getcargo(oRedFlag)), ;
"No Flags","Flags exist: "+dc_getcargo(oRedFlag))};
CAPTION {||IIF(empty(aName[cnAlerts]),;
DC_GetBitMap(BITMAP_FLAG_2),;
DC_GetBitMap(BITMAP_FLAG_1))}
Source/Library:
_DCGETBX.PRG
See Also:
dc_bitmaptransparentcolor()
dc_getbrowarray()
Get or Store an array pointer from/to Array Browse
Syntax:
DC_GetBrowArray( < oBrowse >, ;
[< aArray >] ) - > aArray
Arguments:
< oBrowse > is a pointer to the browse object created by the
DCBROWSE command.
< aArray > is a pointer to the new array to browse.
Returns:
A pointer to the current array being browsed.
Description:
DC_GetBrowArray() is used to store a new array pointer to an
existing array browser when using DCBROWSE to browse an array.
Examples:
FUNCTION XTest()
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'
RETURN nil
* -------------------
STATIC FUNCTION _Files( aDirectory, aFiles, nPointer, oBrowFiles )
LOCAL i, cDirectory, cCurPath := DC_CurPath()
cDirectory := aDirectory[nPointer,1]
DC_ChDir( cDirectory )
aFiles := Directory( '*.*')
DC_ChDir( cCurPath )
IF Valtype(oBrowFiles) = 'O'
DC_GetBrowArray( oBrowFiles, aFiles )
oBrowFiles:refreshAll()
ENDIF
RETURN nil
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
See Also:
DCBROWSE
dc_getcolarray()
dc_getcargo()
Get and/or set the cargo of an object
Syntax:
DC_GetCargo ( < oXbp >, ;
[< xCargo >] ) - > xOldCargo
Arguments:
< oXbp > is any object created by a DC* command.
< xCargo > is a variable of any type including multidimensional
array or code block.
Returns:
The previously store cargo variable.
Description:
DC_GETCARGO() is used to store any type of variable in the :cargo
container of objects created by DC* commands.
Notes:
All DC* commands use the :cargo container of Xbp*() objects for
miscellaneous data required for eXPress++ functions. This
cargo is always an array of at least 3 elements with element #3
reserved for user cargo. DC_GetCargo() is a handy function
that stores and/or retrieves data from this element.
Examples:
// Store the directory into the DCPUSHBUTTON identifed by
// it's ID clause as 'OK_BUTTON'
DC_GetCargo( DC_GetObject(GetList,'OK_BUTTON'), Directory() )
// Return the cargo
aDirectory := DC_GetCargo( DC_GetObject(GetList,'OK_BUTTON') )
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
dc_getcolarray()
Get Column array information from a DCBROWSE array browse
Syntax:
DC_GetColArray( [< nElement >], ;
< oBrowse >, ;
< xValue > ) - > xInfo
Arguments:
If < nElement > is a NIL, then the entire sub-array is returned.
If < nElement > is a 0, then the numeric value of the sub-array
is returned, ie the number of the currently selected sub-array
element. If < nElement > is a 1 or more, then the contents of
the currently selected sub-array, element < nElement > is returned.
< oBrowse > is a pointer to the Browse object.
IF < xValue > is passed, then < nElement > must be a 1 or
greater.
The element < nElement > of the selected sub-array will be assigned
the value of < xValue >.
Description:
DC_GetColArray() returns information about the currently selected
array element of a DCBROWSE object when browsing an array.
This function is necessary when browsing an array and the
information in a column must be specially formatted in a code
block.
Examples:
FUNCTION XTest()
/* ARRAY BROWSER WITH COLORS
This example demonstrates how to control the color of cells in
an array browser using DCBROWSE. In this example, the color of
the SIZE cells is dependent on the size of the file. The
function DC_GETCOLARRAY() is used as a pointer into the array
being browsed.
*/
LOCAL GetList := {}, cFileName, oFileName, oDirGroup, aDirectory, i, ;
aFile, oDirectory, aColors, bColor
cFileName := Space(30)
@ 2,2 DCGET cFileName GETSIZE 43 GETOBJECT oFileName
@ 3.5,2 DCSTATIC XBPSTATIC_TYPE_RECESSEDBOX SIZE 43,13 ;
OBJECT oDirGroup
aDirectory := Directory()
FOR i := 1 TO Len(aDirectory)
ASize(aDirectory[i],5)
aDirectory[i,5] := .f.
NEXT
aFile := aDirectory[1]
@ 2,2 DCBROWSE oDirectory PARENT oDirGroup DATA aDirectory ;
SIZE 297,253 PIXEL ;
FONT '10.Helv.Bold' ;
INTO aFile ;
DATALINK {||cFileName:=aFile[1],oFileName:SetData()} ;
MARK 5 ;
MKCOLOR 5, GRA_CLR_WHITE, GRA_CLR_BLUE
aColors := { {GRA_CLR_WHITE,GRA_CLR_DARKRED}, ;
{GRA_CLR_WHITE,GRA_CLR_DARKBLUE}, ;
{GRA_CLR_BLACK,GRA_CLR_DARKGREEN}, ;
{GRA_CLR_BLACK,GRA_CLR_YELLOW} }
bColor := {| nSize, nCase | nSize := DC_GetColArray(2,oDirectory),;
nCase := DC_PickCase(nSize,'>=',;
{1000000,100000,10000,0}, ;
{ 1, 2, 3,4} ), aColors[nCase] }
DCBROWSECOL ELEMENT 1 WIDTH 8 HEADER "Name" PARENT oDirectory
DCBROWSECOL ELEMENT 2 WIDTH 5 HEADER "Size" PARENT oDirectory ;
EVAL { |o|o:colorBlock := bColor }
DCBROWSECOL ELEMENT 3 WIDTH 5 HEADER "Date" PARENT oDirectory
DCBROWSECOL ELEMENT 4 WIDTH 5 HEADER "Time" PARENT oDirectory
DCBROWSECOL ELEMENT 5 WIDTH 4 HEADER "Marked" PARENT oDirectory
DCREAD GUI ;
FIT ;
MODAL ;
BUTTONS DCGUI_BUTTON_OK + DCGUI_BUTTON_CANCEL ;
TITLE 'Array Browse of Directory'
RETURN nil
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
See Also:
@ DCBROWSE
DCBROWSECOL
dc_getbrowarray()
dc_browserow()
dc_getcomboimmediate()
Changes behavior of @ DCGET .. COMBO
Syntax:
DC_GetComboImmediate( < lSet > ) - > lPreviousSetting
Arguments:
< lSet > is a logical value.
Returns:
A logical value.
Description:
DC_GetComboImmediate() is a Get/Set function that changes the
behavior of @..DCGET..COMBO. A .TRUE. setting will cause the
GET to update every time a new item is selected in the dropdown
browse. A .FALSE. setting will cause the GET to update only
after double-clicking in the browse.
Source/Library:
_DCCLASS.PRG, DCLIPX.DLL
See Also:
@ DCGET
dc_getcombomode()
Set mouse mode for @..DCGET..COMBO
Syntax:
DC_GetComboMode( [< nMode >] ) - > nOldMode
Arguments:
< nMode > is a numeric value from the below table:
* - Default
nMode Description
----- ----------------------------------------------------
0 * A double click of the mouse selects the item from the
dropdown picklist.
1 A single click of the mouse selects the item from the
dropdown picklist.
Returns:
The previous mode setting.
Description:
DC_GetComboMode() is used to set the mouse click mode for
dropdown windows of the @..DCGET..COMBO or @..DCSAY..GET..COMBO
command.
Source/Library:
_dcfindx.prg, dclipx.dll
See Also:
@ DCSAY
@ DCGET
dc_getdestroy()
Destroy all objects in the Dialog Getlist
Syntax:
DC_GetDestroy ( < aGetList >, ;
[< acoGroup >], ;
[< lRemove >], ;
[< lChildrenOnly >] ) - > nil
Arguments:
< aGetList > is an array containing a list of Get objects to
destroy. The GetList must a Gui-based Get List compatible
with DC_ReadGets() or DC_ReadGui().
< acoGroup > is the GetList group or parent object to destroy.
Each item in the GetList may be assigned a group name via the
GROUP < acGroup > clause. If a character value is passed, then
only the items in the GetList which match < acoGroup > will be
destroyed. < acoGroup > may consist of an array of character
values so that more than one group may be destroyed. If
< acoGroup > is a NIL then all items in the GetList will be
destroyed. If < acoGroup > is an object pointer, then all
children items of the object will be destroyed.
< lRemove > if .TRUE. will not only destroy objects, but will also
remove them from the GetList.
< lChildrenOnly > if .TRUE. will remove only the Child objects
(and their children), of the parent object and not remove the
parent object.
Returns:
A logical value.
Description:
DC_GETDESTROY() is used to destroy all objects in the Get List.
This function is needed to destroy objects that were added to
a parent dialog system by DC_READGUI() without destroying any
current objects in the parent dialog.
Examples:
-- Example 1 --
See XSample_144() in XSAMPLE5.PRG for an example using
DC_GetDestroy() in conjunction with DC_MergeGetLists().
-- Example 2 --
#include 'dcdialog.ch'
PROCEDURE XTest()
LOCAL GetList := {}, GetOptions, cFirst := Space(10), ;
cLast := Space(10), cPhone := Space(15), oFirst, oDlg, ;
oPhoneButton
@ 0,0 DCSAY ' Last Name' GET cLast
@ 2,0 DCSAY 'First Name' GET cFirst SAYOBJECT oFirst
@ 7,0 DCPUSHBUTTON CAPTION 'Phone' ;
OBJECT oPhoneButton ;
SIZE 8,1.5 ;
ACTION {||_GetPhone(oDlg,@cPhone,oFirst,oPhoneButton)}
DCREAD GUI ;
FIT ;
PARENT @oDlg ;
ADDBUTTONS
RETURN
/* --------------------- */
STATIC FUNCTION _GetPhone( oDlg, cPhone, oFirst, oPhoneButton )
LOCAL GetList := {}
@ 2,0 DCSAY " Phone Num" GET cPhone RELATIVE oFirst ;
PARENT oDlg PICT '999-999-9999'
@ 0,10 DCPUSHBUTTON CAPTION 'Done' ;
RELATIVE oPhoneButton ;
SIZE 8,1.5 ;
ACTION {||DC_GETDESTROY(GetList)}
DCREAD GUI PARENT oDlg EXIT SAVE
RETURN nil
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readgui()
dc_getdevout()
A Replacement for DevPos()/DevOut() when writing @SAY..GETS
Syntax:
DC_GetDevOut ( < nRow >, ;
< nCol >, ;
< cExpr >, ;
< cColor > ) - > nil
Arguments:
< nRow > is the display row.
< nCol > is the display column.
< cExpr > is the string to display.
< cColor > is the display color for the string. If no argument
is passed, the current system color will be used.
Returns:
Nil
Description:
DC_GETDEVOUT() is used in @SAY..GET translations contained
in DCGET.CH in place of DevPos() and DevOut(). This
function will not display the prompt on the screen if it
has been positioned outside the scroll-region coordinates
pre-set by DC_READBOX() or DC_READWINDOW() and will set
appropriate static flags for DC_READMODAL() to allow for
scrolling the prompt in the GET window area.
Notes:
DC_READWINDOW() or DC_READBOX() must be called before
displaying any SAYS with the @SAY..GET command or with
DC_GETDEVOUT().
Examples:
#include "dcget.ch"
LOCAL GetList := {}, aData, i
use <cDataFile>
aData := Array(Fcount())
FOR i := 1 TO LEN( aData )
aData[i] := FieldGet(i)
NEXT
DC_ReadWindow( { 10, 10, 20, 60 } )
FOR i := 1 TO LEN(aData)
DC_GETDEVOUT( i, 12, PadL(Field(i),10), )
SetPos( Row(), Col()+1 )
AAdd( GetList,_GET_(aData[i],"aData[i]",,,) )
DC_GetDisplay( GetList )
GetList := DC_AddCargo(GetList,-1*i)
GetList := ;
DC_AddCargo(GetList,{ 108, { i, 12, PadL(Field(i),10) }})
NEXT
DC_ReadModal( GetList,,aReadArea )
RETURN nil
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readbox()
dc_getdisplay()
Display a GET on the screen if it falls in scroll region
Syntax:
DC_GetDisplay ( < GetList > ) - > nil
Arguments:
< GetList > is the GET array containing a set of GETS.
Returns:
Nil
Description:
DC_GETDISPLAY() is used in @SAY..GET translations contained
in DCGET.CH in place of the default display method. This
function will not display the GET on the screen if it
has been positioned outside the scroll-region coordinates
pre-set by DC_READBOX() or DC_READWINDOW() and will set
appropriate static flags for DC_READMODAL() to allow for
scrolling the GET in the pre-established window area.
Notes:
DC_READWINDOW() or DC_READBOX() must be called before
displaying any GETS with the @SAY..GET command or with
DC_GETDISPLAY().
Examples:
#include "dcget.ch"
LOCAL GetList := {}, aData, i
use <cDataFile>
aData := Array(Fcount())
FOR i := 1 TO LEN( aData )
aData[i] := FieldGet(i)
NEXT
DC_ReadWindow( { 10, 10, 20, 60 } )
FOR i := 1 TO LEN(aData)
DC_GetDevOut( i, 12, PadL(Field(i),10), )
SetPos( Row(), Col()+1 )
AAdd( GetList,_GET_(aData[i],"aData[i]",,,) )
DC_GETDISPLAY( GetList )
GetList := DC_AddCargo(GetList,-1*i)
GetList := ;
DC_AddCargo(GetList,{ 108, { i, 12, PadL(Field(i),10) }})
NEXT
DC_ReadModal( GetList,,aReadArea )
RETURN nil
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readbox()
dc_gethelpcode()
Return the Help Code of an object
Syntax:
DC_GetHelpCode ( < oXbp >, ;
[@< aGetList >], ;
[@< aGetListItem >] ) - > cHelpCode
Arguments:
< oXbp > is a pointer to any object that was created by DC_ReadGui().
@< aGetList > is a variable, passed by reference, to store a pointer
to the GetList that is associated with the object.
@< aGetListItem > is a variable, passed by reference, to store a
pointer to the GetList Item that is associated with the object.
Returns:
A Character String.
Description:
DC_GETHELPCODE() is used to return the Help Code from the
GetList that is associated with a specified object. Help Codes
are associated with objects created by DC* commands by using
the HELPCODE <þcHelpCodeþ> clause of the command. Context-Sensitive
Help systems require that when a Help Request for an object
does not return a Help Code (because one has not been assigned),
then the help code of the parent of that object should be
returned. DC_GetHelpCode() walks up the tree until it finds a
Help Code. If no Help Code is found then the returned value is
a NIL.
Methods:
Examples:
-- Example 1 --
#include 'dcdialog.ch'
PROCEDURE XTest()
LOCAL oStatic, oDate, dDate := Date()
@ 1,1 DCSTATIC TYPE XBPSTATIC_TYPE_RECESSEDBOX SIZE 30,5 ;
OBJECT oStatic HELPCODE 'MYAPP.STATIC'
@ 2,2 DCSAY 'Date' GET dDate GETOBJECT oDate
@ 7,1 DCPUSHBUTTON CAPTION 'Get Help' SIZE 10 ;
ACTION {||DC_DebugQout({DC_GetHelpCode(oDate)})}
DCREAD GUI FIT
RETURN nil
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_getproperty()
dc_gethotkeylist()
Retrieve a list of hotkeys that have been set
Syntax:
DC_GetHotKeyList( [< aGetList >] ) - > aHotKeys
Arguments:
< aGetList > is the GetList for the dialog window which contains
DCHOTKEY commands or ACCELKEY clauses of DC* commands. If
< aGetList > is not passed then an array of information about
hotkeys created with the SetKey() function is returned.
Returns:
An array with information about the Hotkeys. Each element of
the array contains 3 sub-elements:
Element Type Description
------- ----- ------------------------------------------
1 C The character-string definition of the hotkey
2 N The numeric value of the hotkey
3 B Tha action code block associated with the hotkey
Description:
DC_GETHOTKEYLIST() is used to return an array of HotKeys that
have been set either by using the DCHOTKEY command, the ACCELKEY
clause of DC* commands or the SetKey() function.
Examples:
#include "dcdialog.ch"
#include "appevent.ch"
#include "inkey.ch"
-- Example 1 --
FUNCTION XTest()
LOCAL GetList[0]
@ 1,1 DCPUSHBUTTON CAPTION 'Test' ACTION {||MsgBox('test T')} ;
ACCELKEY xbeK_ALT_T
DCHOTKEY xbeK_ALT_Z ACTION {||MsgBox('test Z')}
DCREAD GUI FIT SAVE
DC_ArrayView( DC_GetHotKeyList(GetList) )
RETURN nil
-- Example 2 --
FUNCTION XTest()
SetKey(K_ALT_T,{||MsgBox('test T')})
SetKEy(K_ALT_Z,{||MsgBox('text Z')})
DC_ArrayView( DC_GetHotKeyList() }
RETURN nil
Source/Library:
_DCPUTK.PRG/.OBJ, DCLIPX.LIB
dc_getiddefault()
Assign a default ID based on field/memvar name
Syntax:
DC_GetIDDefault( [< cId >], ;
[< cVarName >], ;
[< cPrefix< ] ) - > cId
Arguments:
< cId > if not empty will be returned as the return value.
< cVarName > if empty will return < cId >.
< cVarName > if not empty must include an alias - > pointer.
example: "MYFILE- >MYFIELD"
< cPrefix > is the prefix to put on the returned value.
Description:
DC_GetIDDefault() will return an ID for an object based on the
name of the variable passed. It is used in DCDIALOG.CH to
automatically assign a default ID when getting data that is an
aliased field.
Example 1 : @..DCGET MYFILE-þ>name
This will assign an ID of GET_MYFILE_NAME
Example 2 : DCBROWSECOL FIELD MYFILE-þ>name
This will assign an ID of COL_MYFILE_NAME
Examples:
DC_GetIDDefault( nil, 'MYFILE->MYFIELD', 'GET_' )
Returns: GET_MYFILE_MYFIELD
Source/Library:
DCLIPX.LIB, DCLIPX.DLL, DCDIALOG.CH
dc_getlistobject()
Return a pointer to the DC_GetList() object from a GetList Array
Syntax:
DC_GetListObject( aGetList ) - > oGetList
Arguments:
< aGetList > is a GetList array.
Returns:
An object of the class DC_GetList.
Description:
DC_GetListObject() is used to return a pointer to the DC_GetList()
object.
Notes:
The GetList array must first have been passed to the DCREAD GUI
command.
Examples:
#include "dcdialog.ch"
FUNCTION Main()
LOCAL GetList[0]
@ 0,0 DCSAY 'Testing'
DCREAD GUI FIT TITLE 'Testing' EVAL {||ShowTitle(GetList)}
RETURN nil
* -----------
STATIC FUNCTION ShowTitle( GetList )
LOCAL oGetList
oGetList := DC_GetListObject( GetList )
DCMSGBOX oGetList:parentDlg:title
RETURN nil
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
dc_getlisttype()
Return the "define" name of a Get Object from it's type
Syntax:
DC_GetListType ( < nType > ) - > cType
Arguments:
< nType > is the numeric value stored in element nGETLIST_TYPE
of each Getlist array object.
Returns:
A Character String.
Description:
DC_GETLISTTYPE() is a handy debugging function to determine
the manifest name of the defined "type" of object.
Examples:
#include "dcdialog.ch"
#include "xbp.ch"
FUNCTION XDemo_1 ()
LOCAL GetList := {}, GetOptions, oTabPage1, oTabPage2, oTabPage3,;
cPlayer, cTeam, cLeague, cPosition, cMemo, dDateAcq,;
nOrigPrice, nPresValue, nCardNmbr, nYear, cComments, ;
aLeague, aTeam, aPosition
aLeague := { 'NL','AL','BL','BS' }
aTeam := { 'Dodgers','Yankees','Reds','Cardinals','Giants',;
'Twins','Red Sox','White Sox' }
aPosition := { '1B','2B','3B','SS','P','C','LF','CF','RF','DH' }
/* ---- Tab Page #1 ---- */
@ 3,3,15,62 DCTABPAGE oTabPage1 CAPTION 'Player Data'
@ 3,2 DCSAY "Player Name" GET cPlayer SAYRIGHT PARENT
oTabPage1 SAYSIZE 10
@ 5,2 DCSAY "Team" SAYRIGHT PARENT oTabPage1 SAYSIZE 8
@ 5,11 DCCOMBOBOX cTeam LIST aTeam SIZE 10,6 PARENT oTabPage1
@ 5,23 DCSAY "Position" SAYRIGHT PARENT oTabPage1 SAYSIZE 8
@ 5,33 DCCOMBOBOX cPosition LIST aPosition SIZE 6,6 PARENT ;
oTabPage1
@ 5,40 DCSAY "League" SAYRIGHT PARENT oTabPage1 SAYSIZE 8
@ 5,50 DCCOMBOBOX cLeague LIST aLeague SIZE 4,4 ;
PARENT oTabPage1
DCGETOPTIONS WINDOW HEIGHT 400 ;
WINDOW WIDTH 500 ;
SAYWIDTH 100
/* ---- See output below ---- */
FOR i := 1 TO LEN(GetList)
? i, DC_GETLISTTYPE( GetList[i,nGETLIST_TYPE] )
NEXT
DC_ReadGui( GetList, 'My BASEBALL CARD Inventory', ;
GetOptions, .t. )
RETURN nil
/* ------------------- */
Output Screen:
1 GETLIST_TABPAGE
2 GETLIST_SAY
3 GETLIST_GET
4 GETLIST_SAY
5 GETLIST_COMBOBOX
6 GETLIST_SAY
7 GETLIST_COMBOBOX
8 GETLIST_SAY
9 GETLIST_COMBOBOX
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readgets()
dc_getlistvalidate()
Validate all objects in GetList
Syntax:
DC_GetListValidate( < aGetList > ) - > lStatus
Arguments:
< aGetList > is a valid GetList array.
Description:
DC_GETLISTVALIDATE() is used to test all VALID clauses in the
GetList and set focus to the first object that fails validation.
Examples:
#include 'dcdialog.ch'
FUNCTION XTest()
LOCAL GetList := {}, cFrom := Space(8), cTo := Space(8), ;
dFrom := CTOD(' / / '), dTo := CTOD(' / / ')
SET DATE FORMAT TO 'mm/dd/yyyy'
@ 1,0 DCSAY 'From Time:' ;
GET cFrom ;
PICTURE '99:99:99' ;
VALID {|| IIF(!EMPTY(Strtran(cFrom,':','')), .T., ;
(DC_MsgBox({'From Time cannot be empty.'}), .F.))}
@ 2,0 DCSAY ' To Time:' ;
GET cTo ;
PICTURE '99:99:99' ;
VALID {|| IIF(!EMPTY(StrTran(cTo,':','')), .T., ;
(DC_MsgBox({'To Time cannot be empty.'}), .F.))}
@ 3,0 DCSAY 'From Date:' ;
GET dFrom ;
PICTURE '@D' ;
VALID {|| IIF(!EMPTY(dFrom), .T., ;
(DC_MsgBox({'From Date cannot be empty.'}), .F.))}
@ 4,0 DCSAY ' To Date:' ;
GET dTo ;
PICTURE '@D' ;
VALID {|| IIF(!EMPTY(dTo), .T., ;
(DC_MsgBox({'To Date cannot be empty.'}), .F.))}
@ 6,0 DCPUSHBUTTON CAPTION 'Validate' SIZE 10,2 ;
ACTION {||DC_GetListValidate(GetList)}
DCREAD GUI FIT ADDBUTTONS
RETURN nil
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
See Also:
dc_getvalidate()
DCGETOPTIONS
dc_getnetname()
Returns the Network name of the workstation
Syntax:
DC_GetNetName() - > cNetName
Arguments:
None.
Returns:
A character string.
Description:
DC_GetNetName() returns the Network name of the current workstation.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_getobject()
Return a pointer to an object from an ID name
Syntax:
DC_GetObject ( < aGetList >, ;
< cID > ) - > oObject
Arguments:
< aGetList > is an array containing a list of Get objects to
refresh. The GetList may be Dual-Mode Getlist compatible
with DC_ReadGets() or DC_ReadGui() or a text-based GetList
compatible with DC_ReadModal().
< cID > is a character string equivalent to the ID assigned to the
item in the GetList. This is case-sensitive.
Returns:
A Pointer to the object created by DC_ReadGui() for the item
in the GetList that matches <þcIdþ>. IF <þcIdþ> is not found
in the
Getlist, then a NIL is returned.
Description:
DC_GETOBJECT() is used to return a pointer to the actual object
from a GetList ID tag.
This function will scan the GetList array for the GetList item
which matches the character string ID which was assigned to the
GetList object. An ID is assigned via the ID <þidþ> clause for
each GetList command. This function eliminates the need to
assign a memory variable to an object to get a reference to the
object.
Exported Instance Variables:
Methods:
Notes:
Examples:
-- Example 1 --
#include 'dcdialog.ch'
PROCEDURE XTest()
#define cDesc aLocals[1]
#define cType aLocals[2]
#define cSubType aLocals[3]
#define oToolBar aLocals[4]
LOCAL aLocals[4], GetList := {}, GetOptions
USE COLLECT NEW EXCLUSIVE
LoadFields( aLocals )
@ 5,10 DCSAY 'Description' GET cDesc ;
GETID 'GET_DESC'
@ 6,10 DCSAY ' Type' GET cType ;
GETID 'GET_TYPE'
@ 7,10 DCSAY ' Sub-Type' GET cSubType ;
GETID 'GET_SUBTYPE'
DCTOOLBAR oToolBar
DCADDBUTTON CAPTION "Next" PARENT oToolBar ;
SIZE 9 ;
ACTION {||TestUpdated(GetList,aLocals),;
dbSkip(1), ;
LoadFields(aLocals), ;
DC_GetRefresh(GetList),;
DC_GetOrigSet(GetList) }
DCADDBUTTON CAPTION "Prev" PARENT oToolBar ;
SIZE 9 ;
ACTION {||TestUpdated(GetList,aLocals),;
dbSkip(-1), ;
LoadFields(aLocals), ;
DC_GetRefresh(GetList),;
DC_GetOrigSet(GetList) }
DCADDBUTTON CAPTION 'Desc' PARENT oToolBar ;
SIZE 9 ;
ACTION {||SetAppFocus(DC_GETOBJECT(GetList,'GET_DESC'))}
DCADDBUTTON CAPTION 'Type' PARENT oToolBar ;
SIZE 9 ;
ACTION {||SetAppFocus(DC_GETOBJECT(GetList,'GET_TYPE'))}
DCADDBUTTON CAPTION 'SubType' PARENT oToolBar ;
SIZE 9 ;
ACTION {||SetAppFocus(DC_GETOBJECT(GetList,'GET_SUBTYPE'))}
DCREAD GUI ;
FIT ;
ADDBUTTONS
RETURN
/* ------------- */
STATIC function LoadFields( aLocals )
cDesc := COLLECT->descrip
cType := COLLECT->type
cSubType := COLLECT->sub_type
RETURN nil
/* ------------- */
STATIC FUNCTION SaveFields( aLocals )
REPLACE COLLECT->descrip WITH cDesc
REPLACE COLLECT->type WITH cType
REPLACE COLLECT->sub_type WITH cSubType
RETURN nil
/* ------------- */
STATIC FUNCTION TestUpdated ( GetList, aLocals )
IF DC_GETORIGUPDATED( GetList )
IF DC_MsgBox(,,{'Data has been modified. Save Changes?'},,,,.t.)
SaveFields( aLocals )
ENDIF
ENDIF
RETURN nil
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readgui()
dc_getobjectid()
dc_getobjectid()
Return a the ID of an object
Syntax:
DC_GetObject ( < oXbp >, ;
< aGetList > ) - > cID
Arguments:
< oXbp > is any object that was created using DC* commands.
< aGetList > is an array containing a list of Get objects.
Returns:
A character string.
Description:
DC_GETOBJECTID() is used to return a the ID of an object.
An ID is assigned via the ID <þidþ> clause for each GetList
command.
Examples:
-- Example 1 --
#include 'dcdialog.ch'
PROCEDURE XTest()
@ 1,1 dcpushbutton caption "Test" id 'TEST' size 12,1 action ;
{|a,b,o|DC_DebugQout(DC_GetObjectID(o,GetList))}
DCREAD GUI FIT
RETURN
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readgui()
dc_getobject()
dc_getoptdefault()
Set the Default options for the GUI Reader
Syntax:
DC_GetOptDefault( [< aGetOptions >] ) - > aDefaultOptions
Arguments:
< aGetOptions > is an optional array of options default options
to set for the GUI reader.
Element Type Default Description
------- ---- -------- ------------------------------------
1 C nil Window Name
2 C nil Window Title
3 N 24*20 Window Height (pixels)
4 N 80*7 Window Width (pixels)
5 N 20 Row Spaces (pixels)
6 N nil Say Width (pixels)
7 C nil Say Font
8 C nil Get Font
9 N nil Get Height (pixels)
10 A nil Added buttons
11 N nil Window Start Row (pixels)
12 N nil Window Start Column (pixels)
13 N 0 Window Row Offset (pixels)
14 N 0 Window Column Offset (pixels)
/* nGETOPT_COLOFFSET */ ;
15 L .f. Design Mode
16 C nil Menu Name
17 L .f. Pixel Mode
18 X nil Spare
19 N 1 Window Icon (resource number)
20 L .f. Logical Gets are Checkboxes
21 C '' Help File Name
22 L .f. Objects are visible
23 L .t. Translate text coordinates
24 L .t. Says are Right Justified
25 N nil Window BitMap (resource number)
26 A nil Presentation Parameters
27 N nil Background color of Window
28 N nil Say Option (text justification)
29 B nil Evaluation Code Block
30 N nil Modal State
31 N nil Says Height (pixels)
32 L nil Minimize Button
33 L nil Maximize Button
34 L .f. Tab Stops
35 A {.f.,nil} Abort Query Option
36 N 20 Row Pixels
37 N 7.0 Column Pixels
38 L .t. Enable Escape Key
39 C '' Source Code File
40 A { 1,0 } ToolTip Color, ForeGround/BackGround
41 N nil Border
42 L .f. Validate on Exit
43 A {.f.,nil} Close Query Option
44 L .f. No Task List
45 N nil Window Minimum Size
46 N nil Window Maximum Size
47 L .f. No Window Resize
48 L .f. No Window Title bar
49 L .f. No Window Move with owner
50 N 0 Window Origin
51 N 0 Hilite Gets Color
52 L .t. Supervise Gets
53 L .f. Hide Window
54 L .f. No Busy Pointer
55 C '' Busy Message
56 N 327748 Dot Prompt Hot Key
57 L .f. Cascade Windows
58 L .f. AutoResize
59 A nil Color Gets, ForeGround/BackGround
60 L .t. Confirm
61 N 10 Fitpad (pixels)
62 N 0 Button Alignment
63 A {.f.,nil} Exit Query
64 N nil Disable Color (BackGround)
Returns:
An array.
Description:
DC_GetOptDefault() is used to set the default options for the
GUI reader. An array of information is passed to the function
with the default values.
Notes:
See DCGETOPTIONS for a description of each option.
Examples:
FUNCTION X_test()
LOCAL GetOptions
DCGETOPTIONS ;
ROWSPACE 15 ;
ROWPIXELS 15 ;
COLPIXELS 6.5 ;
NOESCAPEKEY ;
HILITEGETS GRA_CLR_RED ;
TABSTOP
DC_GetOptDefault( GetOptions )
RETURN nil
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readgui()
DCGETOPTIONS
dc_getorigset()
Set the original values of the Dialog items in the Getlist
Syntax:
DC_GetOrigSet ( < aGetList >, ;
[< ancGroup >] ) - > nil
Arguments:
< aGetList > is an array containing a list of Get objects to
refresh. The GetList must a Gui-based Get List compatible
with DC_ReadGets() or DC_ReadGui().
< ancGroup > is the GetList group to set. Each item in the
GetList may be assigned a group name or number via the
GROUP < ancGroup > clause. If a numeric or character value is
passed, then only the items in the GetList which match < ancGroup >
will be set. < ancGroup > may consist of an array of numeric values
or character values so that more than one group may be set.
If < ancGroup > is a nil then all items in the GetList will be
set.
Returns:
A logical value.
Description:
DC_GETORIGSET() is used to store the current value of all
the GETS in the GUI Getlist to the ORIGINAL value element of
each Getlist array object. The original value is then tested
against the current value with DC_GETORIGUPDATED() to test
whether or not any values referenced in the Getlist have
changed or been updated.
Examples:
#define cPlayer aLocals[1]
#define cTeam aLocals[2]
#define cLeague aLocals[3]
#define oToolBar aLocals[4]
LOCAL aLocals[4], GetList := {}
USE BASEBALL
LoadFields( aLocals )
@ 10,10 SAY 'Player Name' GET cPlayer
@ 12,10 SAY ' Team Name' GET cTeam
@ 14,10 SAY 'League Name' GET cLeague
DCTOOLBAR oToolBar
DCADDBUTTON "Next" PARENT oToolBar ;
ACTION {||TestUpdated(GetList,aLocals),;
dbSkip(1),
LoadFields(aLocals),
DC_GetRefresh(GetList),;
DC_GETORIGSET(GetList) }
DCADDBUTTON "Prev" PARENT oToolBar ;
ACTION {||TestUpdated(GetList,aLocals),;
dbSkip(-1),
LoadFields(aLocals),
DC_GetRefresh(GetList),;
DC_GETORIGSET(GetList) }
DC_ReadGets(Getlist)
/* ------------- */
STATIC function LoadFields( aLocals )
cPlayer := BASEBALL->player
cTeam := BASEBALL->team
cLeague := BASEBALL->league
RETURN nil
/* ------------- */
STATIC FUNCTION SaveFields( aLocals )
REPLACE BASEBALL->player WITH cPlayer
REPLACE BASEBALL->team WITH cTeam
REPLACE BASEBALL->league WITH cLeague
RETURN nil
/* ------------- */
STATIC FUNCTION TestUpdated ( GetList, aLocals )
IF DC_GetOrigUpdated( GetList )
IF DC_MsgBox(,,{"Data has been modified. Save Changes?'},,,,.t.)
SaveFields( aLocals )
ENDIF
ENDIF
RETURN nil
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readgui()
dc_getorigset()
dc_getrefresh()
dc_getorigupdated()
Test the original values of the Dialog items in the Getlist
Syntax:
DC_GetOrigUpdated ( < aGetList >, ;
[< cID > | < nItem >], ;
[< ancGroup >], ;
[< lVerbose >] ) - > lStatus
Arguments:
< aGetList > is an array containing a list of Get objects to
refresh. The GetList must a Gui-based Get List compatible
with DC_ReadGets() or DC_ReadGui().
< cID > is the ID of the GET object. This is the ID that was
assigned with the ID < cId > argument of the command that added
the object to the GetList.
< nItem > is the item number in the GetList. If no < cId > or
< nItem > argument is passed, then the entire GetList will be
tested, otherwise only the specified ID or ITEM will be
tested.
< ancGroup > is the GetList group to test. Each item in the
GetList may be assigned a group name or number via the
GROUP < ancGroup > clause. If a numeric or character value is
passed, then only the items in the GetList which match < ancGroup >
will be tested. < ancGroup > may consist of an array of numeric
values or character values so that more than one group may be
tested. If < ancGroup > is a nil then all items in the GetList will
be tested.
< lVerbose > if .TRUE. will display a message window about which
item of the GetList has been updated. This helps in debugging.
The default is .FALSE.
Returns:
A logical value.
Description:
DC_GETORIGUPDATED() is used to test the current value of all
the GETS or a specified GET in the GUI Getlist to the ORIGINAL
value element of the Getlist array object. If the current value
of the GET is not equal to the original value, the function returns
a .TRUE. If the current value of the GET equals the original
value, the function returns a .FALSE.
Examples:
#include 'dcdialog.ch'
PROCEDURE XTest()
#define cDesc aLocals[1]
#define cType aLocals[2]
#define cSubType aLocals[3]
#define oToolBar aLocals[4]
LOCAL aLocals[4], GetList := {}, GetOptions
USE COLLECT NEW EXCLUSIVE
LoadFields( aLocals )
@ 5,10 DCSAY 'Description' GET cDesc
@ 6,10 DCSAY ' Type' GET cType
@ 7,10 DCSAY ' Sub-Type' GET cSubType
DCTOOLBAR oToolBar
DCADDBUTTON CAPTION "Next" PARENT oToolBar ;
SIZE 9 ;
ACTION {||TestUpdated(GetList,aLocals),;
dbSkip(1), ;
LoadFields(aLocals), ;
DC_GetRefresh(GetList),;
DC_GetOrigSet(GetList) }
DCADDBUTTON CAPTION "Prev" PARENT oToolBar ;
SIZE 9 ;
ACTION {||TestUpdated(GetList,aLocals),;
dbSkip(-1), ;
LoadFields(aLocals), ;
DC_GetRefresh(GetList),;
DC_GetOrigSet(GetList) }
DCGETOPTIONS ;
WINDOW WIDTH 300 ;
WINDOW HEIGHT 300
DCREAD GUI ;
FIT ;
OPTIONS GetOptions ;
ADDBUTTONS
RETURN
/* ------------- */
STATIC function LoadFields( aLocals )
cDesc := COLLECT->descrip
cType := COLLECT->type
cSubType := COLLECT->sub_type
RETURN nil
/* ------------- */
STATIC FUNCTION SaveFields( aLocals )
REPLACE COLLECT->descrip WITH cDesc
REPLACE COLLECT->type WITH cType
REPLACE COLLECT->sub_type WITH cSubType
RETURN nil
/* ------------- */
STATIC FUNCTION TestUpdated ( GetList, aLocals )
IF DC_GETORIGUPDATED( GetList )
IF DC_MsgBox(,,{'Data has been modified. Save Changes?'},,,,.t.)
SaveFields( aLocals )
ENDIF
ENDIF
RETURN nil
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readgui()
dc_getorigset()
dc_getrefresh()
dc_getpopupautohide()
A Get-Set function for hiding un-focused POPUP buttons
Syntax:
DC_GetPopupAutoHide( [< lSetting >] ) - > lOldSetting
Arguments:
< lSetting > if .TRUE. will cause POPUP buttons that are attached
to @..DCSAY..GET objects via the POPUP clause, to be hidden
whenever any associated EDITPROTECT codeblock evaluates .TRUE.
The default is .FALSE. The default behavior is to disable the
button from activation.
Returns:
The previous setting.
Description:
DC_GetPopupAutoHide() is a Get-Set function used to hide
@..DCSAY..GET..POPUP buttons until the associated GET receives
focus.
Examples:
For a functionality equivalent to Microsoft's Outlook Contact
Manager, include the following at the start of your application:
DC_GetPopupCaption({ '', BITMAP_PENCIL_S, 0 })
DC_GetPopupAutoHide(.t.)
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
@ DCSAY GET
dc_getpopupcaption()
Set the default caption for the POPUP pushbutton
Syntax:
DC_GetPopupCaption( [< aCaption >] ) - > aOldCaption
Arguments:
< aCaption > is an array of six elements:
1. The font of the caption. This must be a standard compound
font name.
2. A character string or Bitmap resource for the caption. If
it is a numeric value, the resource must be linked into the
.EXE.
3. A numeric value defining the style of popup button.
0 - Create the button on the same parent as the GET. The
height and width is the same as the height of the GET.
The button is placed behind the GET. (DEFAULT).
1 - Create the button within the GET object at the end of
the GET. This is visually identical to a button in
a combobox.
4. A numeric value (in pixels) equivalent to the default width
of the button
5. A numeric value (in pixels) equivalent to the default height
of the button
6. A numeric value for the Hot-Key to use to invoke the button
when the associated GET has focus. Keys are defined in
APPEVENT.CH are are prefixed with xbeK_.
Returns:
The previous setting of the font and caption.
Description:
DC_GETPOPUPCAPTION() is used to change the default caption for
the POPUP pushbutton which is used with the POPUP clause of
the @ DCSAY..GET and @ DCGET commands. The caption defaults
to three dots.
Exported Instance Variables:
Notes:
Examples:
#include "DCBITMAP.CH"
FUNCTION XTest()
LOCAL GetList := {}, dDate := Date(), xCaption
DC_GETPOPUPCAPTION( { '10.Marlett', 'u' } ) // down arrow
@ 1,1 DCSAY 'Enter Date ' GET dDate POPUP {|d|DC_PopDate(d)}
DCREAD GUI FIT ADDBUTTONS
RETURN dDate
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
@ DCSAY GET
dc_getpopupprotecthide()
A Get-Set function for hiding protected POPUP buttons
Syntax:
DC_GetPopupProtectHide( [< lSetting >] ) - > lOldSetting
Arguments:
< lSetting > if .TRUE. will cause POPUP buttons that are attached
to @..DCSAY..GET objects via the POPUP clause, to be hidden
whenever any associated EDITPROTECT codeblock evaluates .TRUE.
The default is .FALSE. The default behavior is to disable the
button from activation.
Returns:
The previous setting.
Description:
DC_GetPopupProtectHide() is a Get-Set function used to hide
@..DCSAY..GET..POPUP buttons when the EDITPROTECT codeblock
evaluates .TRUE.
Examples:
FUNCTION XTest()
LOCAL GetList := {}, dDate := Date(), lEditMode := .f.
DC_GETPOPUPPROTECTHIDE( .t. )
@ 1,1 DCSAY 'Enter Date ' GET dDate POPUP {|d|DC_PopDate(d)} ;
EDITPROTECT {||!lEditMode}
DCREAD GUI FIT ADDBUTTONS
RETURN dDate
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
@ DCSAY GET
dc_getprogress()
Update a Progress bar object
Syntax:
DC_GetProgress ( < oProgress >, ;
< nCurrCount >, ;
< nMaxCount >, ;
< nEvery > ) - > .T.
Arguments:
< oProgress > is the Progress bar object created by the
@..DCPROGRESS command.
< nCurrCount > is the current count. For example, when updating
a progress bar while copying records, this would be RecNo().
< nMaxCount > is the maximum count. For example, when updating a
progress bar while copying records, this would be RecCount().
< nEvery > is the number of records that are traversed before the
progress bar is updated.
Returns:
A logical .TRUE.
Description:
DC_GETPROGRESS() is used in conjunction with @..DCPROGRESS to
display a progress bar any type of operation. The progress bar
will fill in the specified area with a graphic progress bar.
Examples:
#include 'dcdialog.ch'
#include 'gra.ch'
PROCEDURE XTest()
LOCAL Getlist := {}, oProgress, oDialog
USE customer
DC_Gui(.t.)
@ 2,5 DCSAY 'Exporting Data to JUNK.DBF'
@ 4,5 DCPROGRESS oProgress ;
SIZE 60,1.5 ;
MAXCOUNT RecCount() COLOR GRA_CLR_BLUE
DCREAD GUI TITLE 'My Test Dialog' ;
PARENT @oDialog ;
FIT ;
EXIT
oDialog:show()
COPY TO junk WHILE DC_GetProgress( oProgress, RecNo() )
DC_MsgBox('Done')
oDialog:Destroy()
RETURN
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
@ DCPROGRESS
dc_progress
dc_working
dc_getproperty()
Return the value of a Getlist property from an object
Syntax:
DC_GetProperty ( < oXbp >, ;
< nProperty >, ;
[@< aGetList >], ;
[@< aGetListItem >], ;
[@< nPointer >] ) - > xValue
Arguments:
< oXbp > is a pointer to any object that was created by DC_ReadGui().
< nProperty > is a numeric value defined in DCDIALOG.CH. See
DIALOG GETLIST for a definition of these manifest constants.
@< aGetList > is a variable, passed by reference, to store a pointer
to the GetList that is associated with the object.
@< aGetListItem > is a variable, passed by reference, to store a
pointer to the GetList Item that is associated with the object.
@< nPointer > is a variable, passed by reference, to store the
numeric position (array element #) of this item in the GetList.
Returns:
A value from the Getlist associated with the object and property
index.
Description:
DC_GETPROPERTY() is used to return a specified property from
the GetList that is associated with a specified object.
Exported Instance Variables:
Methods:
Notes:
Examples:
-- Example 1 --
#include 'dcdialog.ch'
PROCEDURE XTest()
@ 1,1 DCPUSHBUTTON CAPTION 'Testing' SIZE 10,1 ;
ACTION {|o|GetCaption(o)}
DCREAD GUI FIT ADDBUTTONS
RETURN nil
* -------------
STATIC FUNCTION GetCaption( oXbp )
? DC_GetProperty( oXbp, cGETLIST_CAPTION )
RETURN nil
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_setproperty()
dc_getobject()
DIALOG GETLIST
dc_getreadinsert()
a Get-Set function for establishing default Insert mode
Syntax:
DC_GetReadInsert( [< nInsertMode >] ) - >
< nOldInsertMode >
Arguments:
< nInsertMode > will set the insert mode based on the following table:
nMode Description
----- -------------------------------------------
2 Set Insert Mode ON
1 Set Insert Mode OFF (Overstrike ON)
0 Do not change Insert/Overstrike mode
.T. Set Insert Mode ON (compatability with build 232)
.F. Set Insert Mode OFF (compatability with build 232)
Returns:
A logical value.
Description:
DC_GetReadInsert() is a Get/Set function used to set the default
Insert mode when entering a new dialog.
Examples:
@ 1,1 DCGET dDate
DC_GetReadInsertMode(.f.) // set overstrike mode
DCREAD GUI FIT
Source/Library:
_DCXBPGT.PRG
dc_getrefresh()
Refresh the display of all objects in the Get List
Syntax:
DC_GetRefresh ( < aGetList|oXbp >, ;
[< nElement > | < cID > ], ;
[< nRefreshMode >], ;
[< aRefreshList >], ;
[< ancGroup >], ;
[< lDataLink >], ;
[< lInvisible >] ) - > nil
Arguments:
< aGetList|oXbp > is an array containing a list of Get objects to
refresh. The GetList may be Dual-Mode Getlist compatible
with DC_ReadGets() or DC_ReadGui() or a text-based GetList
compatible with DC_ReadModal(). Alternatively, it may be a pointer
to an Xbase++ object. If it is an object, then the remaining
parameters are ignored. If it is an object, then all objects
that are also descendents of < oXbp > will also be refreshed.
The second parameter may be a numeric value, a character string,
or a NIL. If it is a numeric value, then < nElement > is a
specific GetList element to refresh. This must be a number from
1 to the Length of < aGetList >. If it is a character string, then
< cID > is a character string equal to the ID of the GetList element
to refresh. If no parameter is passed then the entire Getlist will
be refreshed.
< nRefreshMode > and < aRefreshList > are used together to
refresh
the Getlist based on the Refresh Mode < nRefreshMode > and the
contents of < aRefreshList >. These parameters can be used to
refresh all items in the Getlist "except" a specified list
or only those in a specified list. < aRefreshList > is an array
of Character strings matching the cGETLIST_ID element of the
GetList if < nRefreshMode > is DCGETREFRESH_ID_* -or-
< aRefreshList >
is an array of Numeric values matching the nGETLIST_TYPE of the
GetList if < nRefreshMode > is DCGETREFRESH_TYPE_*.
< nRefreshMode > Description
--------------- ---------------------------------------
DCGETREFRESH_ID_INCLUDE Refresh only the items with IDs that
are included in < aRefreshList >.
DCGETREFRESH_ID_EXCLUDE Refresh all items with IDs that are
NOT included in < aRefreshList >.
DCGETREFRESH_TYPE_INCLUDE Refresh only the items with TYPEs that
are included in < aRefreshList >.
DCGETREFRESH_TYPE_EXCLUDE Refresh all items with TYPEs that are
NOT included in < aRefreshList >.
< ancGroup > is the GetList group to refresh. Each item in the
GetList may be assigned a group name or number via the
GROUP < ancGroup > clause. If a numeric or character value is passed
then only the items in the GetList which match < ancGroup > will be
refreshed. < ancGroup > may consist of an array of numeric values
or character values so that more than one group may be refreshed.
If < ancGroup > is a nil then all items in the GetList will be
refreshed.
If < lDataLink > is .TRUE. (default) any code blocks associated
with the DATALINK clause of DC* commands will also be evaluated
when the associated object is refreshed. If < lDataLink > is
.FALSE. then the DATALINK code block is ignored during refresh.
If < lInvisible > is .TRUE. (default) any object that is not
visible, ie, oXbp:isVisible() returns a false, will be refreshed.
If < lInvisible > is .FALSE. invisible objects will not be refreshed.
NOTE: Objects are considered invisible if they are hidden or if
they are on tabpages that are minimimized. Setting < lInvisible >
to .FALSE. can improved performance on applications with many
objects and many tabpages.
Returns:
.TRUE. if any gets were updated, .FALSE. otherwise.
Description:
DC_GETREFRESH() is used to refresh all the objects in the
GetList array that have a datalink via a codeblock. Use
this function to update the dialogue screen after changing
the value of one of the variables via a button action or
in your custom event handler.
DC_GetRefreshBlock() is a Get-Set function that is used to post
a code block to call every time DC_GetRefresh() is called. This
may be used to help debug problems with refreshing.
Notes:
DC_GetRefresh() will not refresh DCGRA* items, such as @ DCGRABOX,
@ DCGRASTRING or @ DCSAY..GRASTRING. Use the function
DC_PaintGraControls().
Examples:
-- Example 1 --
#include 'dcdialog.ch'
PROCEDURE XTest()
#define cDesc aLocals[1]
#define cType aLocals[2]
#define cSubType aLocals[3]
#define oToolBar aLocals[4]
LOCAL aLocals[4], GetList := {}, GetOptions
USE COLLECT NEW EXCLUSIVE
LoadFields( aLocals )
@ 5,10 DCSAY 'Description' GET cDesc
@ 6,10 DCSAY ' Type' GET cType
@ 7,10 DCSAY ' Sub-Type' GET cSubType
DCTOOLBAR oToolBar
DCADDBUTTON CAPTION "Next" PARENT oToolBar ;
SIZE 9 ;
ACTION {||TestUpdated(GetList,aLocals),;
dbSkip(1), ;
LoadFields(aLocals), ;
DC_GetRefresh(GetList),;
DC_GetOrigSet(GetList) }
DCADDBUTTON CAPTION "Prev" PARENT oToolBar ;
SIZE 9 ;
ACTION {||TestUpdated(GetList,aLocals),;
dbSkip(-1), ;
LoadFields(aLocals), ;
DC_GetRefresh(GetList),;
DC_GetOrigSet(GetList) }
DCGETOPTIONS ;
WINDOW WIDTH 300 ;
WINDOW HEIGHT 300
DCREAD GUI ;
FIT ;
OPTIONS GetOptions ;
ADDBUTTONS
RETURN
/* ------------- */
STATIC function LoadFields( aLocals )
cDesc := COLLECT->descrip
cType := COLLECT->type
cSubType := COLLECT->sub_type
RETURN nil
/* ------------- */
STATIC FUNCTION SaveFields( aLocals )
REPLACE COLLECT->descrip WITH cDesc
REPLACE COLLECT->type WITH cType
REPLACE COLLECT->sub_type WITH cSubType
RETURN nil
/* ------------- */
STATIC FUNCTION TestUpdated ( GetList, aLocals )
IF DC_GETORIGUPDATED( GetList )
IF DC_MsgBox(,,{'Data has been modified. Save Changes?'},,,,.t.)
SaveFields( aLocals )
ENDIF
ENDIF
RETURN nil
-- Example 2 ---
/* This example refreshes all items in the Getlist except
GETLIST_BROWSE type objects. It is not always necessary to
refresh BROWSE objects and it can slow the system when
refreshing Browses often. */
#include 'dcdialog.ch'
DC_GETREFRESH( aGetList, nil, ;
DCGETREFRESH_TYPE_EXCLUDE, ;
{GETLIST_BROWSE} )
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_getrefreshblock()
dc_readgui()
dc_getwhen()
dc_getrefreshblock()
Post a code block for debugging DC_GetRefresh() problems
Syntax:
DC_GetRefreshBlock( < bBlock > ) - > bOldBlock
Arguments:
< bBlock > is a code block to evaluate inside the DC_GetRefresh()
function.
The first 5 parameters that are passed to DC_GetRefresh() are
also passed to the code block:
< aGetList >, < nElement >, < nRefreshMode >,
< aRefreshList >, < acGroup >
Description:
DC_GetRefreshBlock() is used to help in debugging DC_GetRefresh()
calls.
This is a handy function to determine where in the application
code, DC_GetRefresh() is being called. Often times, it is
called more often than needed, thereby causing unneedy screen
flickering and/or slowness.
Examples:
DC_GetRefreshBlock( {|a,b,c,d,e|(dcbdebug a,b,c,d,e)}
Source/Library:
_DCGETBX.PRG
See Also:
dc_getrefresh()
dc_gettitlebarheight()
Get the height of Dialog Title Bars
Syntax:
DC_GetTitleBarHeight() - > nHeight
Arguments:
None.
Returns:
A numeric value.
Description:
DC_GetTitleBarHeight() returns the height (in pixels) of the
Dialog window title bar. This height is normally set by the user
after clicking on "Desktop Properties".
Examples:
? DC_GetTitleBarHeight()
21
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_getvalidate()
Run validation logic in the GetList
Syntax:
DC_GetValidate( oXbp, ;
[< lPassBuffer >], ;
[< lTestForBlock >] ) - > lStatus
Arguments:
< oXbp > is the Xbase Parts object to validate. This is any
object created by a DC* command in the GetList that also has
an associated VALID clause.
< lPassBuffer > if .TRUE. will pass the contents of the display
buffer to the validation code block, otherwise if .FALSE.
(default), a pointer to the object will be passed to the
validation code block.
< lTestForBlock > if .TRUE. will only test for the existence of a
validation code block associated with an object but will not
evaluate the code block. If a code block exists, then the
function will return .TRUE. otherwise it will return .FALSE.
Returns:
The logical value returned by the VALID code block associated
with the Xbase Parts object.
Description:
DC_GetValidate() is used to test or run the validation code
block associated with a specifed GET.
DC_GetValidate() is called automatically in DC_ReadGuiEventLoop()
after events that may change values referenced in a GET.
Examples:
oXbp := SetAppFocus()
? DC_GetValidate( oXbp )
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readgui()
dc_getrefresh()
dc_getvalidblock()
dc_getvalidateonchange()
dc_getvalidateonchange()
A Get-Set function to determine Validation rule
Syntax:
DC_GetValidateOnChange( [< lSetting >] ) - > lOldSetting
Arguments:
< lSetting > if .TRUE. will cause the validation code block
only to be evaluated if the value of the Get has changed. The
default is .FALSE.
Description:
DC_GetValidateOnChange() is a get-set function that is used to
modify the behavior of GET validations.
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
See Also:
dc_getvalidate()
dc_getvalidblock()
A Get-Set function for posting a default validation block
Syntax:
DC_GetValidBlock( [< bValidate >] ) - > bOldValidate
Arguments:
< bValidate > is a code block that will be evaluated when
any DC_XbpGet() object loses focus. The object will be
passed to the code block. The code block must return a
logical value. If it returns a .TRUE., then control will
be passed to the validation routine that evaluates the
specific validation block for the object. If it returns
a .FALSE., then the object cannot lose focus.
Returns:
The previously posted code block.
Description:
DC_GetValidBlock() is a Get-Set function that is used to
post a "default" validation code block for @..DCSAY..GET
and @..DCGET objects. The default code block will be
evaluated first before evaluating any code block posted
with the VALID clause. This is handy for special date
validations.
Examples:
FUNCTION XTest()
LOCAL GetList[0], cTime := ' : : '
DC_GetValidBlock({|o|MySpecialValidator(o)})
@ 1,1 DCSAY 'Enter Time' GET cTime PICT '99:99:99'
DCREAD GUI FIT ADDBUTTONS ENTEREXIT
RETURN nil
* -----------
FUNCTION MySpecialValidator( oGet )
LOCAL xValue := oGet:get:varget()
IF Valtype(xValue) == 'C' .AND. Len(xValue) = 8 .AND. ;
xValue[3] == ':' .AND. xValue[6] == ':'
// this is a "Time" Get
nHours := Min(Val(Substr(xValue,1,2)),23)
nMinutes := Min(Val(Substr(xValue,4,2)),59)
nSeconds := Min(Val(Substr(xValue,7,2)),59)
xValue := DC_PadZero(Str(nHours,2)) + ':' + ;
DC_PadZero(Str(nMinutes,2)) + ':' + ;
DC_PadZero(Str(nSeconds))
oGet:_assign(xValue)
ENDIF
RETURN .t.
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
See Also:
@ DCSAY
dc_getvalidate()
dc_getvalidateonchange()
dc_getwhen()
Refresh the WHEN/HIDE status of object(s) in the GetList
Syntax:
DC_GetWhen ( < aGetList | oXbp >, ;
[< nElement >], ;
[< lTestProtect >], ;
[< acID >], ;
[< acGroup > ) - > nil
Arguments:
< aGetList > is an array containing a list of Get objects to
refresh. Alternatively, the first parameter may be an object
of the DC_Xbp*() class. If this paramter is an object, then
the remaining parameters are not used.
< nElement > is the element number of the GetList to test. If
this parameter is not passed, then all items in the GetList will
be tested.
< lTestProtect > is reserved for internal use.
< acID > is an Object ID or array of ID's to evaluate. When this
parameter is used, only this ID or list of ID's will be refreshed.
< acGroup > is a Group ID or array of Group ID's to evaluate. When
this parameter is used, only this Group or list of Groups will
be refreshed.
Returns:
Nil.
Description:
DC_GetWhen() is used to refresh the WHEN/HIDE status of objects
in the GetList. If the WHEN clause or HIDE clause is used with
a DC* command, it is the function DC_GetWhen() that evaluates
the code block associated with the WHEN or HIDE clauses and
uses the :disable()/:enable and/or :hide()/:show() method of the
Xbase Parts class dependent on the value returned by the
associated code block.
DC_GetWhen() is called automatically in DC_ReadGuiEventLoop()
after events that may change values referenced in WHEN/HIDE
code blocks. DC_GetWhen() is also called from DC_GetRefresh().
Examples:
-- Example 1 --
oXbp := SetAppFocus()
aGetList := oXbp:cargo[2]
nElement := oXbp:cargo[1]
DC_GetWhen( aGetList, nElement )
-- Example 2 --
DC_GetWhen( GetList,,,{'BUTTON1','BUTTON2'} )
-- Example 3 --
DC_GetWhen( GetList,,,,'GROUP1' )
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readgui()
dc_getrefresh()
dc_readguieventloop()
dc_getwhenonbrowseitemmarked()
Get-set function that enable DC_GetWhen() on item marked event
Syntax:
DC_GetWhenOnBrowseItemMarked( [< lEnable > ] ) - > lOldEnable
Arguments:
< lEnable > if .TRUE. will enable evaluation of HIDE and WHEN clauses.
The default is .FALSE.
Description:
DC_GetWhenOnBrowseItemMarked() is a Get-Set function that enables
DC_GetWhen() calls when an xbeBRW_ItemMarked event occurs.
This would be used in case it is needed to insure that all WHEN
and HIDE clauses in a dialog are evaluated any time the row
pointer is moved in the browse. The default is .FALSE. for
performance reasons.
Source/Library:
_dcxbrow.prg, dclipx.dll
See Also:
@ DCBROWSE
dc_getworkarea()
Get the actual working area of the Desktop
Syntax:
DC_GetWorkArea() - > aCoords
Arguments:
None.
Returns:
An array of 4 elements:
{ left, top, right, bottom }
left
Specifies the x-coordinate of the upper-left corner of the
rectangle.
top
Specifies the y-coordinate of the upper-left corner of the
rectangle.
right
Specifies the x-coordinate of the lower-right corner of the
rectangle.
bottom
Specifies the y-coordinate of the lower-right corner of the
rectangle.
Description:
DC_GetWorkArea() returns an array of 4 elements containing the
usable work area of the AppDesktop(). AppDeskTop():currentSize()
will return the full size of the desktop, however, the user may
have limited the useful area by setting toolbars on the desktop
as "always on top". DC_GetWorkArea() is used to determine the
useable area of the desktop.
Retrieves the size of the work area on the primary display monitor.
The work area is the portion of the screen not obscured by the
system taskbar or by application desktop toolbars.
Examples:
// This example will create a dialog window that is sized and
positioned to fill the useable workarea of the desktop.
aWorkArea := DC_GetWorkArea()
nHeight := aWorkArea[4] - aWorkArea[2]
nWidth := aWorkArea[3] - aWorkArea[1]
oDlg := XbpDialog():new( AppDeskTop(), , ;
{aWorkArea[1],AppDeskTop():currentSize()[2]-aWorkArea[4]}, ;
{nWidth,nHeight}, , .F.)
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_gotoget()
Go directly to a desired GET
Syntax:
DC_GoToGet () - > nil
Arguments:
none.
Returns:
NIL
Description:
DC_GOTOGET() is handy if you have a large table of GETS on the
screen and don't have a mouse, but want to give the operator
an opportunity to go directly to a GET # by typing in the GET
number.
Notes:
This function only works with DC_ReadModal(), NOT ReadModal().
Examples:
SetKey( -1, { || DC_GOTOGET() } )
DC_ReadModal( GetList )
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_gra2color()
Convert GUI compatible color to a color string
Syntax:
DC_Gra2Color( < aColor > ) - > cColorString
Arguments:
< aColor > is an array of two numeric elements. The first
element is the foreground color. The second element is the
background color.
Returns:
A character string.
Description:
DC_GRA2COLOR() is used to convert an 2 element array containing
a foreground and background color that are compatible with GUI
objects to a color string that is compatible with text objects.
Examples:
#include "gra.ch"
PROCEDURE Xtest()
LOCAL aColor := { GRA_CLR_RED, GRA_CLR_WHITE }
DC_Gui(.t.)
DC_MsgBox( DC_Gra2Color( aColor ) )
RETURN
Source/Library:
_DCCOLOR.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_color2gra()
dc_graquerytextbox()
Get the width and height of a text string based on a font
Syntax:
DC_GraQueryTextBox( < cString >, ;
< cFont > ) - > aSize
Arguments:
< cString > is a text string.
< cFont > is a character string containing the name of the font
which conforms to a standard Xbase++ font definition, such as
'12.Arial Bold'.
Returns:
A two element array of numeric values.
[1] - Width
[2] - Height
Description:
DC_GraQueryTextBox() is used to calculate the width and height,
in pixels, of a text string based on a specified font. This is
basically a wrapper function for the Xbase++ function GraQueryTextBox()
which is simpler to use.
Examples:
PROCEDURE XTest( )
LOCAL i, j, cFont, nRow, lOk, GetList := {}, nHeight
FOR i := 8 TO 22 STEP 2
cFont := Alltrim(Str(i)) + '.Arial'
nHeight := DC_GraQueryTextBox( 'Text', cFont )[2]
nRow := 1
FOR j := 1 TO 10
@ nRow, 0 DCSAY 'This is line ' + Alltrim(Str(j)) ;
FONT cFont SAYSIZE 0 PIXEL
nRow += nHeight
NEXT
DCREAD GUI FIT ADDBUTTONS TO lOk
IF !lOk
EXIT
ENDIF
NEXT
RETURN
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_groupboxfix()
A Get-Set function used to fix group box problem on XP
Syntax:
DC_GroupBoxFix( [< lFix >] ) - > lOldFix
Arguments:
< lFix > if .TRUE. will create two XbpStatic objects, if .FALSE.
will function normally and create only one XbpStatic object.
Description:
DC_GroupBoxFix() is a Get-Set function that is used to set the
method in which DCGROUP static boxes will be created due to an
Xbase++ anomoly that displays XbpRadioButton() objects incorrectly
when the parent is a XbpStatic() type XBPSTATIC_TYPE_GROUPBOX
and the application is using a MANIFEST file.
Run the sample program in \exp18\samples\xp for more information
about using manifest files to display XP style dialog objects.
When set to .T., every DCGROUP command will create two XbpStatic()
objects instead of one. The parent of the groupbox will be a
static of type text and will be the exact same size. This
eliminates the display problem under XP.
Examples:
#INCLUDE "dcdialog.CH"
FUNCTION main
LOCAL GetList[0], GetOptions, d := Date(), nGroup := 3, i, oGroup, oStatic, ;
lCheck := .F.
IF 'Windows XP' $ Os() .AND. File('TEST.EXE.MANIFEST')
DC_GroupBoxFix(.t.)
ENDIF
FOR i := 1 TO 10
@ i,0 DCSAY 'Date ' + Alltrim(Str(i)) GET d POPUP {|d|DC_PopDate(d,,,,,,2)}
NEXT
@ 1,27 DCGROUP oGroup CAPTION 'Group Test' SIZE 20,10 PARENT oStatic
FOR i := 1 TO 4
@ i,1 DCRADIO nGroup VALUE i PROMPT 'Radio Button ' + Alltrim(Str(i)) PARENT
oGroup
NEXT
FOR i := 1 TO 4
@ i+4,1 DCCHECKBOX lCheck PROMPT 'Check Box ' + Alltrim(Str(i)) PARENT
oGroup
NEXT
FOR i := 1 TO 10
@ i,50 DCPUSHBUTTON CAPTION 'Button ' + Alltrim(Str(i)) ;
SIZE 10,1 ACTION {||MsgBox('button test')}
NEXT
DCGETOPTIONS ;
SAYWIDTH 50 ;
SAYRIGHTBOTTOM ;
HILITEGETS GRA_CLR_RED ;
COLORGETS { {GRA_CLR_RED,GRA_CLR_YELLOW} } ;
BUTTONALIGN DCGUI_BUTTONALIGN_CENTER
DCREAD GUI ;
FIT ;
MODAL ;
SETAPPWINDOW ;
ADDBUTTONS ;
OPTIONS GetOptions ;
TITLE 'XP Manifest Sample'
RETURN nil
* -----------
PROC appsys
RETURN
Source/Library:
_DCCLASS.PRG, DCLIPX.DLL
dc_gui()
Set the Dialogue mode to GUI or TEXT
Syntax:
DC_Gui( [< lMode >] ) - > lOldMode
Arguments:
< lMode > if .TRUE. sets GUI mode ON, if .FALSE. sets GUI mode OFF.
If < lMode > is not passed, then the GUI mode is not changed.
Returns:
Tha previous setting of GUI mode.
Description:
DC_Gui() is used to set Text or Gui mode for Dual-Mode
Functions. The eXPress++ library contains a variety of
functions which operate in "Dual-Mode". When GUI mode is
ON, the function uses a GUI dialogue based on Xbase Parts. When
the GUI mode is OFF the function works in standard text-mode.
Examples:
/*
In this example, DC_ReadBox() and DC_Impl() will only
display and restore the window in Text-Mode. They are
ignored in GUI mode.
*/
#include "dcdialog.ch"
PROCEDURE Xtest( lGui )
LOCAL GetList := {}, GetOptions, aReadArea, cLastName := Space(15), ;
cFirstName := Space(15), cCompany := Space(25), ;
cStreet := Space(25), cCity := Space(25), cState := Space(2), ;
cCountry := Space(25), cPhone := Space(15), cScrn, lOk
lGui := IIF( Valtype(lGui)='L',lGui,.t.)
DC_Gui(lGui) // set GUI mode
cScrn := DC_ReadBox(3,5,15,75,,@aReadArea)
@ 5,10 DCSAY ' Last Name' GET cLastName
@ 5,40 DCSAY 'First Name' GET cFirstName
@ 7,10 DCSAY ' Company' GET cCompany
@ 8,10 DCSAY ' Street' GET cStreet
@ 9,10 DCSAY ' City' GET cCity
@10,10 DCSAY ' State' GET cState
@11,10 DCSAY ' Country' GET cCountry
@13,10 DCSAY ' Phone' GET cPhone PICT '(999)-999-9999'
DCGETOPTIONS SAYWIDTH 70 SAYRIGHTJUST
lOk := DC_ReadGets( GetList,"Enter Data",aReadArea,;
GetOptions )
DC_Impl(cScrn)
RETURN
Source/Library:
_DCGUI.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readgui()
GUI
dc_guiabrowse()
Browse a multi-dimensional array using Tree-View
Syntax:
DC_GuiAbrowse( < aArray >, ;
[< aRef >], ;
[< oParent >], ;
[< aPos >], ;
[< aSize >], ;
[< cTitle >], ;
[< lHasButtons >], ;
[< lHasLines >] ) - > oArrayTree
Arguments:
< aArray > is the multi-dimensional array to browse.
< aRef > is an optional reference array that is used to format the
data in the browse. If < aRef > is a NIL then the tree view will
display the exact contents of the array. < aRef > is an array of
5-element sub-arrays, 1 for each level of the array being browsed.
The sub-arrays are defined as follows:
Element Type Description
------- ---- ----------------------------------------------------
[1] B Optional code block used to format the displayed
data. The array item and it's ordinal position
within the array are passed as parameters.
examples: {|a,n|a[1]}
{|a,n|filedata(a,n)}
[2] N The resource ID of a bitmap or icon image to
visualize the normal state of the array item
(not marked and not expanded).
[3] N The resource ID of a bitmap or icon image to
visualize the marked state of the array item.
[4] N The resource ID of a bitmap or icon image to
visualize the expanded state of the array item.
[5] A An optional array of numeric values containing
the array elements to include in the expanded
view.
< oParent > is the parent object for the tree-view. This is usually
an XbpStatic or XbpTabPage object. If no parent object is passed,
then an XbpDialog object will be created as the parent.
< aPos > is a 2-element array containing the pixel coordinates
of the starting location of the tree-view window. Default is {0,0}
< aSize > is a 2-element array containing the width and height (in
pixels) of the tree-view window. Default is {300,400}.
< cTitle > is the title of the Dialog Window. This parameter is
ignored if < oParent > is a nil.
If < lHasButtons > is set to .T. (default), the tree view displays a
Plus or Minus sign at each node of the tree. This indicates whether
the next level of the tree can be expanded or suppressed.
If < lHasLines > is set to .T. (default), the tree view displays lines
between the nodes of the tree and their leaves. This results in a
more readable display.
Returns:
A pointer to the tree-view object.
Description:
DC_GUIABROWSE() is an array-browser that provides a tree-view
style browse of any multi-dimensional array.
Examples:
#INCLUDE "dcicon.ch"
FUNCTION Xtest()
LOCAL aDirectory, aDirOptions
aDirectory := Directory( '*.*' )
IF Len(aDirectory) > 50
ASize(aDirectory,50)
ENDIF
aDirOptions := { { {|a,n|a[1]}, ;
ICON_CLOSEDFOLDER, ;
ICON_CLOSEDFOLDER, ;
ICON_OPENFOLDER }, ;
{ {|a,n|FileData(a,n)}, ;
ICON_CLOSEDFOLDER, ;
ICON_CLOSEDFOLDER, ;
ICON_OPENFOLDER, ;
{ 2,3,4,7,8 } } }
DC_GuiABrowse( aDirectory, aDirOptions, nil, nil, nil, ;
'Directory of Files' )
RETURN nil
/* ------------------- */
STATIC FUNCTION FileData ( xData, nElement )
LOCAL cData := DC_XtoC( xData ), cPrefix
DO CASE
CASE nElement = 2
cPrefix := 'File Size: '
CASE nElement = 3
cPrefix := 'File Date: '
CASE nElement = 4
cPrefix := 'File Time: '
CASE nElement = 7
cPrefix := 'Creation Date: '
CASE nElement = 8
cPrefix := 'Creation Time: '
OTHERWISE
cPrefix := ''
ENDCASE
RETURN cPrefix + cData
Source/Library:
_DCABROW.PRG, DCLIPX.LIB
See Also:
@ DCTREEARRAY
dc_guiachoice()
A GUI replacement for ACHOICE()
Syntax:
DC_GuiAChoice ( < nTop >, ;
< nLeft >, ;
< nBottom >, ;
< nRight >, ;
< aMenuItems >, ;
[< aSelItems >], ;
[< cUserFunc > | < bUserFunc >], ;
[< nInitialItem >], ;
[< nWindowRow >], ;
[< cTitle >], ;
[< aHelpCodes >], ;
[< aMenu >], ;
[< cFontName >], ;
[@< oDlg >], ;
[< lDestroy >], ;
[< aMessage >], ;
[< cHeader >],;
[< lCenter >] ) - > nElement
Arguments:
< nTop >, < nLeft >, < nBottom >, < nRight >
are the screen
coordinates in pixels.
< aMenuItems > is an array of character strings to include
in the pick-list.
< aSelItems > is an array of logical values. There is one
element in this optional array for each element in
< aMenuItems >. Each element in < aSelItems > that is a
.TRUE. will make the item in the window a "selectable"
item, otherwise it will be a non-selectable item and will
be displayed in "grayed" form.
< cUserFunc > | < bUserFunc > is the name of an optional
User-Defined
function to call on exception keystrokes. See the Clipper
documentation of ACHOICE() for more information on how to use
a UDF. If the parameter is passed as a character string then
the function must be a PUBLIC, not STATIC function.
< nInitialItem > is the item to high-light in the window on
startup.
< nWindowRow > is the item to display as the first item in
the pick-list.
< cTitle > is the title of the window.
< aHelpCodes > is an array of character string HELP CODES.
There is one element in this optional array for each element in
< aMenuItems >. The HELP CODE will be passed on to the
DC_HelpF1() function for context-specific help if the operator
presses F1 on a selected item.
< aMenu > is an array defining a Top-Bar/Pull-Down menu. This
array must conform to the specification for the array passed
to the DC_MENUMAIN() function. This Top-Bar menu will be
painted at the screen coordinates defined in the menu if
< lAttachMenu > is .FALSE. or directly attached to the top of
the pick-list window if < lAttachMenu > is .FALSE. (default).
The menu will be energized if the operator presses a key
matching one of the hightlighted characters in the menu, or
if the mouse is clicked on one of the top-bar menu items.
The menu array must contain code-blocks for each menu item
to execute functions based on the menu selection. See
DC_MENUMAIN() for more information.
< cFontName > is the name of an optional font.
@< oDlg > is a variable to store the dialog object for the
pick-list.
< lDestroy > if .TRUE. (default) will destroy the dialog
object for the browse. If .FALSE., the dialog will remain
active. Set this to .FALSE. when using DC_GUIACHOICE() in
a loop.
< aMessage > is an optional array of character strings to use as a
message to be displayed in the dialog window above the pick-list.
< cHeader > is an optional heading.
< lCenter > if .TRUE. will center the dialog in the display.
Description:
DC_ACHOICE() is a Dual-mode replacement for AChoice(). When
the GUI flag is ON, DC_ACHOICE() functions similiar to
AChoice() except that it is displayed in GUI mode. When the
GUI flag is OFF, DC_ACHOICE() functions identical to ACHOICE()
except it is also activated by a mouse. The left button of the
mouse is used to select the item in the window. The right button
or double-clicking works identical to the ENTER key.
In TEXT mode, Hot keys can be activated by passing an array of
screen coordinates (mouse-buttons) and key definitions.
In TEXT mode, an options array is used to define scroll-bars,
colors, exit options, title, drag options, etc.
An optional array of Help-Codes may be passed for context-
specific help on any selected item with the F1 key.
Examples:
Source/Library:
_DCACHOI.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_achoice()
dc_guialert()
A GUI replacement for ALERT()
Syntax:
DC_GuiAlert( [< oOwner >], ;
[< acText >], ;
[< aCaption >], ;
[< nSysIcon >], ;
[< cTitle >], ;
[@< aDlgPos >], ;
[< lModal >], ;
[< aFonts >] ) - > nChoice
Arguments:
< oOwner > is the owner of the dialog. The default is
SetAppWindow().
< acText > may be a character string of text-lines (separated by
semi-colons) or an array of character strings for displaying
within the alert dialog above the button selections.
< aCaption > is an array of captions for buttons which will be
displayed in the dialog. A tilde (~) character within the
caption text will underline the following character in the
push-button and make it the hot-key. For example, '~Ok' will
underline the O in Ok and Alt-O will activate the button.
< nSysIcon > is the icon to display in the dialog. This is a
numeric constant from XBP.CH. The default is
XBPSTATIC_SYSICON_ICONQUESTION.
< cTitle > is the title to display in the title area of the dialog
window.
@< aDlgPos > is a numeric variable to store a two-element array
of coordinates which will be returned when the user exists the
alert window. These coordinates are the screen coordinates of
the dialog before it was destroyed. These coordinates may be
passed to DG_GUIALERT() again later to paint the dialog window
in the same location.
< lModal > if .TRUE. (default), will set the modal state of the
dialog window to APPMODAL.
< aFonts > is a 2-element array containing the Font Compound Name
for the buttons and the text. Element 1 is the button font and
element 2 is the text font.
Returns:
A numeric value equal to the button which was selected by the
user.
Description:
DC_GUIALERT() is a GUI replacement for Alert().
Notes:
The foreground and background color of the GUI alert box is
preset by the function DC_AlertColor().
Examples:
Source/Library:
_DCMENU2.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_alert()
dc_guialertcolor()
Preset the foreground/background color of DC_GuiAlert()
Syntax:
DC_GUIAlertColor( [< aColor >] ) - > aOldColor
Arguments:
< aColor > is an array of two colors. Element 1 is the foreground
color and element 2 is the background color. These may be
numeric colors defined by GRA_CLR_* constants in GRA.CH or they
may be 3-element arrays containing numeric RGB colors.
Returns:
An array containing the previously set colors.
Description:
DC_GUIALERTCOLOR() is used to establish the foreground and
background color of the GUI alert box painted by the functions
DC_Alert() in GUI mode and DC_GuiAlert().
Examples:
DC_GUIAlertColor( { GRA_CLR_WHITE, GRA_CLR_RED } )
DC_Gui(.t.)
DC_Alert('This is a test')
Source/Library:
_DCMENU2.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_alert()
dc_guialert()
dc_guigrumpbrow()
An emulation of Greg Lief's GrumpBrow()
Syntax:
The first 32 parameters are identical to the parameters used by
GrumpBrow(). Some of these parameters are not used either because
they have not yet been implemented or because they do not apply to
the GUI version.
DC_GUIGrumpBrow( [ < cSecurity >, ;
< nTop >, ;
< nLeft >, ;
< nBottom >, ;
< nRight >, ;
< lBox >, ; // not used
< aFields >, ;
< aHeads >, ;
< aPictures >, ;
< aAlternates >, ;
< xLow >, ;
< xHigh >, ;
< bVertical >, ; // not used
< bHorizontal >, ; // not used
< aExtraOptions >, ;
< nExtraOptionsKey >, ;
< cExtraOptionsTitle >, ;
< nExitKey >, ;
< aIndexDescriptions >, ;
< aValids >, ;
< aWhens >, ;
< nAutoRefresh >, ;
< nLockedColumns >, ;
< lCarry >, ;
< nMemoWidth >, ;
< cTitle >, ;
< nMemoHeight >, ;
< cColorSpec >, ; // not used
< aColorBlocks >, ;
< bInitial >, ;
< lGoTop >, ;
< aAlternateKeys >, ;
< aPresParam >, ;
< aColWidths >, ;
< aEditCoords >, ;
< acMenu >, ;
< cBrowFont >, ;
< lResize >, ;
@< aGrumpGetList >, ;
< lModal >, ;
< oParent >, ;
< oAppWindow > ] ) - > cOptions
Arguments:
All Parameters are optional.
< cSecurity > is a string defining the security level you want to give
your users. Case is not significant. You pass the first letter of
each feature that you wish to activate:
A Add
E Edit
D Delete
P Screen Painter // not supported
Q Query by example
S Search*
V View
N do Not allow individual field edit (see below)
C allow cell (individual field edit) only (no full-screen)
K allow user to pack the database
I allow user to swap index with ALT-I
L allow user to lock column with "L"
F allow user to "filter" (show data subset) with ALT-S
O output (print) all or some records (can be overridden
as item #8 in < aAlternates >... see below)
If you do not pass this parameter, all the user will be able to do is
browse vertically and Esc when they are finished.
*If no index file is open, or if the index key is not of character
type, you will not be able to Search, regardless of whether or not
you pass an "S" in < cSecurity >.
< nTop >, < nLeft >, < nBottom >, < nRight >
delineate the screen region to
be used for the browse. The default values are 0, 0, 24, and 79,
respectively.
< lBox > is ignored.
< aFields > contains character strings holding the names of the
fieldnames to show in the browse. Skip this parameter entirely if
you want to show all fields in the currently active database.
SPECIAL NOTE: you can alternatively put code blocks in < aFields >
to show any valid Xbase++ expression. Note that any such columns
will not be editable unless they are Get/Set code blocks. These
code blocks can be used for just about anything, including fields
in databases other than the currently active work area. You may
also wish to make these code blocks "get-set", which means that
they can assign values. For example, the following code block
displays the CUST- >LASTNAME field and allows the user to edit it
as well:
{ | x | if(x == NIL, cust- >lastname, cust- >lastname := x) }
< aHeads > contains column headings to be used for the browse. If you
do not pass this, the fieldnames will be used as column headings.
Skip this parameter if you do not wish to use it. NOTE: No default
heading will be provided for columns that are based on code blocks
(see < aFields > description above).
< aPictures > contains PICTURE clauses corresponding to each field.
You may use this if, for example, you wish to truncate certain
fields or use "Y" for logicals. If you do not pass this parameter,
DC_GuiGrumpBrow() will establish default PICTURE values for each
field that conform to the general norm. Use a null string if you
do not wish to use this parameter.
< aAlternates > is an eight element array which is used to override
the default add/edit/etc. routines. This array should be eight
elements long, and each element should contain either a code block
or a NIL. The elements correspond to the actions as follows:
aAlternate[1] = ADD function
aAlternate[2] = DELETE function
aAlternate[3] = EDIT function
aAlternate[4] = QUERY function
aAlternate[5] = SEARCH function
aAlternate[6] = VIEW function
aAlternate[7] = CELL EDIT codeblocks (see below)
aAlternate[8] = OUTPUT function
You only need to fill the elements that you wish to use. For
example, if you want to use your own Add and Edit routines, you
could do the following:
LOCAL aAlternate[8]
aAlternate[1] = { || SpecAdd() }
aAlternate[3] = { |b| SpecEdit(b)}
When the user presses "A" to Add or "E" to Edit, DC_GuiGrumpBrow()
would evaluate these blocks and call SpecAdd() or SpecEdit(),
respectively. Note that the second code block accepts a parameter
and passes it directly to SpecEdit(). This takes advantage of the
fact that DC_GuiGrumpBrow() will automatically pass the Browse
object and GetList to your alternate functions. You can therefore
manipulate the object as desired (e.g., resizing the window,
forcing a manual refresh, etc).
The seventh element of ALTERNATES array can contain an array
containing code blocks for the columns where alternate cell editing
is necessary.
< xLow > and < xHigh > allow you to restrict browsing
operations
to a subset of records, ie a SCOPE. These parameters may be of any
data type -- conversion will be handled internally by
DC_GuiGrumpBrow(). Note that the subset feature works only if you
have an index file open! Further note that if you have two indexes
open, and wish to switch between them using ALT-I,
DC_GuiGrumpBrow() will maintain a different data subset for each
index.
< bVertical > and < bHorizontal > are ignored.
< aExtraOptions > contains additional options which can be
accessed as a pop-up menu from within Grumpbrow(). The default key
to pop up this menu is ALT-F10, although this can be changed.
Create an array that contains nested arrays, each of which contains
the menu option as the first element and the code block to be
executed as the second element. For example:
{ ;
{ "First option", { || firstfunc() } }, ;
{ "Second option", { || secondfunc() } }, ;
{ "Third option", { | a,b | thirdfunc(a,b) } } ;
}
Note that the third code block accepts a parameter and sends it
through to the function. This is because DC_GuiGrumpBrow() will
pass the Browse object and GetList as parameters to your code
blocks when it evaluates them. Therefore you can write your code
blocks in this fashion to access the Browse object and manipulate
it as you see fit.
< nExtraOptionsKey > can be used to override the default (ALT-F10)
key to pop up the additional options menu.
< cExtraOptionsTitle > will be used as the title for the pop-up
menu window. By default, no title will be used.
< nExitKey > allows you to use a different key for exiting the
browse. Pass the INKEY value of the desired key as this parameter.
The default is K_ESC. If you wish to allow multiple exit keys, you
may pass an array containing the desired INKEY values as this
parameter (or in conjunction with the EXITKEY clause of the
GRUMPBROW user-defined command).
< aIndexDescriptions > contains descriptive character strings for
each active index. If you pass this parameter, these descriptions
will be displayed on the top row when users switch between indexes
with ALT-I. Otherwise, the regular indexkey will be displayed.
< aValids > and < aWhens > allow you to attach VALID and WHEN
clauses to any or all columns in the browse. If you use these, you
must use code blocks, and I would recommend generic coding to take
advantage of the GET object being passed as a parameter (e.g.,
{ |o| !empty(o:editBuffer()) }). Note that these will apply to
both single-field and full-screen editing, as well as adding new
records.
< nAutoRefresh > is ideal for multi-user programs. If you pass a
numeric expression as this parameter, DC_GuiGrumpBrow() will
automatically refresh the screen as often as you specify. Your
parameter represents the number of seconds.
< nLockedColumns > is a numeric indicating how many columns should
be locked from the outset. By default this will be zero.
< lCarry > enables the values from the current record to be
carried forward as the defaults for new records. Pass a logical
True if you want this behavior.
< nMemoWidth > is a numeric indicating the width to use for memo
windows. By default, this will be either 40 or the width of the
browse window, whichever is smaller.
< cTitle > is a character string to be centered on the top row of
the DC_GuiGrumpbrow() window. By default, no title will be used.
< nMemoHeight > is a numeric indicating the height to use for memo
windows. By default, this will be eight rows.
< cColorSpec > is ignored.
< aColorBlocks > allows you to initialize the colorBlock instance
variable for one or more columns within the browse. This array
should contain either code blocks or NILs.
< bInitial > will be evaluated just prior to the browse being
displayed. This allows you to manipulate the browse object (e.g.,
changing the separators, changing the defColor instance variable for
one or more columns, moving the cursor to some column other than the
first, etcetera). Your codeblock should be structured to accept one
parameter, which will be the browse object.
< lGoTop > enables you to force DC_GuiGrumpBrow() to move to the top
of the database each time that the user presses ALT-I to cycle
through the active indexes. Pass .T. if you desire this behavior.
By default, the record pointer will remain unchanged, unless a data
subset has been established for the index you are switching to, in
which case the record pointer will be moved to the first record in
said subset.
< aAlternateKeys > can be used to override the default keys listed
below for each DC_GuiGrumpBrow() behavior. This array would contain
nested arrays which correspond to the following actions:
Element Action Default Key Default Message
aKeys[1] ADD A [A]dd
aKeys[2] DELETE D [D]elete
aKeys[3] EDIT E [E]dit
aKeys[4] QUERY Q [Q]uery
aKeys[5] SEARCH S [S]earch
aKeys[6] VIEW V [V]iew
aKeys[7] (n/a)
aKeys[8] OUTPUT O [O]utput
aKeys[9] LOCKCOLUMN L [L]ock
aKeys[10] SUBSET Alt-S [Alt-S]ubset
aKeys[11] SWAPINDEX Alt-I [Alt-I]ndex
aKeys[12] PACK K pac[K]
The structure of each nested array is { < nInkeyValue >,
< cPrompt > }. If you do not need to change a particular key,
simply leave that array element NIL.
If you do not want to have any key tooltips displayed, simply pass
NIL as the second element of each nested array.
< aPresParam > is an array of presentation parameters for the
browse object. See the Xbase++ documentation for the XbpBrowse()
class for a specification of this array.
< aColWidths > is an array of numeric values for each browse
column, one for each element of < aFields >. For automatic sizing
insert a NIL in the array.
< aEditCoords > is an array of coordinates that defines the location
of the SAY (Header) prompt and GET (data) of each item in < aFields >
when using the full-screen editor. Each element of < aEditCoords > is
a sub-array of 7 elements:
< aEditCoords > element Type Description
--------------------- ------- --------------------------------
1 Numeric SAY (Header) Start Row
2 Numeric SAY (Header) Start Column
3 Numeric SAY Size (columns) default is 25
4 Numeric SAY Options - XBPSTATIC_TEXT_*
5 Numeric GET (Data) Start Row
6 Numeric GET (Data) Start Column
7 Numeric GET Size (columns) default is
field width
< acMenu > is a Menu array or menu name that conforms to the
specifications for DC_MenuEdit().
< cBrowFont > is the font style for the browse. This is a character
string that must conform to a standard Xbase++ font declaration,
ex: "8.Arial". The default is "8.Courier".
< lResize > is reserved for future implementation.
@< aGrumpGetList > is the name of a variable, passed by reference,
to store a pointer to the GetList of the Grump dialog.
< lModal > if .TRUE. will cause the dialog window to be modal,
otherwise it will be modeless.
< oParent > is a reference to a parent dialog or to a memory
variable to store a reference to the dialog that will be
created. If < oParent > has already been created as an Xbase Parts
class object, it will become the parent for all the objects in
the GetList. If < oParent > is passed by reference as a NIL, the
dialog object created by the reader will be stored in this
memory variable. NOTE: Xbase++ does not allow < oParent > to be
a PRIVATE or a PUBLIC variable if it is passed by reference.
The parent of the dialog that will be created is referenced by
APPWINDOW < oAppWindow >. If no < oAppWindow > argument is
used
then the parent of the created dialog will be AppDeskTop().
Description:
DC_GUIGrumpBrow() is an emulation of the GrumpFish function GrumpBrow()
originally written for Clipper 5.x. It is full GUI and is based on the
eXPress++ DC* command set rather than Tbrowse().
Notes:
MEMO SUPPORT
Memofields are shown in the browse window as "<þmemoþ>". To view a
memo, highlight it and press Enter.
When adding, editing, or doing a query by example, you will notice
that memo support is handled quite neatly. As you go through the GET
list, when you hit a memo, a small window will open for you to edit
the memo.
SECURITY LEVELS
You may define different security levels at different parts of the
program. For example, you might want to give your users the ability
to add and edit records at one part of the program, but only view
records elsewhere.
SEARCH
If you press "S" to search, and if the current controlling index is
of character type, you may jump quickly to records by typing in the
first few letters of the desired value. For example, searching for
the name 'MCALLISTER' could prove quite tedious in a 750-record
database, but with quick-search you need only type in the letters
"M", "C", and "A" to narrow the scope down considerably. As letters
are added to the search string, it is redisplayed centered along the
bottom row of the browse box (unless the new letter results in a
value that is not FOUND() in the database). You may press backspace
to erase the rightmost character of the search string.
SWAPPING INDEXES (Alt-I)
If you have two index files open, you may switch between them by
pressing Alt-I. This means that you could have one index on company
name and another on last name, and jump back and forth between them
for searches.
QUERY BY EXAMPLE
By pressing "Q" you can do a query-by-example to find the next
record matching their specific criteria. All you need do is fill in
the blanks. Fill in as many fields as you want to narrow the search
criteria. Note that all query-by-example searches are
case-insensitive.
If you want to search for a field that contains a certain value, they
may enter that value surrounded by two periods ("..") on either side.
For example, if you wanted to find the next record that contains the
word "STREET" in the address field, you could enter "..STREET.." for
that field.
After you perform a query-by-example, the next time you press "Q" you
will be given the option to repeat the search using the same criteria
(which will save you the bother of re-entering it).
SCREEN PAINTER
The screen painter will be supported in a future version
EDITING ONE FIELD
When the user highlights a field and press Enter, they can edit it
directly without going to a vertical view. (This assumes, of
course, that you have given them Edit privileges.) If they wish to
edit the same field in a series of records, they can terminate the
READ by pressing the down arrow, which will move them down one
record and pop them immediately into edit mode.
However, there may be situations when you do not want the user to be
able to edit an individual field. In such situations, you should
include "N" as part of the security parameter.
By the same token, there may be situations where you only want
the user to be able to edit individual fields (as opposed to a
full-screen edit). This would apply if you had a number of code
block (and thus non-editable) columns. In such situations, you
should include "C" (and not "N") as part of the security parameter.
Source/Library:
_DCGBROW.PRG, DCLIPX.DLL
See Also:
DCGRUMPBROW
dc_guimemoedit()
A GUI replacement for MemoEdit()
Syntax:
DC_GuiMemoEdit( < cMemo >, ;
< nTop >, ;
< nLeft >, ;
< nBottom >, ;
< nRight >, ;
< lEditMode >, ;
< bcUserFunc >, ;
< nLineLen >, ;
< nTabSize >, ;
< nBufferRow >, ;
< nBufferCol >, ;
< nWindowRow >, ;
< nWindowCol >, ;
< cTitle > ) - > cMemo
Arguments:
< cMemo > contains a character string or the contents of a memo
field. This character string is copied into the text buffer for
DC_GuiMemoEdit() and can then be displayed and/or edited. When
< cString > is not specified, MemoEdit() begins with an empty text
buffer.
< nTop > is an integer numeric value specifying the top screen row
at which the edit window is displayed by DC_GuiMemoEdit(). The four
arguments < nTop > , < nLeft > , < nBottom > and
< nRight > determine the
screen coordinates for the edit window. Row positions for the
window can range from zero to MaxRow() and column positions can
range from zero to MaxCol().
< nLeft > is an integer numeric value specifying the left screen
column for the edit window display. The default value is zero.
< nBottom > is an integer numeric value specifying the bottom row
for the edit window display. The default value is MaxRow().
< nRight > is an integer numeric value specifying the right screen
column for the edit window display. The default value is MaxCol().
< lEditMode > is used to select either the edit or the display mode.
If .T. (true) is specified, the text buffer can be edited. When the
value .F. (false) is specified for < lEditMode > , the text buffer is
displayed and the user can only browse (not edit) the text buffer.
The default value is .T. (true).
< bcUserFunc > can contain a code block, a character string with the
name of a user-defined function or the value .F. (false). When
< bcUserFunc > contains a code block, it is executed after each
keypress
not processed by DC_GuiMemoEdit(). Similarly, when the function name of a
user function is passed as a character string (without parentheses),
this function is called after each keypress not processed by
DC_GuiMemoEdit(). If a function name is specified, the function must not
be declared STATIC. A code block, however, can call a
STATIC FUNCTION. Only the following keys will activate the evaluation
of < bcUserFunc >: F1 thru F12, Ctrl-F1 trhu Ctrl-F12, Alt-F1 thru
Alt-F12,
Alt-A thru Alt-Z. Two parameters are passed to the code block:
(1) the key value pressed, (2) a pointer to the XbpMle() object used as
the memo editor.
The argument < nLineLen > specifies the length of a line where
DC_GuiMemoEdit() automatically performs a word wrap. When < nLineLen >
is
greater than the width of the edit window and an attempt is made
to move the cursor past the window border, the text is scrolled
horizontally. < nRight > - < nLeft > is used as the default
value
for < nLineLen > .
< nTabSize > specifies the number of blank spaces inserted into the
text when the tab key (K_TAB) is pressed. By default four blank
spaces are inserted by K_TAB.
< nBufferRow > is an integer numeric value specifying the text row
where the cursor is positioned when MemoEdit() is called. The value
range for < nBufferRow > is from one to the entire number of rows in
< cString > . The default value is one. < nBufferRow > and
< nBufferCol >
position the cursor within the text buffer, while < nWindowRow > and
< nWindowCol > determine the initial position of the cursor in the
edit window.
< nBufferCol > is an integer numeric value indicating the column
within the text row specified by < nBufferRow > where the cursor is
positioned when DC_GuiMemoEdit() is called. The value range for
< nBufferCol > is from zero to < nLineLen > . The default value
is
zero.
< nWindowRow > specifies the row within the edit window where the
cursor is positioned when DC_GuiMemoEdit() is called. The value range
for < nWindowRow > is from zero to < nBottom > -
< nTop > . The default
value is zero.
< nWindowCol > specifies the column within the edit window where the
cursor is positioned when DC_GuiMemoEdit() is called. The value range
for < nWindowCol > is from zero and to < nRight > -
< nLeft > . The
default value is zero.
< cTitle > is the title to display in the window.
Returns:
A Character String.
Description:
DC_GuiMemoEdit() is a GUI replacement for MemoEdit() that
functions similiar to MemoEdit() except that it is displayed in
GUI mode with extra buttons for Save and Abort and a line/column
counter.
DC_GuiMemoEdit() recognizes both the XbpMLE() set of editing
keys (Windows standard) and the MemoEdit() set of editing
keys (WordStar standard).
Examples:
USE Address NEW
DC_GuiMemoEdit( Address->Memo, 5, 10, 20, 60, .F., .F.)
Source/Library:
_DCMEMOE.PRG, DCLIPX.LIB
dc_guipopcalc()
A popup, full-function calculator
Syntax:
DC_GuiPopCalc( [< nValue >], ;
[< nStRow >], ;
[< nStCol >], ;
[< cTitle >],;
[< @lOK >], ;
[< lModal >], ;
[< bHelp >], ;
[< lInteger >]) - > nValue
Arguments:
< nValue > is the starting value to place in the accumulator.
If no value is passed then the STATIC value stored in memory
will be the default.
< nStRow > and < nStCol > are the start display coordinates.
If
no values are passed then the calendar will be displayed
relative to the current cursor position (in TEXT mode)
or in the center of the screen (in GUI mode). These coordinates
are text-based coordinates based on a home position of 0,0.
In GUI mode they are automatically converted to GUI-based
coordinates.
@< lOk > is a logical variable, passed by reference. If the user
exits with an ABORT or ESCAPE, the variable will contain a
.FALSE., otherwise it will contain a .TRUE.
< cTitle > is the title in the titlebar area of the calculator.
< lModal > if .TRUE. (default) will make the dialog window modal,
otherwise it will be modeless.
< bHelp > is a code block that is evaluated when the user presses
the F1 key or clicks on the HELP button.
< lInteger > if .TRUE. will display the calculator accumulator without
decimals.
Returns:
The value of the calculator accumulator (numeric).
Description:
DC_GUIPOPCALC() is a calculator that can be called from Xbase++
code or in a code-block via the POPUP clause in the DCSAY..GET
command.
Examples:
#include "dcdialog.ch"
FUNCTION XTest()
LOCAL GetList := {}, nNumber := 1234.56, oMsgBox
DC_GUI(.t.)
@ 1,1 DCSAY 'Enter Number' GET nNumber ;
POPUP {|n|DC_GuiPopCalc(n)} ;
MESSAGE 'Click on arrow for a calculator' ;
INTO oMsgBox
@ 3,1 DCMESSAGEBOX OBJECT oMsgBox SIZE 30
DCREAD GUI FIT ADDBUTTONS
RETURN nil
Source/Library:
_DCCALC.PRG/.OBJ, DCLIPX.DLL
See Also:
dc_popcalc()
dc_guipopdate()
A GUI pop-up calendar for selecting a date
Syntax:
DC_GuiPopDate( [< dCurDate >],;
[< nStRow >], ;
[< nStCol >], ;
[@< lOk >], ;
[< cTitle >], ;
[< lModal >], ;
[< nStyle >], ;
[< bHelp >], ;
[< lHide >], ;
[< lInstall >], ;
[@< oDialog >], ;
[@< aGetList >], ;
[< bIsHoliday >], ;
[< aColors >] ) - > dDate
Arguments:
< dCurDate > is the starting date to highlight in the calendar.
If no value is passed then the current system date will be
the default.
< nStRow > and < nStCol > are the start display coordinates.
If
no values are passed then the calendar will be displayed
relative to the current cursor position (in TEXT mode)
or in the center of the screen (in GUI mode). These coordinates
are text-based coordinates based on a home position of 0,0.
In GUI mode they are automatically converted to GUI-based
coordinates.
@< lOk > is a logical variable (passed by reference). This variable
will receive a .TRUE. if the user clicks on OK, double-clicks
on a date. or presses ENTER. It will receive a .FALSE. if the
use clicks on ABORT or presses ESCape.
< cTitle > is the title in the Dialog Window.
< lModal > if .TRUE. (default) will make the dialog window modal,
otherwise it will be modeless.
< nStyle > is used to determine the style of the popup calendar.
This parameter is ignored in non-GUI mode.
< nStyle > Description
--------- ------------------------------------------------
1 Large Calendar (original version)
2 Small Calendar (with fancy buttons)
3 Reserved.
4 Small Calendar (without fancy buttons)
< bHelp > is a code block that is evaluated when the user presses
the F1 key.
If < lHide > is .TRUE., the calendar dialog is not destroyed when
exited. Instead it is hidden until DC_PopDate() is called again.
This provides the benefit of displaying the calendar instantly
after the first call to DC_PopDate(). The small calendar takes
longer to create because there are many more objects required
to handle the fancy buttons. The default is .FALSE.
< lInstall > is used only with the < lHide > parameter. It
should
be passed as .TRUE. and used only once at the beginning of the
program in the main thread. It installs the calendar as a
hidden calendar under the main thread to prevent lockups caused
by creating the hidden calendar in a different thread that is
later terminated.
@< oDialog > is a variable, passed by reference, to store a pointer
to the dialog window created by DC_PopDate(). This variable is
ignored if < nStyle > is 1 or < lHide > is .FALSE.
@< aGetList > is a variable, passed by reference, to store a
pointer to to GetList array used to create the calendar dialog.
This variable is ignored if < nStyle > is 1 or < lHide > is
.FALSE.
< bIsHoliday > is a code block to evaluate to determine if a date
is a holiday. This code block is called before painting each
date on the calendar. The date is passed to the code block and
the code block must return a logical .T. if the date is a holiday
or a .F. if it is not a holiday. Dates which are holidays are
displayed in the "holiday" color defined in the < aColors > array.
NOTE: this feature is available only in the "small calendar" -
style 2.
< aColors > is an array of 4 colors. Each element of the array is
a 2-element array containing a foreground and a background color
for the four different calendar colors. See the below table.
Array Element Description
------------- -------------------------------------------
[1] Normal Color
[2] Today Color (Today's date)
[3] Passed-In Date Color
[4] Holiday Color
Example:
aColors := { ;
{ GRA_CLR_BLACK, GRA_CLR_WHITE }, ; // normal color
{ GRA_CLR_BLUE, GRA_CLR_WHITE }, ; // today color
{ GRA_CLR_RED, GRA_CLR_WHITE }, ; // passed date color
{ GRA_CLR_GREEN, GRA_CLR_WHITE }, ; // holiday color
}
Returns:
The date selected.
Description:
DC_GUIPOPDATE() is a GUI calendar that can be called from Xbase++
code or in a code-block via the POPUP clause in the DCSAY..GET
command.
Examples:
#include "dcdialog.ch"
FUNCTION XTest()
LOCAL GetList := {}, dDate := Date(), oMsgBox
@ 1,1 DCSAY 'Enter Date' GET dDate ;
POPUP {|d|DC_GuiPopDate(d,,,,,,3)} ;
MESSAGE 'Click on arrow for a calendar' ;
INTO oMsgBox
@ 3,1 DCMESSAGEBOX OBJECT oMsgBox SIZE 30
DCREAD GUI FIT ADDBUTTONS
RETURN nil
* ------------ Display Holidays ------------- *
FUNCTION XTest2()
LOCAL dDate := Date()+2, cTitle, lModal, bIsHoliday, nStyle, aColors
cTitle := 'Pick a Holiday'
bIsHoliday := {|d,x|x:=Dow(d)==1,x}
lModal := .T.
nStyle := 2
aColors := { ;
{ GRA_CLR_BLACK, GRA_CLR_WHITE }, ; // normal color
{ GRA_CLR_BLUE, GRA_CLR_WHITE }, ; // today color
{ GRA_CLR_RED, GRA_CLR_WHITE }, ; // passed date color
{ GRA_CLR_GREEN, GRA_CLR_WHITE }, ; // holiday color
}
DC_GuiPopDate( dDate,,,,cTitle,lModal,nStyle,,,,,, ;
bIsHoliday, aColors )
RETURN nil
Source/Library:
_DCCALEN.PRG/.OBJ, DCLIPX.DLL
See Also:
dc_popdate()
dc_helphandler()
Event handler for processing Help Requests
Syntax:
DC_HelpHandler( < nEvent >, ;
< mp1 >, ;
< mp2 >, ;
< oXbp >, ;
[< oDialog >], ;
[< aGetList >] ) - > nStatus
Arguments:
< nEvent > is the event be processed.
< mp1 > is the first parameter of the event being processed.
< mp2 > is the second parameter of the event being processed.
< oXbp > is a pointer to the object associated with the event
being processed.
< oDialog > is reserved. No value needs to be passed.
< aGetList > is a pointer to any GetList array in which associated
events should not be processed.
Description:
DC_HelpHandler() is used to send Help Requests from an eXpress++
application to the DC_Help() dialog window.
Examples:
/*
In this example, all events from all windows created by DC_ReadGui()
will be passed on to DC_HelpHandler().
*/
DC_ReadGuiHandler({|a,b,c,d,e,f|DC_HelpHandler(a,b,c,d,e,f)})
Source/Library:
_DCXHELP.PRG, DCHELP.DLL
See Also:
dc_helpoptions()
dc_helpoptions()
Set Options for Help Window
Syntax:
DC_HelpOptions( [< aOptions >] ) - > aOldOptions
Arguments:
< aOptions > is an array of 13 elements.
Array
Element Type Description
------- ----- ------------------------------------------------
1 N Hot key to View Focus Item info in window.
2 N Hot key to send Help Request for focus item
3 B Code block to enable hot keys
4 B Code block to enable help editing
5 C/O Font of Help Window
6 C Title of Help Window
7 C Help Root Name
8 N Help Type
9 C Help Database File Name
10 O Parent of Help Window
11 N Window Height (pixels)
12 N Window Width (pixels)
13 C Help Find Database File Name
14 N Help Exit Mode
HELP_EXITMODE_HIDE - Hide window on exit
HELP_EXITMODE_DESTROY - Destroy window on exit
HELP_EXITMODE_QUIT - Quit application on exit
15 C Script files path
16 C HTML files path
17 C Temporary files path
18 C Help code of Glossary
Returns:
An array containing the previously set options.
Description:
DC_HelpOptions() is used to setup the Help System options.
Examples:
FUNCTION LoadHelpOptions( oDialog )
LOCAL aHelpOptions[13]
// Install global handler.
DC_ReadGuiHandler({|a,b,c,d,e,f|DC_HelpHandler(a,b,c,d,e,f)})
aHelpOptions[1] := xbeK_ALT_F11 // Hot key to View Focus Item info in
window
aHelpOptions[2] := xbeK_ALT_F1 // Hot key to send Help Request for focus
item
aHelpOptions[3] := {||.t.} // Code block to enable hot keys
aHelpOptions[4] := {||.t.} // Code block to enable help editing
aHelpOptions[5] := '10.Courier' // Font of Help Window
aHelpOptions[6] := 'XDEMO Help' // Title of Help Window
aHelpOptions[7] := 'DESKTOP' // Help Root Name
aHelpOptions[8] := 1 // Help Type
aHelpOptions[9] := 'HELP.DBF' // Help Database Alias Name
aHelpOptions[10] := oDialog:drawingArea // Parent of Help Window
aHelpOptions[11] := 400 // Help Window Height
aHelpOptions[12] := 620 // Help Window Width
aHelpOptions[13] := 'HELPFIND.DBF' // Help Find Database Alias Name
DC_HelpOptions( aHelpOptions )
RETURN nil
Source/Library:
_DCXHELP.PRG, DCHELP.DLL
See Also:
dc_helphandler()
dc_hexstring2array()
Convert a hex string to a multi-dimensional array
Syntax:
DC_HexString2Array ( < cHexString > ) - > aArray
Arguments:
< aArray > is any multidimensional array that contains variables of
type
C, M, D, L, or N.
Returns:
An array.
Description:
DC_HexString2Array() will create an array from a hex string that was
originally created by DC_Array2HexString().
This function is mainly intended for use on the internet when an array
of information must be passed in an XML stream.
Source/Library:
_DCASAVE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_array2hexstring()
dc_ar2str()
dc_asave()
dc_hexstringtovar()
Convert a Hex String to a Binary String
Syntax:
DC_HexString2Var( < cHexString > ) - > cBinaryString
Arguments:
< cHexString > is a Hex String previously created by
DC_Var2HexString().
Returns:
A Character String.
Description:
DC_HexString2Var() is used to convert hex strings to binary
strings. Hex strings are used for storing in .TXT files or in
memo fields that do not accept binary data.
Examples:
// Save Directory to a memo field
aData := Directory()
cData := DC_Var2HexString(Var2Bin(aData))
REPLACE CUSTOMER->directory WITH cData
// Restore Directory from a memo field
cData := DC_HexString2Var(CUSTOMER->directory)
aData := Bin2Var(cData)
Source/Library:
_DCASAVE.PRG, DCLIPX.DLL
See Also:
dc_var2hexstring()
dc_hmacsha1()
Returns a hash that meets SHA1 spec for encrypted message authenticati
Syntax:
DC_HmacSha1( < cKey >, < cMessage > ) - >
< cHash >
Arguments:
< cKey > is the key string.
< cMessage > is the message string.
Returns:
A string.
Description:
DC_HmacSha1() returns a hash that meets the RFC 2104 specification for
encrypted message authentication.
See spec at http://www.ietf.org/rfc/rfc2104.txt
Examples:
cHash := DC_HmacSha1( '^$%^$#','My Message' )
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_xorstrings()
dc_hourglassoff()
Turn off the HourGlass (wait) pointer
Description:
DC_HourGlassOn() cause the hourglass mouse pointer to be displayed
until DC_HourGlassOff() is called.
Source/Library:
DCLIPX.LIB, DCLIPX.DLL
See Also:
dc_hourglasson()
dc_hourglasson()
Turn on the HourGlass (wait) pointer
Description:
DC_HourGlassOn() cause the hourglass mouse pointer to be displayed
until DC_HourGlassOff() is called.
Source/Library:
DCLIPX.LIB, DCLIPX.DLL
See Also:
dc_hourglassoff()
dc_htmlgetvar()
Get the value of a variable from a web app var array
Syntax:
DC_HtmlGetVar( < aVars >, ;
< cVarName >, ;
[< lAnyCase >] ) - > cValue | NIL
Arguments:
< aVars > is a 2-dimensional array containing variable names and
contents. Each subelement must contain the following information:
Element Type Description
------- ---- ----------------------------------------
[1] C The variable name
[2] C The variable contents
< cVarName > is the name of the variable to return.
< lAnyCase > if .TRUE. will find the variable regardless of case.
If .FALSE. (default) then < cVarName > must exactly match the name
in the < aVars > array.
Returns:
A character string if the variable is found in the array, otherwise
a NIL.
Description:
DC_HtmlGetVar() is used to extract the value of a variable from
an array of variable definitions. This function is used in web-based
applications that use Xb2.Net or the WAA adapter.
Examples:
* ----- Xb2.Net example -----
#include "xb2net.ch"
aVars := {}
aVarList := oThread:getVar(nil,VAR_CONTENT)
IF Valtype(aVarList) == 'A'
FOR i := 1 TO Len(aVarList)
AAdd(aVars,aVarList[i])
NEXT
ENDIF
aVarList := oThread:getVar(nil,VAR_QUERY)
IF Valtype(aVarList) == 'A'
FOR i := 1 TO Len(aVarList)
AAdd(aVars,aVarList[i])
NEXT
ENDIF
cAddress1 := DC_HtmlGetVar( aVars, 'Address1' )
cAddress2 := DC_HtmlGetVar( aVars, 'Address2' )
cCity := DC_HtmlGetVar( aVars, 'City' )
* ----- WAA example -----
aVars := oHtml:Gateway():aQueryVars
cAddress1 := DC_HtmlGetVar( aVars, 'Address1' )
cAddress2 := DC_HtmlGetVar( aVars, 'Address2' )
cCity := DC_HtmlGetVar( aVars, 'City' )
Source/Library:
_DCHTML.PRG, DCLIPX.DLL
See Also:
dc_html()
dc_hunt()
Hunt for a record by search all indexes
Syntax:
DC_Hunt( < cValue > | < cExpression >, ;
[< lResume >], ;
[< lDispMsg >] ) - > NIL
Arguments:
< cValue > is the value to find.
< cExpression > is an expression that produces a value to find.
If no < cValue > | < cExpression > argument is passed, then
the
user will be prompted to enter a value.
< lResume > if .TRUE. will resume "hunting" for an index starting
from the last index searched. If .FALSE. (default) then the
"hunting" process starts at the first index in the order of
index files or tags.
< lDispMsg > if .TRUE. will display a message if record not found
(default). IF .FALSe. will display no message - just leaves
file at EOF.
Returns:
Nil.
Description:
DC_Hunt() is a method of Seeking a record by searching all open
index files or tags for the value entered. This is the
quickest method of finding information by scanning all the keys
for the first match. The value entered is automatically
converted to the proper "type" to perform the seek. For
example, if you entered DC_Hunt(12.5), only numeric indexes
will be seeked, or if you enter DC_Hunt('01/02/03'), only date
indexes will be seeked. If you enter an expression, such as
DC_Hunt('DATE()-30'), then only the indexes that match the
type of the expression entered will be seeked.
Using DC_Hunt() is the fastest method of finding information
in a large database that uses many index keys. It is recommended
that you build a set of keys for all fields that you want to
include in the DC_Hunt() operation. This can be accomplished
easily by using the INDEX FIELDS command to create a set of
tags all at one time.
Notes:
HUNT automatically capitalizes the passed argument, so make
sure that your character type indexes are UPPER() case. When
building index tags with INDEX FIELDS, this is accomplished
automatically.
Examples:
. USE MAILLIST
. INDEX FIELDS LAST, FIRST, COMPANY, MAIL_DATE, SOURCE ;
TO MAILLIST.CDX
. DC_Hunt('COMP')
. DC_Hunt( nil, .t. )
. DC_Hunt( DATE() )
. DC_Hunt('LARRY')
. DC_Hunt('EGGHEAD')
Source/Library:
_DCHUNT.PRG, DCLIP2.DLL
See Also:
HUNT
dc_icondefault()
Set Default Icon for Dialog Windows
Syntax:
DC_IconDefault( [< nIcon >] ) - > nOldIcon
Arguments:
< nIcon > is the numeric resource number of an icon that has
been linked into the .EXEcutable program.
Returns:
The previous icon (a numeric value).
Description:
DC_ICONDEFAULT() is used to establish a default ICON for
Dialog Windows created by DC_ReadGui, DC_MsgBox() and other
eXPress++ windows.
Examples:
#include 'dcicon.ch'
FUNCTION XTest()
LOCAL
nOldIcon := DC_ICONDEFAULT(ICON_EXPRESS)
DC_MsgBox('You should now see the eXPress++ Icon')
DC_ICONDEFAULT(nOldIcon) // Restore old icon
RETURN nil
Source/Library:
_DCMSG.PRG/.OBJ, DCLIPX.DLL
See Also:
DC_ReadGui()
DC_MsgBox()
dc_ifelse()
Evaluate a list of expressions based on a condition
Syntax:
DC_IfElse ( < bIf >, ;
< bDoIf >, ;
[< bDoElse >] ) - > NIL
Arguments:
< bIf > is a code block to be that is evaluated as the IF
statement.
< bDoIf > is a code block that is evaluated if < bIf >
evaluates
.TRUE.
< bDoElse > is a code block that is evaluated if < bIf >
evaluates
.FALSE.
Returns:
Nil.
Description:
DC_IFELSE() is a "function" replacement for IF...ELSE...ENDIF
programming structure to be used when a function is needed,
i.e. for calling via macro, code blocks, etc.
Examples:
. USE COLLECT
. bIf := { || eof() }
. bDoIf := { || DC_MsgBox("End of File") }
. bElseIf := { || dbSkip() }
. SetKey( -1, { || DC_IFELSE( bIf, bDoIf, bElseIf ) } )
Source/Library:
_DCEVAL.PRG, DCLIP1.DLL
See Also:
dc_docase()
dc_dowhile()
dc_impl()
Implode a dialogue window created by dc_expl()
Syntax:
DC_Impl( [< aSaveScreen >] ) - > NIL
Arguments:
< aSaveScreen > is an array of screen information that was
originally returned by DC_EXPL(). If no parameter is
passed, then the static array posted by the last usage of
DC_EXPL() or the DCEXPLODE command will be used for the
screen information. If no call to DC_EXPL() or DCEXPLODE
is made since the last call to DC_IMPL() or DCIMPLODE,
then the text is written to the CRT window and treated as
a normal @..SAY.
Returns:
NIL
Description:
DC_IMPL() is used to implode a window created by DC_EXPL().
Examples:
-- Example 1 --
aSaveScreen := dc_expl( 10,10,12,70, ' Enter a command ' )
cCommand := SPACE(50)
@ 11,12 get cCommand
read
DC_IMPL( aSaveScreen )
-- Example 2 --
aSaveScreen := ;
dc_expl( 10,10,15,70,'A Gui SAY Window',,,,,,.t. )
dc_say(aSaveScreen,2,5,'This is 3/5')
dc_say(aSaveScreen,4,10,'This is 4/10')
DC_IMPL(aSaveScreen)
Source/Library:
_DCEXPL.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_expl()
dc_implode()
Implode a window created by dc_explode()
Syntax:
DC_Implode( < cSaveScreen > ) - > nil
Arguments:
< cSaveScreen > is a composite string consisting of the screen
contents, coordinates, colors, etc.
Description:
DC_IMPLODE() is used to implode a window created by
DC_EXPLODE().
Examples:
cSaveScrn := dc_explode(5,10,7,70,'B/W','N/W',.F.,;
' Enter a Command ',10)
cCommand := space(50)
@ 6,12 get cCommand
read
DC_IMPLODE( cSaveScrn )
Source/Library:
_DCEXPL.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_explode()
dc_impl()
dc_expl()
dc_explmode()
dc_indexfilt()
Return the Conditional Index Expression
Syntax:
DC_IndexFilt ( [< nOrder >] ) - > cExpression
Arguments:
< nOrder > is the index order. If no argument is given, then the
currently selected order is used.
Returns:
A character string.
Description:
DC_INDEXFILT() returns the filter condition (if any) used in an
open index.
Examples:
. use sales via 'DBFNTX' // Use Conditional Index driver
. index on year for sales > 100000
. ? DC_INDEXFILT()
sales > 100000
. select 2
. use customer via 'DBFSIX'
. index on cust_nmbr tag users of customer for cust_code = 'U'
. ? DC_INDEXFILT()
cust_code = 'U'
Source/Library:
_DCAREA2.PRG/.OBJ, DCLIPX.LIB
dc_indexkey()
Return the current index key expression
Syntax:
DC_IndexKey () - > cKeyString
Arguments:
None
Returns:
A Character string containing the current index key value.
If no index is in use or a data driver is being used that
does not support indexes, then a null "" string is returned.
Description:
DC_INDEXKEY() is used as a replacement for Clipper's
INDEXKEY() function to prevent runtime errors when using
a database driver that does not suport indexes.
Examples:
use sales
index on year+month to sales
? DC_INDEXKEY()
year+month
Source/Library:
_DCAREA2.PRG/.OBJ, DCLIPX.LIB
dc_iniload()
Load an array from a *.INI (initialization) file
Syntax:
DC_IniLoad( < cIniFile >, ;
< cGroup >, ;
< aArray >, ;
< aReference > ) - > lStatus
Arguments:
< cIniFile > is the name of the *.INI file to load. If the full
path is not included in the file name, then it is assumed that
the file must exist in the same directory as the .EXEcutable
program or in the directory established by the SET DCLIP=< path >
command in your AUTOEXEC.BAT file.
< cGroup > is the Group Name you wish to load.
< aArray > is the array to populate from the contents of the
intialization group. This array must already exist and must
contain default values for each item. Values may be the
following types: (C)haracter, (N)umeric, (D)ate, (L)ogical.
< aReference > is a parallel array that contains the same number
of elements as < aArray >. This array contains the name of each
intialization item for each item in < aArray >.
Returns:
A logical .TRUE. if the file exists, if the <þcGroupþ> can
be found in the file and if at least one element of the
array was updated from the file, .FALSE. otherwise.
Description:
DC_INILOAD() is used to populate an array with the contents of
an initilization group in a *.INI file. *.INI files are used
by Windows 3.1 for initialization of various sub-systems and
applications and have become a defacto-standard for
initialization systems.
Notes:
<þaArrayþ> should be already populated by default values. If
there is no item in the *.INI file that matches a specified
element of the array, then its value will not be changed.
Examples:
/* Sample *.INI file */
* MYCOLORS.INI
[COLORSET_1]
ColorSet=Standard Color Set
DotPrompt=W+/B
StatusLine=N/W
StatusData=N/W
[COLORSET_2]
ColorSet=Color Set #2
DotPrompt=GR+/GR
StatusLine=N*/N
StatusData=W+*/N
/* -- Example 1 (Loading an array from COLORSET_2 -- */
aRef := {'ColorSet','DotPrompt','StatusLine','StatusData'}
DC_INILOAD('MYCOLORS.INI','COLORSET_2',aColors[2],aRef)
Source/Library:
_DCINI.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_inisave()
dc_iniread()
Read a parameter from a *.INI (initialization) file
Syntax:
DC_IniRead( < cIniFile >, ;
< cGroup >, ;
< cParamName > ) - > cValue
Arguments:
< cIniFile > is the name of the *.INI file to load. If the full
path is not included in the file name, then it is assumed that
the file must exist in the same directory as the .EXEcutable
program or in the directory established by the SET DCLIP=< path >
command in your AUTOEXEC.BAT file.
< cGroup > is the Group Name you wish to load.
< cParamName > is the name of the variable that belongs to the
group < cGroup >. This name is case sensitive.
Returns:
A character string.
Description:
DC_INIREAD() is used to read a specified parameter from an
initialization (.INI) file.
Examples:
/* Sample *.INI file */
* MYCOLORS.INI
[COLORSET_1]
ColorSet=Standard Color Set
DotPrompt=W+/B
StatusLine=N/W
StatusData=N/W
[COLORSET_2]
ColorSet=Color Set #2
DotPrompt=GR+/GR
StatusLine=N*/N
StatusData=W+*/N
/* -- Example (Loading a var from COLORSET_2 -- */
cColor := DC_INIREAD('MYCOLORS.INI','COLORSET_2','DotPrompt')
SetColor(cColor)
Source/Library:
_DCINI.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_iniwrite()
dc_iniload()
dc_inisave()
Save an array to a *.INI (initialization) file
Syntax:
DC_IniSave( < cIniFile >, ;
< cGroup >, ;
< aArray >, ;
< aReference > ) - > lStatus
Arguments:
< cIniFile > is the name of the *.INI file to save. If the full
path is not included in the file name, then it is assumed that
the file must exist in the same directory as the .EXEcutable
program or in the directory established by the SET DCLIP=< path >
command in your AUTOEXEC.BAT file. If the file does not exist
it will be created. If it already exists, then only the GROUP
in the file that matches < cGroup > will be updated.
< cGroup > is the Group Name you wish to save.
< aArray > is the array to write to the initialization group.
This array may contain values of the following types:
(C)haracter, (N)umeric, (D)ate, (L)ogical.
< aReference > is a parallel array that contains the same number
of elements as < aArray >. This array contains the name of each
intialization item for each item in < aArray >.
Returns:
A logical .TRUE. if the initialization group was properly
saved, FALSE otherwise.
Description:
DC_INISAVE() is used to save an array with the contents of
an initilization group to a *.INI file. *.INI files are used
by Windows 3.1 for initialization of various sub-systems and
applications and have become a defacto-standard for
initialization systems.
Examples:
/* Sample *.INI file */
* MYCOLORS.INI
[COLORSET_1]
ColorSet=Standard Color Set
DotPrompt=W+/B
StatusLine=N/W
StatusData=N/W
[COLORSET_2]
ColorSet=Color Set #2
DotPrompt=GR+/GR
StatusLine=N*/N
StatusData=W+*/N
/* -- Example 1 (Saving an array to COLORSET_2 -- */
aRef := {'ColorSet','DotPrompt','StatusLine','StatusData'}
DC_INISAVE('MYCOLORS.INI','COLORSET_2',aColors[2],aRef)
Source/Library:
_DCINI.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_iniload()
dc_iniwrite()
Write a parameter to a *.INI (initialization) file
Syntax:
DC_IniWrite( < cIniFile >, ;
< cGroup >, ;
< cParamName >, ;
< xValue > ) - > lStatus
Arguments:
< cIniFile > is the name of the *.INI file to load. If the full
path is not included in the file name, then it is assumed that
the file must exist in the same directory as the .EXEcutable
program or in the directory established by the SET DCLIP=< path >
command in your AUTOEXEC.BAT file.
< cGroup > is the Group Name you wish to load.
< cParamName > is the name of the variable that belongs to the
group < cGroup >. This name is case sensitive.
< xValue > is the value to store. This may be any type however
it is stored as a character type.
Returns:
A logical .TRUE. if the value was stored properly.
Description:
DC_INIWRITE() is used to write a specified parameter to an
initialization (.INI) file.
Examples:
/* Sample *.INI file */
* MYCOLORS.INI
[COLORSET_1]
ColorSet=Standard Color Set
DotPrompt=W+/B
StatusLine=N/W
StatusData=N/W
[COLORSET_2]
ColorSet=Color Set #2
DotPrompt=GR+/GR
StatusLine=N*/N
StatusData=W+*/N
/* -- Example (Saving a var to COLORSET_2 -- */
cColor := SetColor()
DC_INIREAD('MYCOLORS.INI','COLORSET_2','DotPrompt', cColor)
Source/Library:
_DCINI.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_iniread()
dc_iniload()
dc_inkey()
Moused replacement for INKEY()
Syntax:
DC_Inkey ( [< nSeconds >], ;
[@< nMouRow >], ;
[@< nMouCol >], ;
[< lWaitRele >], ;
[< lWinMode >], ;
[< lGetReader >], ;
[< lNoDblClick >], ;
[< lDragMode >], ;
[< cHelpCode >], ;
[< aMouseHelp >] ) - > nInkeyValue
Arguments:
< nSeconds > is the number of seconds to wait for a key press or
mouse click. If 0 (default) then DC_INKEY() will wait forever.
@< nMouRow > and @< nMouCol > are memory variables passed by
reference to store the current row and column location of the
mouse if a mouse button is pressed.
< lWaitRele > if .TRUE. will wait until the mouse button is
released before processing any more mouse actions. If this
parameter is not passed, then the last call to DC_INKEYRELE()
will establish the default mode.
< lWinMode > if .TRUE. will cause DC_INKEY() to behave more like
Windows programs. Normally, the right-button must be pressed
or the left-button double-clicked for DC_INKEY() to return a
-104 value. If DC_INKEYWIN(.t.) is called in your setup
program and the < lWinMode > parameter is passed to DC_INKEY(),
then simply releasing the left button will return the -104 value
to invoke the menu selection.
< lGetReader > is reserved.
< lNoDblClick > if .TRUE. will disable mouse double-click from
returning a -104 but instead will return a -101 (same as single
click). The default is .FALSE.
< lDragMode > if .TRUE. will return a value of 13 (K_ENTER) if
the left mouse button is pressed. The default is .FALSE.
< cHelpCode > is a code of up to 22 characters to pass to the
DC_HELPF1() function in the event that the F1 or ALT-F1 keys
are pressed.
< aMouseHelp > is an array of information to display on the
screen if the mouse is moved over specified areas (icons) on
the screen. This optional array allows for displaying of help
information when the mouse is placed over a screen area. This
is a 2-dimensional array that consists of a sub-array of screen
coordinates for displaying the message and another sub-array
consisting of a sub-sub-array for each mouse icon area.
< aMouseHelp[1] > is defined as follows:
Element Type Description
------- ---- -------------------------------------
[1] N Start Message display row
[2] N Start Message display column
[3] N End Message display row
[4] N End Message display column
< aMouseHelp[2] > contains one array for each icon and is defined
as follows:
Element Type Description
------- ---- -------------------------------------
[1] N Start Icon display row
[2] N Start Icon display column
[3] N End Icon display row (if element is a NIL
then element [1] is the default)
[4] N End Icon display column (if element is a NIL
then element [2] is the default)
[5] C Message to display when mouse is placed
over element 1-4 screen coordinates
[6] B Optional code-block to disable the message
for this item. Must return a logical .T.
to enable message or .F. to disable message.
The default is .TRUE.
Returns:
0 if no key is pressed before timeout.
The numeric value of the key pressed (same as INKEY() )
-101 if the left mouse button is pressed
-102 if the right mouse button is pressed
-104 if the right mouse button is released, the left
mouse button is double-clicked, or the left mouse
button in released when in "Windows" compatible
mode.
Description:
DC_INKEY() is used to return the integer numeric value of a key
pressed or mouse button. This is designed as a replacement for
INKEY() when it is required that a procedure be called if a
function key is pressed by the operator or a mouse is being
used.
DC_INKEY() will evaluate any functions which have been
previously established by the SET KEY command or SetKey()
function.
DC_INKEY() is also designed for use with a context-specific
help system and the procedures which have been loaded into
function keys by the KEY LOAD command or DC_KEYLOAD().
Examples:
local nRow, nCol
set key -1 to myfunc1
set key -2 to myfunc2
// Call HELP("MYFUNC") if F1 is pressed
// Call MYFUNC1() if F2 is pressed
// Call MYFUNC2() if F3 is pressed
nInkey := DC_INKEY( 'MYFUNC', 0, @nRow, @nCol )
Source/Library:
_DCINKEY.PRG/.OBJ, DCLIPX.LIB
See Also:
INKEY
dc_inkeydsp()
dc_tbinkey()
dc_inkeydsp()
Display Inkey() and AppEvent() values for pressed keys
Syntax:
DC_InkeyDsp ( [@< nAppEvent >] ) - > nInkey
Arguments:
@< nAppEvent > is a variable (passed by reference) to store the
AppEvent() value of the key pressed.
Returns:
The numeric Inkey() value of the key pressed.
Description:
DC_InkeyDsp() is used to display Inkey() and AppEvent() values
for keys pressed by the user.
Examples:
. nAppEvent := 0
. nInkey := DC_InkeyDsp(@nAppEvent)
. ? nInkey, nAppEvent
Source/Library:
_DCINKEY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_inkey
INKEY
dc_inkeyeval()
Post a code block for evaluation by DC_INKEY()
Syntax:
DC_InkeyEval ( < bBlock > ) - > bBlock
Arguments:
< bBlock > is a code block to evaluate.
Returns:
The last posted DC_INKEYEVAL() code block.
Description:
Many dCLIP functions make calls to DC_INKEY() to get a key.
If you post a code block with DC_INKEYEVAL() before calling
dCLIP functions you can interrupt your application.
Exported Instance Variables:
Methods:
Notes:
Examples:
LOCAL nRow, nCol
DC_INKEYEVAL( {||DevPos(0,0),DevOut(Time())} )
nInkey := DC_INKEY( 'MYFUNC', 0, @nRow, @nCol )
Source/Library:
_DCINKEY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_inkey()
dc_inkeyrelease()
Require mouse to be released or positioned in specified area
Syntax:
DC_InkeyRelease ( < nSeconds > ) - > nil
Arguments:
If < nSeconds > is 0, then DC_INKEY() will return a value only
if the mouse button is released or the mouse is within the
passed coordinates.
If < nSeconds > is greater than 0 then DC_INKEY() will return
a value only after the specified amount of time .AND. if the
mouse is in the specified coordinates. If coordinates are not
passed, then DC_INKEY() will return a value regardless of the
mouse position.
Returns:
nil
Description:
DC_INKEYRELEASE() is used to insure that DC_INKEY() will only
return a value if the mouse button is released after a
specified amount of time or if the mouse is within a
specified area.
Source/Library:
_DCINKEY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_inkey()
dc_inspectobject()
An Xbase Parts Object Inspector
Syntax:
DC_InspectObject( < oObject >, ;
[< lDisplayResults >], ;
[@< aResults >] ) - > cResults
Arguments:
< oObject > is any type of object that is derived from an Xbase
Parts class.
< lDisplayResults > (default) will display the results in three
browse windows.
@< aResults > is a variable, passed by reference, to return a
multi-dimensional array contains the inspection results. This
is an array of 3 sub-arrays.
[1] Instance Variables
[2] Callback Slots
[3] Methods
Each sub-array contains an array for each item.
[1] Item name
[2] Item contents (character string equivalent)
[3] Information about item
[4] Item value
Returns:
A Character string containing all the information delimited
by Chr(13) + Chr(10) for display in a memo window.
Description:
DC_INSPECTOBJECT() is used to display and return the current
status of any object that is derived from an Xbase Parts class.
The contents of Instance variables (iVars), Slots (CallBacks)
and Methods are displayed in three browse windows.
If the contents is a code block then the actual code block text
will be displayed.
If the contents is an array, then the array contents will be
displayed (up to a fixed length to prevent overflowing the
display) and double-clicking the item in the browse will
display the contents of the array using the array browser.
If the contents is an object, the classname of the object will
be displayed and double-clicking the item in the browse will
display the contents of the object using the object browser.
If the contents is any other data type, the full value will be
displayed.
Notes:
CAUTION: Double-Clicking in the Methods window will call the
associated method and display it's returned value in a window.
Examples:
PROCEDURE XTest()
LOCAL oDialog
oDialog := XbpDialog():new(AppDesktop(),,{100,100},{200,300})
oDialog:create()
DC_InspectObject(oDialog)
RETURN
Source/Library:
_DCARRAY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_arrayview()
dc_inspectobject2array()
Create an array containing iVar names and values of an object
Syntax:
DC_InspectObject( < oObject >, ;
[< lIncludeMethods >] - > aResults
Arguments:
< oObject > is any type of object that is derived from an Xbase
class.
< lIncludeMethods (default) will also include the names of
methods.
Returns:
A Multi-Dimensional array.
Description:
DC_InspectObject2Array() is to create a multi-dimensional array
that contains current status of any object that is derived
from an Xbase class. The contents of Instance variables (iVars),
Slots (CallBacks) and Method names will be contained in the array.
If the contents is a code block then the actual code block text
will be written to the array.
If the contents is an object, the classname of the object will
be written to the array.
If the contents is any other data type, the full value will be
written to the array.
Examples:
PROCEDURE XTest()
LOCAL oDialog
oDialog := XbpDialog():new(AppDesktop(),,{100,100},{200,300})
oDialog:create()
aArray := DC_InspectObject2Array(oDialog)
DC_ArrayView(aArray)
RETURN
Source/Library:
_DCARRAY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_inspectobject()
dc_inspectobject2file()
Create a file containing iVar names and values of an object
Syntax:
DC_InspectObject( < oObject >, ;
< cFileName >, ;
[< lIncludeMethods >] - > lStatus
Arguments:
< oObject > is any type of object that is derived from an Xbase
class.
< cFileName > is the name of the file to create.
< lIncludeMethods (default) will also include the names of
methods.
Returns:
A logical .TRUE. if the file could be created, .FALSE. otherwise.
Description:
DC_InspectObject2File() is to create a text file that contains
current status of any object that is derived from an Xbase
class. The contents of Instance variables (iVars),
Slots (CallBacks) and Method names are contained in the file.
If the contents is a code block then the actual code block text
will be written.
If the contents is an object, the classname of the object will
be written.
If the contents is any other data type, the full value will be
written.
Examples:
PROCEDURE XTest()
LOCAL oDialog
oDialog := XbpDialog():new(AppDesktop(),,{100,100},{200,300})
oDialog:create()
lStatus := DC_InspectObject2File(oDialog,"C:\test\test.txt")
RETURN
Source/Library:
_DCARRAY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_inspectobject()
dc_inspectobjectevent()
Set the event which will invoke the Object Inspector
Syntax:
DC_InspectObjectEvent( [< nEvent >] ) - > nOldEvent
Arguments:
< nEvent > is any event that is pulled from the event queue.
Returns:
A numeric value.
Description:
DC_INSPECTOBJECTEVENT() is a Get/Set function that is used to
establish the event which will invoke the Object Inspector.
Examples:
#include "appevent.ch"
// popup the object inspector when a right-button double-click
// occurs on an object.
DC_InspectObjectEvent( xbeM_RbDblClick )
Source/Library:
_DCARRAY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_inspectobject()
dc_inspectthreads()
Pop up a browse with information about running threads
Syntax:
DC_InspectThreads() - > nil
Arguments:
None.
Description:
DC_InspectThreads() will popup a browse screen with information
about currently running threads.
The browse consists of 4 columns of information about each thread.
1. The Thread ID.
2. The Thread Handle.
3. The currently running procedure in the thread.
4. The currently running line number in the thread.
Double-click on an item in the browse to popup the thread object
inspector.
Examples:
The below code will cause Alt-F11 to popup the thread
inspector anywhere in the application.
DC_SetKeyActive(.t.)
SetKey(K_ALT_F11,{||DC_InspectThreads()})
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_inspectobject()
dc_interpret()
Interpret a command string
Syntax:
DC_Interpret( < acCommands >|< cCommand >, ;
[< aParams >] ) - > xReturnVal
Arguments:
< acCommands > is a string containing a set of commands or an
array containing a procedure. If < acCommands > is an array,
then it must conform to the specifications of the array returned
by DC_PROGLOAD(). If this parameter is a NIL, then the Windows
ClipBoard will be used as the program to interpret. This
allows for cutting code snippets out of a help file, copying
them to the ClipBoard and then interpreting the code snippet.
< aParams > is a single-dimensional array of parameters to pass
to the program being interpreted. There should be one element
in the array for each parameter included in the PARAMETERS
statement in the interpreted program.
Returns:
The return value of the program being interpreted.
Description:
DC_INTERPRET() is a command-line interpreter that will translate
and execute any sequence of commands that is supported by Xbase++,
eXPress++ and/or any command that has been user defined in
DCCUSTOM.CH. DC_INTERPRET() requires that the file DCSTD.CH and
DCCUSTOM.CH exist in the INCLUDE path of the workstation. The
DCSTD.CH file contains all the standard eXPress++ commands and
pointers to the Xbase++ include files for the standard Xbase++
commands and defines.
DC_INTERPRET() will execute a single command string or an array of
commands that encompass an entire procedure with passed parameters
and a return value.
DC_INTERPRET() was designed to work in conjuction with DC_PROGRAM()
and/or DC_PROGLOAD() which will load a program from the DCPROG.DBF
program catalog, compile the program into a multi-dimensional
array, then pass the program to DC_INTERPRET() for execution.
Examples:
. DC_Interpret(MemoRead('MYPROG.TXT'))
Source/Library:
_DCDOT.PRG
See Also:
dc_dot()
dc_translate()
dc_isanum()
Is a character alphanumeric?
Syntax:
DC_IsAnum (< cCharacter >) - > lStatus
Arguments:
< cCharacter > is a character string with a length of 1.
Returns:
A logical .TRUE. if the character is an alphanumeric character,
.FALSE. otherwise.
Description:
DC_ISANUM() is used to test whether or not a character is an
alphanumeric character:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz
0123456789
Examples:
? DC_IsAnum('Z')
.T.
? DC_IsAnum('j')
.T.
? DC_IsAnum('4')
.T.
? DC_IsAnum('$')
.F.
Source/Library:
_DCVAL.PRG, DCLIPX.DLL
dc_isanychr()
Is any Character in A string also in B string
Syntax:
DC_IsAnyChr( < cStringA >, < cStringB > ) - > lStatus
Arguments:
< cStringA > and < cStringB > are character strings.
Returns:
A logical .TRUE. if any character in A also exists in B.
Description:
Tests for the existence of any character in string A also
existing in string B.
Examples:
cStringA := 'Hello World'
cStringB := 'fox'
? DC_IsAnyChr( cStringA, cStringB )
.T.
Source/Library:
_DCANYCH.PRG, DCLIPX.DLL
dc_isapprunning()
Test if an application is running
Syntax:
DC_IsAppRunning( < cClass >, ;
< cTitle >, ;
[< cFile >], ;
[< lRestore >] ) - > lStatus
Arguments:
< cClass > is the class name of the window. This is usually
"XbpDialog". If the application window is an XbpCrt() window,
then use the class name "XbpPmtClass".
< cTitle > is the title of the Window.
< cFile > is the file name of the Window. If this parameter is
not use, then the < cTitle > parameter must be used.
< lRestore > if .TRUE. will set focus to the found application
window.
Returns:
A logical .TRUE. if the application window is running, .FALSE.
otherwise.
Description:
DC_IsAppRunning() is used to determine if an Xbase++ application
is already running.
Examples:
// MYAPP.EXE
#INCLUDE "dcdialog.CH"
FUNCTION Main()
LOCAL GetList := {}, dDate := Date(), oDate
IF DC_IsAppRunning('XbpDialog',,'MYAPP.EXE',.t.)
RETURN .f.
ENDIF
@ 0,0 DCSAY 'My Test Dialog' GET dDate POPUP {|d|DC_PopDate(d)} ;
SAYSIZE 0 GETOBJECT oDate
DCREAD GUI FIT ADDBUTTONS TITLE 'Enter the Date' ;
EVAL {|o|o:setInputFocus := {||SetAppFocus(oDate)} }
RETURN .t.
* -------------
PROC AppSys()
RETURN
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_isblank()
Test to determine if all the fields in a record are empty
Syntax:
DC_IsBlank() - > lStatus
Arguments:
None.
Returns:
A logical .TRUE. if the record is blank, .FALSE. otherwise.
Description:
DC_ISBLANK() is used to report whether or not every field in
the current record of the current workarea is empty.
Examples:
. USE COLLECT
. GO 5
. ? DC_IsBlank()
.F.
Source/Library:
_dcblank.prg, DCLIP1.DLL
See Also:
BLANK
dc_blank()
dc_isdescend()
Is the current index a Descending index?
Syntax:
DC_IsDescend( [< nOrder >] ) - > lStatus
Arguments:
< nOrder > is the order number of the controlling index. If
no parameter is passed then the current controlling index
will be used.
Returns:
A logical .TRUE. if the index is Descending, .FALSE. otherwise.
Description:
DC_ISDESCEND() is used to report if the currently selected
index is indexed in descending order. This function will only
report correctly if the DESCEND option was used during
indexing, not if the DESCEND() function was used.
Examples:
use customer
index on cust_name to custname
? DC_ISDESCEND()
.F.
index on cust_name to custname descending
? DC_ISDESCEND()
.T.
index on DESCEND(cust_name) to custname
? DC_ISDESCEND()
.F.
Source/Library:
_DCAREA.PRG, DCLIP1.DLL
See Also:
dc_isunique()
dc_isdescendant()
Is an object a descendant of another object.
Syntax:
DC_IsDescendant( < oXbp >, ;
< oAncestor > ) - > lStatus
Arguments:
< oXbp > is the object to test.
< oAncestor > is the ancestor to test.
Description:
DC_IsDescendant() is used to determine if an object is a descendant
of another object, ie a child, a grandchild, a great-grandchild,
etc.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_isdir()
Does a directory exist?
Syntax:
DC_IsDir( < cDirectory > ) - > lStatus
Arguments:
< cDirectory > is the directory to test.
Returns:
A logical .TRUE. if the directory exists, .FALSE. otherwise.
Description:
DC_IsDir() is used to test if a directory exists.
Source/Library:
_DCPATH.PRG, DCLIPX.DLL
See Also:
dc_pathfound()
dc_path()
dc_ispath()
Is a directory listed in an Environment string?
Syntax:
DC_IsPath ( < cPath >, ;
< cDirectory > ) - > lStatus
Arguments:
< cPath > is a path string with drive/directories separated
by semicolons.
< cDirectory > is the directory to test.
Returns:
A logical .TRUE. if the directory exists in the path string,
.FALSE. otherwise.
Description:
DC_ISPATH() is used to test if a directory has been listed
in a path string.
Examples:
? DC_ISPATH( GETE('PATH'),'C:\DOS' )
.T.
SET(_SET_PATH,'C:\MYDATA;D:\HISDATA;D:\HERDATA')
? DC_ISPATH( SET(_SET_PATH), 'C:\HISDATA' )
.T.
? DC_ISPATH( SET(_SET_PATH), '\WINDOWS' )
.F.
Source/Library:
_DCPATH.PRG, DCLIPX.DLL
See Also:
dc_pathfound()
dc_isshared()
Is a work area opened in Shared mode?
Syntax:
DC_IsShared ( [< nArea >] ) - > lStatus
Arguments:
< nArea > is the work area be queried. If no argument is given,
then the current work area is default.
Returns:
A logical .TRUE. if the file is open SHARED, .FALSE. otherwise.
Description:
DC_ISSHARED() is used to report whether a database in a
specified work area was opened in SHARED mode or EXCLUSIVE.
Examples:
use customer shared
? DC_ISSHARED()
.T.
Source/Library:
_DCAREA.PRG, DCLIP1.DLL
dc_isstru()
Verify the structure of a database
Syntax:
DC_IsStru ( < aStructure > ) - > lStatus
Arguments:
< aStructure > is a multi-dimensional array with one sub-array
for each database field.
Element Type Description
------ ---- ------------------------
[1] C Field Name
[2] C Field Type
[3] N Field Length
[4] N Field Decimals
[5] Any Default Data (optional)
Returns:
A logical .TRUE. if the file structure matches the array
structure, .FALSE. otherwise.
Description:
DC_ISSTRU() is used to verify that the current database matches
a structure from an Xbase++ or eXPress++ structure array.
Notes:
If DC_DBFILE() is used to open a database, the structure of
the database will be automatically compared to the structure
in the field dictionary and prompt the user to either update
the structure of the database from the structure in the
dictionary or update the dictionary to match the database.
Examples:
aStru := { ;
{ 'CUST_NAME','C',25,0 },;
{ 'CUST_NMBR','C',10,0 },;
{ 'LAST_DATE','D',8,0 } }
use customer
if .not. DC_ISTRU( aStru )
dc_struupdate( aStru )
endif
Source/Library:
_DCSTRU.PRG, DCLIP2.DLL
See Also:
dc_struupdate()
dc_modstru()
dc_dbfile()
dc_isunique()
Is the current index a Unique index?
Syntax:
DC_IsUnique ( [< nArea >] ) - > lStatus
Arguments:
< nArea > is the work area. If no argument is passed then the
current work area will be reported.
Returns:
A logical .TRUE. if the index is Unique, .FALSE. otherwise.
Description:
DC_ISUNIQUE() is used to report if the currently selected index
is indexed UNIQUE (i.e. No duplicate keys in index ).
Examples:
use customer
index on cust_name to custname
? DC_ISUNIQUE()
.F.
index on cust_name to custname unique
? DC_ISUNIQUE()
.T.
Source/Library:
_DCAREA.PRG, DCLIP1.DLL
See Also:
dc_isdescend()
dc_jazzagekey()
A Get-Set function for posting the JazzAge Key
Syntax:
DC_JazzAgeKey( [< cKey >] ) - > cOldKey
Arguments:
< cKey > is the JazzAge key that was received when registering
your copy of JazzAge.
Returns:
A character string.
Description:
DC_JazzAgeKey() is a Get-Set function which is used to store
the developer's individual JazzAge key that was received when
JazzAge was registered.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_printpreviewacrobat()
dc_jpgsize()
Returns the size of a JPEG file
Syntax:
DC_JPGSize( < cImage >, ;
< @nWidth >, ;
< @nHeight >) - > cStatus
Arguments:
< cImage > is the full name, including path, of the JPEG file.
< @nWidth > is a variable, passed by reference, to store the width.
< @nHeight > is a variable, passed by reference. to store the height.
Returns:
A Character string containing the status of whether or not the
size could be determined.
Description:
DC_JPGSize() will return the size of a JPG file. It is much
faster than using the XbpBitMap() class to determine the size.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_keycount()
Return the number of "active" records
Syntax:
DC_KeyCount ( [< xTop >], ;
[< xBottom >], ;
[< nTimeOut >] ) - > nKeyCount
Arguments:
< xTop > is a value that matches the same type as the index
key to set as the top of the database.
< xBottom > is a value that matches the same type as the
index key to set as the bottom of the database.
< nTimeOut > is the amount of time (in seconds) to allow
DC_KEYCOUNT() to calculate the number of records. If the
database is too large or the computer is too slow, this
calculation may take too much time to be practical. If the
calculation takes longer than < nTimeOut > then -1 will be
returned.
Returns:
1. If there is no controlling index and no filter set then
the total number of records in the database will be
returned.
2. If there is a controlling index and it is not a conditional
index then the total number of records in the database will
be returned.
3. If there is a controlling index and it is also a
conditional index then the number of keys in the index will
be returned.
4. If values are passed for xTop and/or xBottom and there is a
controlling index, then the number of records between the
xTop and xBottom values will be returned.
5. -1 if DC_KeyStat() is set to .FALSE.
Description:
DC_KEYCOUNT() is used to calculate the number of "active"
records in a database. This is accomplished by using a
special agorithm that skips through the index in a manner
must faster than simply skipping one record at a time and
counting records. In many cases, this calculation can be
accomplished in a fraction of a second, however, conditions
can exist that may require a several seconds.
Notes:
DC_KEYCOUNT() takes into consideration the scoping condition that
was set with DC_SetScope() and counts only the number of records
that fall into scope.
Examples:
#include 'dcdialog.ch'
#include 'appevent.ch'
PROCEDURE XTest()
LOCAL GetList := {}, oBrowse, aPres, cScopeTop, cScopeBot
USE ..\XDOC\EXPRESS INDEX ..\XDOC\EXPRESS.CDX ;
VIA FOXCDX ALIAS XDOC
OrdSetFocus('COMMAND')
DC_KeyStat(.t.)
aPres := ;
{ { XBP_PP_COL_HA_FGCLR, GRA_CLR_WHITE }, /* Header FG Color */ ;
{ XBP_PP_COL_HA_BGCLR, GRA_CLR_DARKGRAY }, /* Header BG Color */ ;
{ XBP_PP_COL_DA_ROWSEPARATOR, XBPCOL_SEP_DOTTED }, /* Row Sep */ ;
{ XBP_PP_COL_DA_COLSEPARATOR, XBPCOL_SEP_DOTTED } /* Col Sep */ ;
}
@ 3,1 DCBROWSE oBrowse ALIAS 'XDOC' ;
SIZE 77,11.8 ;
FREEZELEFT {1} ;
PRESENTATION aPres
DCBROWSECOL FIELD XDOC->command ;
HEADER "Command" PARENT oBrowse
DCBROWSECOL FIELD XDOC->type ;
HEADER "Type" PARENT oBrowse
DCBROWSECOL FIELD XDOC->short ;
HEADER "Short Description" PARENT oBrowse
DCBROWSECOL FIELD XDOC->module ;
HEADER "Module" PARENT oBrowse ;
DCBROWSECOL FIELD XDOC->category ;
HEADER "Category" PARENT oBrowse
DCBROWSECOL FIELD XDOC->see_also ;
HEADER "See Also" PARENT oBrowse
DCREAD GUI ;
FIT ;
ADDBUTTONS ;
TITLE 'Browse Scoping Demo' ;
EVAL {||_SetNavBlocks(oBrowse),;
DC_SetScope(0,'DC_G'),;
DC_SetScope(1,'DC_K'),;
DC_DbGoTop(),;
oBrowse:RefreshAll() }
RETURN
/* -------------------- */
STATIC PROCEDURE _SetNavBlocks( oBrowse )
oBrowse:skipBlock := {|n| DC_DbSkip(n) }
oBrowse:goTopBlock := {| | DC_DbGoTop() }
oBrowse:goBottomBlock := {| | DC_DbGoBottom() }
oBrowse:phyPosBlock := {| | Recno() }
oBrowse:posBlock := {| | DC_KeyNo() }
oBrowse:lastPosBlock := {| | DC_KEYCOUNT() }
oBrowse:firstPosBlock := {| | 1 }
RETURN
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_keyno()
dc_setscope()
dc_keystat()
dc_keyno()
Return the ordinal position of the current record
Syntax:
DC_KeyNo ( [< nTimeOut >], ;
[@< nKeyCount >] ) - > nKeyNo
Arguments:
< nTimeOut > is the amount of time (in seconds) to allow
DC_KEYNO() to calculate the number of records. If the
database is too large or the computer is too slow, this
calculation may take too much time to be practical. If the
calculation takes longer than < nTimeOut > then -1 will be
returned.
@< nKeyCount > is the name of a memory variable to save the
number of active records. This count is the same as
returned by DC_KEYCOUNT().
Returns:
1. If there is no controlling index and no filter set then
the current record number (RECNO()) will be returned.
2. If there is a controlling index then the ordinal position
of the current record within the index will be returned.
3. -1 if DC_KeyStat() is set to .FALSE.
Description:
DC_KEYNO() is used to calculate the ordinal position of the
current record in a "scoped" database. This is accomplished by
using a special agorithm that skips through the index in a manner
must faster than simply skipping one record at a time and counting
records. In many cases, this calculation can be accomplished in a
fraction of a second, however, conditions can exist that may
require a several seconds.
Notes:
DC_KEYNO() is required to determine the ordinal position when
using SCOPEs via DC_SetScope(), otherwise the Xbase++ function
OrdKeyNo() provides this information.
Examples:
#include 'dcdialog.ch'
#include 'appevent.ch'
PROCEDURE XTest()
LOCAL GetList := {}, oBrowse, aPres, cScopeTop, cScopeBot
USE ..\XDOC\EXPRESS INDEX ..\XDOC\EXPRESS.CDX ;
VIA FOXCDX ALIAS XDOC
OrdSetFocus('COMMAND')
DC_KeyStat(.t.)
aPres := ;
{ { XBP_PP_COL_HA_FGCLR, GRA_CLR_WHITE }, /* Header FG Color */ ;
{ XBP_PP_COL_HA_BGCLR, GRA_CLR_DARKGRAY }, /* Header BG Color */ ;
{ XBP_PP_COL_DA_ROWSEPARATOR, XBPCOL_SEP_DOTTED }, /* Row Sep */ ;
{ XBP_PP_COL_DA_COLSEPARATOR, XBPCOL_SEP_DOTTED } /* Col Sep */ ;
}
@ 3,1 DCBROWSE oBrowse ALIAS 'XDOC' ;
SIZE 77,11.8 ;
FREEZELEFT {1} ;
PRESENTATION aPres
DCBROWSECOL FIELD XDOC->command ;
HEADER "Command" PARENT oBrowse
DCBROWSECOL FIELD XDOC->type ;
HEADER "Type" PARENT oBrowse
DCBROWSECOL FIELD XDOC->short ;
HEADER "Short Description" PARENT oBrowse
DCBROWSECOL FIELD XDOC->module ;
HEADER "Module" PARENT oBrowse ;
DCBROWSECOL FIELD XDOC->category ;
HEADER "Category" PARENT oBrowse
DCBROWSECOL FIELD XDOC->see_also ;
HEADER "See Also" PARENT oBrowse
DCREAD GUI ;
FIT ;
ADDBUTTONS ;
TITLE 'Browse Scoping Demo' ;
EVAL {||_SetNavBlocks(oBrowse),;
DC_SetScope(0,'DC_G'),;
DC_SetScope(1,'DC_K'),;
DC_DbGoTop(),;
oBrowse:RefreshAll() }
RETURN
/* -------------------- */
STATIC PROCEDURE _SetNavBlocks( oBrowse )
oBrowse:skipBlock := {|n| DC_DbSkip(n) }
oBrowse:goTopBlock := {| | DC_DbGoTop() }
oBrowse:goBottomBlock := {| | DC_DbGoBottom() }
oBrowse:phyPosBlock := {| | Recno() }
oBrowse:posBlock := {| | DC_KEYNO() }
oBrowse:lastPosBlock := {| | DC_KeyCount() }
oBrowse:firstPosBlock := {| | 1 }
RETURN
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_keycount()
dc_keyno()
dc_keystat()
dc_setscope()
dc_keystat()
Enable or disable scoping
Syntax:
DC_KeyStat ( [< lStat >] ) - > lStat
Arguments:
< lStat > if TRUE will enable DC_KeyNo() and DC_KeyCount(). If
< lStat > is FALSE the functions will be disabled.
Description:
DC_KeyStat() is used to enable or disable the DC_KeyNo() and
DC_KeyCount() functions. DC_KeyNo() and DC_KeyCount() can
take a very long time to calculate the current record position
or number of scoped records on very large databases. DC_KeyStat()
can be used to turn off all scoping.
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_keycount()
dc_keyno()
DC_KeyString2Num()
Translate a key string to a numeric value
Syntax:
DC_KeyString2Num( < cKey > ) - > nKey
Arguments:
< cKey > is the name of the key.
Returns:
A numeric value.
Description:
DC_KeyString2Num() s is used to translate a string that defines
a key to a numeric Xbase++ equivalent. This is handy for
data-driven applications.
Examples:
DC_KeyString2Num('Shift-F10') -> xbeK_SH_F10
DC_KeyString2Num('Ctrl-F10') -> xbeK_CTRL_F10
DC_KeyString2Num('Control-F10') -> xbeK_CTRL_F10
Source/Library:
_DCPUTK.PRG, DCLIPX.DLL
dc_keytran()
Translate AppEvent() keyboard value to Inkey() value
Syntax:
DC_KeyTran ( < nKey >, ;
[< nMode >] ) - > nKeyVal
Arguments:
< nKey > is the AppEvent() value of the key to translate to
Inkey() if < nMode > is 1 (default). If < nMode > is 2 then
< nKey >
is the Inkey() value of the key to translate to AppEvent().
Returns:
A numeric value.
Description:
DC_KEYTRAN() is used to translate an AppEvent() keyboard
value to an Inkey() keyboard value or vice-versa.
Examples:
? DC_KEYTRAN( xbeP_UP, 1 )
5
? DC_KEYTRAN( K_UP, 2 )
65574
Source/Library:
_DCPUTK.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_appkeydefine()
dc_appeventdefine()
dc_langblock()
Post a code-block for language translator
Syntax:
DC_LangBlock( [< bCodeBlock >] ) - > bOldBlock
Arguments:
< bCodeBlock > is a code block in the following form:
{ | cMessage, cID | MyTranslator( cMessage, cID ) }
Returns:
A code block containing the previous translation block. If no
code block has been posted, then a NIL is return.
Description:
DC_LANGBLOCK() is used to post a code-block at the beginning of a
program pointing to the function which performs translation of
screen messages. It is used in conjunction with DC_LANGMSG().
A default message and a numeric message ID are passed as parameters
to the code block by DC_LANGMSG(). This code block points to a
function which must return a message based on the message ID
received. The function can be used to store messages in .DBF
files,.INI files, in source code, or any other storage medium.
Messages in eXPress++ functions like DC_ReadGui() and the
DC_Printer() class are translated via DC_LANGMSG() and numeric
constants defined in DCMSG.CH. Normally, a language is selected
via DC_LANGSET(), however, this function may be overridden by
posting a custom language translator via DC_LANGBLOCK() thereby
disabling the current language translator.
Examples:
FUNCTION main
DC_LANGBLOCK( { |cMessage,cID| MyTranslator(cMessage,cID) } )
? DC_LangMsg( MYMSG_TESTING )
This is a test
? DC_LangMsg( DCMSG_HELP )
Helfen
? DC_LangMsg( DCMSG_CANCEL )
Absagen
RETURN
/* --------------------- */
FUNCTION MyTranslator( nMessage )
LOCAL nSaveArea := Select()
IF Select('GERMAN') = 0
USE German
ENDIF
SEEK nMessage
IF !Eof()
cMessage := GERMAN->message
ENDIF
SELE (nSaveArea)
RETURN cMessage
Source/Library:
_DCLANG.PRG, DCLIPX.LIB
See Also:
dc_langmsg
dc_langmsg()
Translate a message by language
Syntax:
DC_LangMsg( < nMessageID > ) - > cMessage
Arguments:
< nMessageID > is a numeric constant defined in DCMSG.CH.
< nMessageId > may be any additional numeric value defined by
the programmer when using a custom translator posted by
DC_LANGBLOCK().
Returns:
A character string.
Description:
DC_LANGMSG() is used as a "wrapper" function to translate messages
based on language. It is used in conjunction with DC_LANGSET()
for selecting a built-in language translation or with DC_LANGBLOCK()
for selecting a custom language translation.
A numeric message ID is passed to DC_LANGMSG(). Message ID's are
constants which are defined in DCMSG.CH for standard eXPress++
messages used in dialog boxes, message boxes, print routines, etc.
Only messages which are intended for the end user of an eXPress++
program are assigned numeric constants and are translated. All
messages which are intended for the programmer (ie error messages)
are displayed in English.
Examples:
FUNCTION main
DC_LangSet('GERMAN')
? DC_LangMsg( DCMSG_HELP )
Helfen
? DC_LangMsg( DCMSG_CANCEL )
Absagen
RETURN
Source/Library:
_DCLANG.PRG, DCLIPX.LIB
See Also:
dc_langblock()
dc_langset()
Set the default language for eXPress++ messages
Syntax:
DC_LangMsg( [< nLanguage >] ) - > nOldLanguage
Arguments:
< nLanguage > is a numeric constant with a DCLANG_* prefix. These
constants are defined in DCMSG.CH.
DCLANG_ENGLISH - English
DCLANG_GERMAN - German
DCLANG_PORTUGUESE - Portuguese
DCLANG_SPANISH - Spanish
DCLANG_CHINESE - Chinese
DCLANG_FRENCH - French
DCLANG_ITALIAN - Italian
DCLANG_DUTCH - Dutch
DCLANG_SLOVENIAN - Slovenian
DCLANG_PORTUGUESE_BR - Portuguese, Brazilian
DCLANG_SWEDISH - Swedish
DCLANG_NORWEGIAN - Norwegian
DCLANG_RUSSIAN - Russian
DCLANG_POLISH - Polish
DCLANG_SLOVAK - Slovak
DCLANG_CZECH - Czech
DCLANG_ROMANIAN - Romanian
DCLANG_SIMPLIFIEDCHINESE - Simplified Chinese
DCLANG_CROATIAN - Croatian
DCLANG_HUNGARIAN - Hungarian
DCLANG_TURKISH - Turkish
Returns:
A character string.
Description:
DC_LANGSET() is used to set the language for translating eXPress++
message. DC_LANGSET() is used in conjunction with DC_LANGMSG() for
displaying messages on buttons, windows, etc.
A numeric message ID is passed to DC_LANGMSG(). Message ID's are
constants which are defined in DCMSG.CH for standard eXPress++
messages used in dialog boxes, message boxes, print routines, etc.
Only messages which are intended for the end user of an eXPress++
program are assigned numeric constants and are translated. All
messages which are intended for the programmer (ie error messages)
are displayed in English.
Examples:
FUNCTION main
DC_LangSet(DCLANG_GERMAN)
? DC_LangMsg( DCMSG_HELP )
Helfen
? DC_LangMsg( DCMSG_CANCEL )
Absagen
RETURN
Source/Library:
_DCLANG.PRG, DCLIPX.LIB
See Also:
dc_langblock()
dc_langmsg()
dc_lastfocus()
Store oXbp pointer for returning focus
Syntax:
DC_LastFocus( < aGetList >, ;
[< oXbp >] ) - > oOldLastFocus
Arguments:
< aGetList > is a pointer to the GetList array.
< oXbp > is a pointer to the object.
Returns:
Nil.
Description:
DC_LastFocus() is used to store a pointer to oXbp object for returning
focus after calling another window. DC_ReadGuiEventLoop() automatically
returns focus to the last object that had focus when the objects main
window receives focus. This can be overridden with DC_LastFocus().
Examples:
#include "dcdialog.ch"
function main()
local GetList[0], oMenuBar, oSubMenu, oDlg
dcmenubar oMenuBar
dcsubmenu oSubMenu prompt 'Test' ;
action {|o|o:=Thread():new(),o:start({||Test(oDlg)})} ;
parent oMenuBar
dc_readguidebug(2)
dcread gui parent @oDlg
return nil
* ------------
static function test( oDlg )
local getlist[0], d1 := date(), d2 := Date(), d3 := Date(), o1, o2, o3
@ 1,1 dcget d1 popup {|d|dc_popdate(d)} object o1
@ 2,1 dcget d2 popup {|d|dc_popdate(d)} object o2
@ 3,1 dcget d3 popup {|d|dc_popdate(d)} object o3
@ 5,1 dcpushbutton caption 'More Test' size 15,1.2 ;
action {||msgbox('test'),DC_LASTFOCUS(GetList, o1)}
dcread gui fit addbuttons title 'Testing' appwindow oDlg:drawingArea
return nil
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
See Also:
dc_readguieventloop()
dc_lockmaint()
Maintain the "Lock" definition database
Syntax:
DC_LockMaint ( [< lPickList >] ) - > cLockCode
Arguments:
< lPickList > if .TRUE. will return the lock number from the
selected record when the < ENTER > key is pressed. If .FALSE.,
(default) then the < ENTER > key will be used to edit the
current record.
Returns:
A character string of three (5) characters representing the
"lock" selected from the pick-list.
Description:
DC_LOCKMAINT() is used to maintain a database of "Locks"
which are put onto files, menu items, or fields when
designing an application. This database, DCLOCKS.DBF, is used
as a reference only and is not needed to establish locks on menu
items or other locks. The database simply provides a handy
picklist to choose a lock to put on an item. The database
assigns names and codes to locks.
Source/Library:
_DCUSER.PRG
See Also:
dc_usermaint()
dc_log()
Write system status to a log file
Syntax:
DC_Log ( [< cProcName >], ;
[< nLineNmbr >], ;
[< cInfo >], ;
[< cFileName >], ;
[< lOverWrite >], ;
[< nLastKey >], ;
[< cCurrScreen >] ) - > Nil
Arguments:
< cProcName > is the current procedure name.
< nLineNmbr > is the current line number.
< cInfo > is an information string.
< cFileName > is the name of the file to write.
< lOverWrite > if .TRUE. will overwrite < cFileName >, if
.FALSE.
will append the information.
< nLastKey > is the last key hit value to include in the logged
data. If no argument is given then LASTKEY() is default.
< cCurrScreen > is the Screen contents you want to include in the
logged data. If no argument is given then the current screen
contents is default.
Returns:
Nil
Description:
DC_LOG() will log information about the currently running
procedure to a log file including the current status of work
areas and environment variables.
A dialog window will be displayed first for the user to type
in specific information that will be saved in the log file
or to specify the name and location of the log file.
Examples:
FUNCTION error ( cMessage )
save screen to cCurrScreen
cProc := procname(1) // proc name of calling procedure
nLine := procline(1) // line number of calling procedure
DC_LOG( cProc, nLine, cMessage, "MYERR.LOG", .F., LASTKEY(),;
cCurrScreen )
RETURN .t.
Source/Library:
_DCLOG.PRG, DCLIP2.DLL
See Also:
LOG
dc_setdclip()
dc_memoedit
A dual-mode replacement for MemoEdit()
Syntax:
DC_MemoEdit( < cMemo >, ;
< nTop >, ;
< nLeft >, ;
< nBottom >, ;
< nRight >, ;
< lEditMode >, ;
< bcUserFunc >, ;
< nLineLen >, ;
< nTabSize >, ;
< nBufferRow >, ;
< nBufferCol >, ;
< nWindowRow >, ;
< nWindowCol >, ;
< cTitle > ) - > cMemo
Description:
DC_MemoEdit() is a dual-mode replacement for MemoEdit(). If the
GUI flag has been turned on via the DC_Gui() function, then the
parameters are passed on to DC_GuiMemoEdit() otherwise they are
passed on to MemoEdit().
Source/Library:
_DCMEMOE.PRG, DCLIPX.DLL
See Also:
dc_guimemoedit()
dc_menu_p()
A nested, moused pull-down menu-system
Syntax:
DC_Menu_P ( < nRow >, ;
< nCol >, ;
[< cTitle >], ;
[< cColor >], ;
[< cType >], ;
[< lBar >], ;
[< lRetVal >], ;
[@< nStart >], ;
< aPrompt >, ;
[< aBlock >], ;
[< aCoord >], ;
[< aMsg >], ;
[< aMsgOpt >], ;
[< cExit >], ;
[< lRestScrn >], ;
[< lShadow >], ;
[< aMouse >], ;
[< lSticky >], ;
[< aHelp >] ) - > cCode
Arguments:
< nRow > is the upper-left row (for pull-downs), or lower-left
row (for pop-up menus).
< nCol > is the upper-left column (for pull-downs), or lower-left
column for pop-up menus).
< cTitle > is an Optional title to be displayed centered on the
top or bottom line of the box (depending on if it's a pull-down
or a pop-up box.) If no title is desired use a null string
("").
< cColor > is a single string of 5 colors (separated by
commas) to be used for the frame, menu items, hi-lited letters,
select bar, grayed items respectively. If no argument is
passed, then the dCLIP default colors will be used.
< cType > is a single character defining the type of menu:
A - Pull-down menu
B - Pop-up menu
C - Plain menu, no borders (default)
< lBar > if .TRUE. (default) will make the menu resemble a
MENU TO, with a select bar. If you do not want a select bar,
and just want the items to be chosen by pressing the hot-key
letter only, set this to .FALSE.
< lRetVal > if .FALSE. (default) will return the hot-key
character of the selected menu item. If .TRUE., the CHR()
value of the menu choice will be returned. For example, if
the 4th menu item is selected, then CHR(4) will be returned.
This parameter should also be set to .TRUE. if you are
passing code-blocks to be evaluated and want to return from
the menu after evaluating the code-block.
< nStart > is a numeric or character value to determine which
element to start on. If the type is numeric, then the starting
element is the number, if the type is character then the
starting element is the first item whose highlighted character
matches the < nStart > character. The number of the menu item
selected will be stored in the value referenced by @< nStart >.
< aPrompt > is an array of menu prompts to be displayed. The
first letter of each menu item will be hilited and will be
designated as that menu item's "hot-key". If a different
hot-key letter is desired for a item, precede the desired
hot-key letter with a tilde (~). If the item is a
"gray-scale" item (i.e. it displays only but is not
selectable), it must be preceded by an "*" character. If the
item is a separator line, it must be passed as an "@"
character. If the item is a separator line with a sub-title,
then it must be passed as a "@" character plus the sub-title
string. "Nesting" of sub-menus is accomplished by passing an
array of sub-menu information rather than a character string.
< aPrompt > may contain any mixture of character strings
(single items) or arrays (nested items). Selection of a
nested item will pop-up a sub-menu. To create nested items
pass an array with the following structure:
Element Type Description
------- ---- ---------------------------------
[1] C Menu prompt
[2] A Array of sub-menu items
[3] A Array of sub-menu code-blocks (optional)
[4] A Array of sub-menu messages (optional)
[5] A Array of sub-menu help-codes (optional)
< aBlock > is an optional array of code blocks. Must be one
code block for each item in < aPrompt >. If a code block array
is passed then the code block will be evaluated when the item
is selected and the user presses enter.
< aCoord > is an optional ragged array of Row/Column positions
for each item in < aPrompts >. If a Row/Column array is not
passed then the prompts will be placed vertically starting at
< nRow > and < nCol >.
< aMsg > is an optional array of messages to be displayed for
each item in < aPrompt >. Each item in this array is a
character string which will be displayed in a box or a single
line depending on the values in < aMsgOpt >.
< aMsgOpt > is an array of options on how to display the
message for the selected prompt.
Element Type Description
------- ----- -----------------------------------------------
[1] N Display Row if TYPE 0
[2] N Display Column if TYPE 0 (-1 to center message)
[3] N Message TYPE (0-Line, 1-Box, 2-Add to Pull-Down
[4] N Start Row if TYPE 0,1 or Height if TYPE 2
[5] N Start Column if TYPE 0,1 (-1 to center message)
or Width if TYPE 2
[6] N End Row if TYPE 1
[7] N End Column if TYPE 1
< cExit > is a string containing the character value of any
keys that will exit the menu and return the pressed key value.
The ESCape key always exits. If any "exit key" is pressed that
is not a menu item "hot key", then the key character value will
be returned.
< lRestScrn > if .TRUE. (default) will restore the previous
screen after exiting the menu. If .FALSE. the menu and
highlighted selection will remain on the screen.
< lShadow > if .TRUE. (default only if < cType > is "A") will
display a shadow on the menu.
< aMouse > is a multi-dimensional array of mouse-buttons
to active outside the menu area. See DC_MOUSEKEY() for
specifications.
< lSticky > is used to modify the behavior of DC_MENU_P() only
when a selected item has an associated code-block. If
< lSticky > is true, the code-block will be evaluated while the
menu is still displayed on the screen. If .FALSE., then the
screen will be restored (only if < lRestoreScreen > is .TRUE.)
followed by the evaluation of the code-block.
< aHelp > is an optional array of Help-Codes for each prompt
item in < aPrompts >. Each help-code is a character string
of up to 15 characters in length which matches the value in
the PROC_NAME field of the DCHELP.DBF database. The
concatenated values in the DCHELP.DBF memo fields will be
displayed in a memo window whenever the F1 key is pressed
after selecting a prompt. See the function DC_HELPF1() for
more information on setting up context-specific help.
Returns:
If <þlReturnValþ> is .FALSE. (default) the hot-key character of the
selected menu item will be returned. If <þlReturnValþ> is .TRUE.,
the CHR() value of the menu choice will be returned. For example,
if the 4th menu item is selected, then CHR(4) will be returned.
A null string is returned if the ESCape key is pressed.
Description:
DC_MENU_P() is a menu-system that creates pull-down, pop-up, or
AT..PROMPT style menus with optional "high-lighted" characters,
separator lines, "grayed (non-selectable)" items, message
lines, and optional code-block evaluation.
DC_MENU_P() automatically supports both keyboard and mouse
input. If the menu is a pop-up or pull-down menu, then clicking
the mouse outside the menu prompt area is equivalent to
pressing the escape key. The left button of the mouse is used
to select the menu item. Press the ENTER key, the right mouse
button, or double-click the left mouse button to invoke the
selected item.
Menus may be "nested" to provide sub-menus and sub-sub-menus.
If a sub-array of Help-Messages is passed, then a more
descriptive message about the prompt can be displayed (based
on options) in a fixed window area on the screen or in a
window that connects to the bottom of the pull-down menu.
If a sub-array of Help-Codes is passed, then a context-
specific help screen in the DCHELP.DBF database will displayed
when the F1 key is pressed or the mouse is clicked in the
help-message area.
Notes:
The behavior of DC_MENU_P() depends on the current setting
of the DC_WINMODE() function.
Examples:
-- Example 1 --
// This example demonstrates using DC_MENU_P() to return a
// code letter based on a user menu selection
local aPrompts, cMenuCode
aPrompts := { 'Open File',;
'Close File',;
'Edit File',;
'Save File',;
'View File',;
'Print File',;
'Run Program',;
'DOS ~Shell' }
cMenuCode := ;
DC_MENU_P( 24, 28, ' File Options ', ;
'bg+/rb,n/bg,w+/bg,w+/r,n+/bg', 'B', .t., .f., 'O', ;
aPrompts )
do case
case cMenuCode = 'O'
openfile()
case cMenuCode = 'C'
closefile()
case cMenuCode = 'E'
editfile()
case cMenuCode = 'S'
savefile()
case cMenuCode = 'S'
viewfile()
case cMenuCode = 'P'
printfile()
case cMenuCode = 'R'
runexe()
case cMenuCode = 'S'
rundos()
endcase
return
-- Example 2 --
// This example demonstrates using DC_MENU_P() to execute a
// code block based on a user menu selection
local aPrompts, aBlocks
aPrompts := { 'Open File',;
'Close File',;
'Edit File',;
'Save File',;
'View File',;
'Print File',;
'Run Program',;
'DOS ~Shell' }
aBlocks := { {||openfile()},;
{||closefile()},;
{||editfile()},;
{||savefile()},;
{||viewfile()},;
{||printfile()},;
{||runexe()},;
{||rundos()} }
DC_MENU_P( 24, 28, ' File Options ', ;
'bg+/rb,n/bg,w+/bg,w+/r,n+/bg', 'B', .t., .f., 'O', ;
aPrompts, aBlocks )
return
-- Example 3 --
// This example shows how to "nest" sub-menus.
// In the below example, selecting item 2 (File Options) of
// the main menu will pop-up a sub-menu. Selecting Item 1
// (Delete a File) will pop-up another sub-menu. Selecting
// Item 2 (Binary File) will return "FDB".
LOCAL aSubPrompt, aSubBlock, aMainPrompt, aSubSubPrompt
aSubSubPrompt := {'ASCII File','Binary File','EXE File'}
aSubPrompt := { ;
{'Delete a file',aDelPrompt},;
'Copy a file', ;
'Move a file' }
aSubBlock := { , {||copyafile()}, {||moveafile()} }
aMainPrompt := { ;
'Edit Options',;
{'File Options', aSubPrompt, aSubBlock },;
'Search Options',;
'Print Options' }
cSelection := ;
DC_Menu_P ( 10, 10, , , 'B', , , , aPrompt, , , , , , , , , )
Source/Library:
_DCMENU2.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_menupull()
dc_menumain()
dc_menu_to()
A moused replacement for MENU TO (__menuto())
Syntax:
DC_Menu_To( [< nChoice >], ;
[< nMsgRow >], ;
[< nMsgCol >], ;
[< cColor >] ) - > nChoice
Arguments:
< nChoice > is the initial prompt to be highlighted.
< nMsgRow > is the optional screen row to display messages when a
prompt is selected. If no argument is passed, then the row
established by the SET MESSAGE environment variable will be
used.
< nMsgCol > is the optional screen column to display messages
when a prompt is selected. If no argument is passed, then the
message will be displayed at column 0 unless the SET MESSAGE
CENTER environment variable is active, then it will be centered
in the message row. If -1 is passed the message will be
centered in the message row.
< cColor > is an optional color string of two colors separated
by commas. The first color is the color of the unhighlighted
items and the second color is the color of the highlighted
item. If no parameter is passed, then the current system color
setting will be used.
Returns:
The letter corresponding to the Hot-Key assigned to the menu item
that was selected, a <þ sign if the left arrow was pressed, a þ> if
the right arrow was pressed, or a null string if an error occured.
Description:
DC_MENU_TO() is used with DC_AT_PROMPT() as a replacement for
Clipper AT..PROMPT and MENU TO commands. DC_MENU_TO() will
enable the dCLIP mouse system and allow menu selections by
mouse or keyboard.
No other changes are required to source code to add the mouse
to menus other than changing AT..PROMPT commands to
DC_AT_PROMPT() and MENU TO commands to DC_MENU_TO() or #include
"DCMOUSE.CH".
Examples:
// display prompts
dc_at_prompt( 10, 10, "Open a File", "Use a new database" )
dc_at_prompt( 12, 10, "Open an Index", "Use an Index file" )
dc_at_prompt( 14, 10, "Edit database", "Browse all records" )
// get a user selection and display message at row 20, col 25
nChoice := DC_MENU_TO( 1, 20, 25 )
Source/Library:
_DCMENU2.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_menupull()
dc_menuaccel()
Process a menu Accelerator key
Syntax:
DC_MenuAccel ( < aAccelKeys > ) - > lStatus
Arguments:
< aAccelKeys > is a multi-dimensional array of Accelerator
key data. There is one sub-array for each accelerator key.
This sub-array has the following structure:
Element Type Description
------- ----- ----------------------------------------
[1] N Inkey() value of Accelerator key
[2] B Code block to evaluate. Pass as a NIL
if NONE.
[3] N Numeric value to post as the value
returned by DC_MENURETURN() if the
accelerator key is hit.
Returns:
A logical value.
Description:
DC_MENUACCEL() is used to process an array of Accelerator
key information. This array is created by DC_MENUCOMPILE()
at the time that a Top-Bar/Pull-Down menu system is compiled
into an array for later passing to DC_MENUMAIN(). In a
standard loop where a key is pressed, this function is
called to test whether or not the key pressed is an
accelerator key.
(1) If it IS a valid key, then the data in the array is
used to evaluate the code block and post a return value equal
to the values in the menu array. After evaluating the code
block and/or posting the return value, DC_MENUACCEL() will
return a .TRUE.
(2) If it IS NOT a valid key, then DC_MENUACCEL() will return
a .FALSE.
Examples:
local aMenus, aSubMenus, aMainMenu, aMouseKeys, nMenu,;
aAccelKeys
aMenus := { 'File','Edit','View','Run' }
aSubMenus := { { 'Open File <Alt-N>',;
'Close File <Alt-C>',;
'e~Xit to Dos <Alt-X>' },;
{ 'Edit File <Alt-D>',;
'Save File <Alt-S>' },;
{ 'View File <Alt-Z>',;
'Print File <Alt-P>' },;
{ 'Run Program <Alt-O>',;
'DOS ~Shell <Alt-L>'},;
nil,nil,nil,nil,;
{ 101, 102, 103, 104, 105, ;
106, 107, 108, 109 } }
aAccelKeys := { { K_ALT_N,,101 },;
{ K_ALT_C,,102 },;
{ K_ALT_X,,103 },;
{ K_ALT_D,,104 },;
{ K_ALT_S,,105 },;
{ K_ALT_Z,,106 },;
{ K_ALT_P,,107 },;
{ K_ALT_O,,108 },;
{ K_ALT_L,,109 } }
aMainMenu := { 1, 3, 'bg+/rb,n/bg,w+/bg,w+/r,n+/bg', 'BAD', ;
.t., 'FO', { aMenus }, { aSubMenus }, 'X' }
/* -- Paint the menu bar and get the mouse coordinates -- */
DC_MENUMAIN( aMainMenu,.t.,@aMouseKeys )
do while .t.
nInkey := DC_Inkey(0) /* -- Get a key -- */
cCode := UPPER(CHR(nInkey))
do case
case nInkey = K_ESC
exit
/* -- mouse click -- */
case nInkey <= -101 .AND. !Empty(DC_MouseKeys(aMouseKeys))
/* -- Menu key was hit -- */
case cCode $ 'FEVR' .OR. DC_MENUACCEL( aAccelKeys, nInkey )
IF DC_MenuReturn() = 0 /* -- Not an Accelerator -- */
DC_MENUMAIN( aMainMenu,,,cCode )
ENDIF
nMenu := DC_MenuReturn(0)
do case
case nMenu = 101
openfile()
case nMenu = 102
closefile()
case nMenu = 103
__Quit()
case nMenu = 104
editfile()
case nMenu = 105
savefile()
case nMenu = 106
viewfile()
case nMenu = 107
printfile()
case nMenu = 108
runexe()
case nMenu = 109
rundos()
endcase
endcase
enddo
return
Source/Library:
_DCMENU2.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_menumain()
dc_menucompile()
dc_menuarray()
Create an array of mouse buttons for a single-line menu bar
Syntax:
DC_MenuArray ( < nStartRow >, ;
< nStartCol >, ;
< nEndCol >, ;
[< cNormColor >], ;
[< cHiliteColor >], ;
< aItems >, ;
< lDisplay >, ;
[@< cMenuBar >] ) - > aMouseButtons
Arguments:
< nStartRow > is the display row to paint the menu bar and
mouse buttons.
< nStartCol > is the start display column to paint the menu bar
and mouse buttons.
< nEndCol > is the end display column.
< cNormColor > is the normal color of the menu bar.
< cHiliteColor > is the highlight color of menu items hot key
letter for each item.
< aItems > is an array of menu items to display
< lDisplay > if .true. (default) will paint the menu bar on the
screen. If .false., then the items menu bar will not be
displayed but the mouse-button array and menu string will still
be returned.
@< cMenuBar > is the name of the variable to store the string value
of the menu.
Description:
DC_MENUARRAY() is used to make single line "moused" menus
easier to create and maintain. This function will return an
array of mouse buttons to later pass to DC_MOUSEKEY() and a menu
string to pass to DC_DBCHOICE().
Examples:
local aMenus, cMenuBar, aMouseKeys
aMenus := { ;
'File ',;
'Edit ',;
'View ',;
'Search ',;
'Print ',;
'Maint }
aMouseKeys := ;
DC_MENUARRAY( 0, 0, 79, , , aMenus, .f., @cMenuBar )
Source/Library:
_DCMENUB.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_menubar()
dc_menumain()
dc_menubar()
Paint a menu bar with key characters highlighted
Syntax:
DC_MenuBar( < nRow >, ;
< nCol >, ;
< cColors >, ;
< cBarText >, ;
[< lHide >] ) - > cMenuBar
Arguments:
< nRow > and < nCol > are the screen coordinates to display
the
menu bar.
< cColors > is a Normal and Highlight color string, separated by
a comma.
< cBarText > is the text which is to appear in the menu.
Separate each menu item in Menu_String with a space. By
default, the first letter of each word in < cBarText > will be in
the Highlight color unless another letter in that word is
preceded by a tilde (~). Any letter in a word preceded by a
tilde will be highlighted instead of the first letter.
< lHide > if .TRUE. will hide the menubar from being displayed
on the screen and will only return the screen contents. If
.FALSE. (default), then the menu bar will be displayed.
Returns:
A character string which contains the screen contents of
the menubar for later restoring the screen with RESTSCREEN().
Description:
DC_MENUBAR() is used to paint a menu bar with highlighted "hot
keys".
Examples:
DC_MENUBAR( 24, 0, "b/w,w+/w", " One Two T~hree Four F~ive " )
Source/Library:
_DCMENUB.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_menuarray()
dc_menumain()
dc_menucompile()
Compile a Menu Array
Syntax:
dc_menucompile ( < aPreMenu >, ;
[< cCompileKeys >],;
[< cAccessKeys >],;
[@< aAccelKeys >] ) - > aMenuRun
Arguments:
< aPreMenu > is a menu array that conforms to the
specifications of the array returned by DC_MENUEDIT().
< cCompileKeys > is an optional list of keys (5-digit character
strings separated by commas). Compile Keys are used for
conditional compiling of menu items. Conditional compiling
allows for optionally excluding items from a menu in which the
COMPILE KEY does not match one of the keys in the list.
< cCompileKeys > supports wildcards. This allows for designing
of menus that are similar but may have minor changes. Conditional
compiling reduces redundancy and keeps the DCMENU.DBF dictionary
from growing too large. See DC_MENUEDIT() for more information.
If this parameter is not used, then all menu items will be compiled
and included in the menu, otherwise, only the items in which
the COMPILE KEY EMPTY or matches one of the keys in the
list will be compiled.
< cAccessKeys > is an optional list of keys (5-digit character
strings separated by commas). Access Keys are used for
conditional compiling of menu items based on a list of keys
assigned to a Logged-On user. Conditional compiling allows for
optionally excluding items from a menu in which the ACCESS key
does not match one of the keys in the list. < cAccessKeys > supports
wildcards. This allows for designing of menus allow access to
menu items based on assigned user keys. See DC_MENUEDIT() for
more information. If this parameter is not used, then all menu
items will be compiled and included in the menu, otherwise, only
the items in which the ACCESS KEY is EMPTY or matches one of the
keys in the list will be compiled.
@< aAccelKeys > is a reference to store an array of Accelerator
key data. Accelerator keys are hot-keys that perform the
same function as selecting the item from the menu, except
that the menu is not painted. This array is passed to
DC_MENUACCEL() along with the value of the key that was hit.
See DC_MENUACCEL() for a specification of this array.
< aPreMenu > is a menu array that conforms to the
specifications of the array returned by DC_MENUEDIT().
< cCompileKeys > is an optional list of keys (5-digit character
strings separated by commas). Compile Keys are used for
conditional compiling of menu items. Conditional compiling
allows for optionally excluding items from a menu in which the
COMPILE KEY does not match one of the keys in the list.
< cCompileKeys > supports wildcards. This allows for designing
of menus that are similar but may have minor changes. Conditional
compiling reduces redundancy and keeps the DCMENU.DBF dictionary
from growing too large. See DC_MENUEDIT() for more information.
If this parameter is not used, then all menu items will be compiled
and included in the menu, otherwise, only the items in which
the COMPILE KEY EMPTY or matches one of the keys in the
list will be compiled.
< cAccessKeys > is an optional list of keys (5-digit character
strings separated by commas). Access Keys are used for
conditional compiling of menu items based on a list of keys
assigned to a Logged-On user. Conditional compiling allows for
optionally excluding items from a menu in which the ACCESS key
does not match one of the keys in the list. < cAccessKeys > supports
wildcards. This allows for designing of menus allow access to
menu items based on assigned user keys. See DC_MENUEDIT() for
more information. If this parameter is not used, then all menu
items will be compiled and included in the menu, otherwise, only
the items in which the ACCESS KEY is EMPTY or matches one of the
keys in the list will be compiled.
@< aAccelKeys > is a reference to store an array of Accelerator
key data. Accelerator keys are hot-keys that perform the
same function as selecting the item from the menu, except
that the menu is not painted. This array is passed to
DC_MENUACCEL() along with the value of the key that was hit.
See DC_MENUACCEL() for a specification of this array.
Returns:
A multi-dimensional array containing all information about a
menu including prompts, sub-menus, message-text, help-codes,
code-blocks, access codes, and return values.
If the menu type is a Top-Bar Menu (Type A,B,C) or a TreeView
menu then the array returned conforms to the specification for
the array passed to DC_MENUMAIN(), DC_MENUOSYS() or
DC_MENUTREE().
If the menu type is a Pull-Down Menu (Type P) then the
array returned conforms to the specification for the array
passed to DC_MENUPULL().
Description:
DC_MENUCOMPILE() is used to convert a menu array that was
created by DC_MENUEDIT() or retrieved by DC_MENULOAD().
A menu that is stored as an array file or is retreived from
the DCMENU.DBF menu-dictionary cannot contain code blocks,
therefore they it must contain character-string equivalents
of code-blocks. This type of menu-array is formatted in a way
that provides for easy browsing and storage/retreival however,
it is not formatted in a way that can be passed to the menu
execution programs - DC_MENURUN(), DC_MENUMAIN(), DC_MENUPULL()
or DC_MENUOSYS() therefore it must be converted or "compiled"
into an array that can be used by these menu functions.
This function also supports conditional compiling based on
sets of keys or code blocks.
Examples:
/* --- Load menu from menu-dictionary --- */
aPreMenu := DC_MenuLoad( 'MAINMENU' )
/* --- Compile menu --- */
aMenuMain := DC_MENUCOMPILE( aPreMenu )
/* --- Run Menu --- */
cMenuString := DC_MenuRun( aMenuMain )
/* -- Compile menu and include Conditional Items -- */
aMenuMain := DC_MENUCOMPILE( aPreMenu, 'A**,B2*', ;
DC_UserInfo(USER_KEYS) )
Source/Library:
_DCMENUE.PRG
See Also:
dc_menurun()
dc_menuload()
dc_menuedit()
A Complex Pull-Down Menu Editor
Syntax:
DC_MenuEdit( [< acMenu >], ;
[< lCreate >] ) - > aMenu
Arguments:
< acMenu > is the name of the menu or the menu contents. If
< acMenu > is a character string, it is a name of up to eight (8)
digits. If < acMenu > is an array, it must conform to the
specifications of a menu array defined in the RETURNS section.
If a menu name is passed then the DCMENU.DBF menu dictionary
database will be searched and all menu items that match the
menu name be loaded into an array for editing. If a NIL is
passed, then a pick-list of all menus stored in the DCMENU.DBF
database will be displayed. If none is chosen, then it will
be assumed that you wish to create a new menu.
< lCreate > if .TRUE. will create a new menu.
Returns:
A multi-dimensional array consisting of 2 sub-arrays.
This array is formatted in such a way to ease the
process of browsing, storage and retreival. Since
code-blocks cannot be saved and restored a character
string equivalent is included in this array for compiling
by the DC_MENUCOMPILE() function.
Note : *T designates Text Mode Only
*G designates Gui Mode Only
Element [1] Contains all global information about the menu:
Element Type Contents
------- ---- -------------------------------------
[1] C Name of the menu - Up to 8 digits
[2] C A description of this menu
[3] C Type of menu - 4 characters
Char 1 : A - Bar Menu (standard)
B - Bar Menu (boxed) - *T
C - Bar Menu (underlined) - *T
P - PullDown Menu
T - Tree-Style Menu - *G
Char 2 : A - Size bar to Item Width - *T
B - Size bar to Screen Width - *T
Char 3 : U - Attached menus are Pull-Up - *T
D - Attached menus are Pull-Down - *T
Char 4 : M - MainLevel Heirarchy - *T
S - SubLevel Heirarchy - *T
[4] N Spaces between items on top menu bar -*T
[5] C A string of characters designating keys
which will exit the menu
[6] N Start Top-Bar display row if Bar menu or - *T
start display row if Pull-Down menu
[7] N Start Top-Bar display column if Bar menu or - *T
start display column if Pull-Down menu
[8] C A string containing menu colors separated - *T
by commas. See DC_MENUMAIN() for specs.
[9] L .T. - Sticky Menus (menu will stay on screen - *T
when code-block evaluated. Will return
to menu after evaluating code-block.
.F. - Normal Menus (screen will be restored - *T
before evaluating code-block.
[10] L Re-Display menu after evaluating code-block - *T
[11] N Message Display Option: - *T
0 - 1 line of the display
1 - A boxed area of the display
2 - A box under each pull-down
[12] N Start Row (Message Display Option 1) or - *T
Box Height (Message Display Option 2) - *T
[13] N Start Column (Message Display Option 1) or - *T
Box Width (Message Display Option 2)
[14] N End Row (Message Display Option 1 only) - *T
[15] N End Column (Message Display Option 2 only) - *T
[16] A An optional array of Mouse Keys (see - *T
DC_MOUSEKEY() for specs.
Element [2] contains all the items in the menu:
Each Item in Element [2] is a sub-array of 12 elements:
Element Type Contents
------- ---- ----------------------------------------
[1] C Level - This is a character string that
establishes the heirarchal level of the
menu or sub-menu.
[2] C The title of the menu item. Enter a
tilde <þ~þ> or ampersand <þ&þ> character in
front of the hot-key character to be high-
lighted or underlined.
[3] C A character-string representation of any
code-block to be compiled and evaluated.
The menu item will be "grayed" and
unselectable if the evaluated code block
returns a .FALSE. The menu item will be
selectable if this element is left blank
or the evaluated code block returns a .TRUE.
[4] B The code-block that has been compiled from
element 3.
[5] C A character string containing the message
or long description to be displayed in the
message area of the selected menu item.
[6] <þreservedþ>
[7] C A character-string representation of any
code-block to be compiled and evaluated.
The code block will be evaluated when the
menu item is selected. If this element is
left blank, then no code block will be
executed and the selected menu(s) will be
returned as a string.
[8] B The code-block that has been compiled from
element 7.
[9] C A string that is passed to the HELP procedure
as the fourth (4th) parameter when the F1
key is pressed. This can be used as a help
code to pop-up additional help for this
menu item. - *T
[10] C Access key for this menu. Access key list
assigned to logged on user() must contain this
key or a wildcard to access this menu. If
element is left blank then menu item is
accessible by everyone.
[11] N Return value to save to a static value when
this item is selected. See DC_MenuReturn().
[12] C Compile key for this menu. Compile key list
passed to DC_MENUCOMPILE() must contain this
key or a wildcard to compile this item. If
element is left blank then the menu item will
be compiled regardless of the key list that is
passed.
Description:
DC_MENUEDIT() is a menu-designer system that will create complex
pull-down menus. Menus are designed by entering information in
a browse-style window that displays menu items and sub-menus in
an easy-to-read "indented" format. The designed menu can be saved
to an array, an array file, the data-dictionary, or to source-code
which can be compiled and run by your application.
DC_MENUEDIT() creates menus that are passed as an array to the
DC_MENUMAIN() (Text Mode Readero) or DC_MENUOSYS() (Gui Mode Reader)
functions for execution. During the menu design process, the
menu can be executed in a WYSIWIG fashion to provide instant
feedback that the menu will function as it has been designed.
DC_MENUEDIT() supports all the features of DC_MENUMAIN() and
DC_MENUOSYS() including sub-sub-menus, automatic mouse support,
message boxes, help-codes, accelerator keys, code-blocks, and access
keys. In addition, DC_MENUEDIT() supports conditional compiling of
menu items to exclude key items at run-time based on a key list that
is passed to DC_MENURUN() or DC_MENUCOMPILE() or based on a
code block.
Examples:
/* -- Edit the Main Menu -- */
aPreMenu := DC_MENUEDIT( 'MAINMENU' )
/* -- Compile the menu -- */
aMenuMain := DC_MenuCompile( aPreMenu )
/* -- Install the menu -- */
DC_MenuOSys( aMenuMain, oDialog )
Source/Library:
_DCMENUE.PRG
See Also:
dc_menurun()
dc_menuload()
dc_menuload()
Load a menu from the Menu Dictionary
Syntax:
DC_MenuLoad ( [< cMenuName >], ;
[< cMode >], ;
[< lCache >], ;
[< cType >], ;
[< cTitle >], ;
[< lImport >] ) - > aMenu
Arguments:
< aPreMenu > is a menu array that conforms to the specifications of the
array returned by DC_MENUEDIT().
< cCompileKeys > is an optional list of keys (5-digit character
strings separated by commas). Compile Keys are used for
conditional compiling of menu items. Conditional compiling
allows for optionally excluding items from a menu in which the
COMPILE KEY does not match one of the keys in the list.
< cCompileKeys > supports wildcards. This allows for designing
of menus that are similar but may have minor changes. Conditional
compiling reduces redundancy and keeps the DCMENU.DBF dictionary
from growing too large. See DC_MENUEDIT() for more information.
If this parameter is not used, then all menu items will be compiled
and included in the menu, otherwise, only the items in which
the COMPILE KEY EMPTY or matches one of the keys in the
list will be compiled.
< cAccessKeys > is an optional list of keys (5-digit character
strings separated by commas). Access Keys are used for
conditional compiling of menu items based on a list of keys
assigned to a Logged-On user. Conditional compiling allows for
optionally excluding items from a menu in which the ACCESS key
does not match one of the keys in the list. < cAccessKeys > supports
wildcards. This allows for designing of menus allow access to
menu items based on assigned user keys. See DC_MENUEDIT() for
more information. If this parameter is not used, then all menu
items will be compiled and included in the menu, otherwise, only
the items in which the ACCESS KEY is EMPTY or matches one of the
keys in the list will be compiled.
@< aAccelKeys > is a reference to store an array of Accelerator
key data. Accelerator keys are hot-keys that perform the
same function as selecting the item from the menu, except
that the menu is not painted. This array is passed to
DC_MENUACCEL() along with the value of the key that was hit.
See DC_MENUACCEL() for a specification of this array.
< aPreMenu > is a menu array that conforms to the
specifications of the array returned by DC_MENUEDIT().
< cCompileKeys > is an optional list of keys (5-digit character
strings separated by commas). Compile Keys are used for
conditional compiling of menu items. Conditional compiling
allows for optionally excluding items from a menu in which the
COMPILE KEY does not match one of the keys in the list.
< cCompileKeys > supports wildcards. This allows for designing
of menus that are similar but may have minor changes. Conditional
compiling reduces redundancy and keeps the DCMENU.DBF dictionary
from growing too large. See DC_MENUEDIT() for more information.
If this parameter is not used, then all menu items will be compiled
and included in the menu, otherwise, only the items in which
the COMPILE KEY EMPTY or matches one of the keys in the
list will be compiled.
< cAccessKeys > is an optional list of keys (5-digit character
strings separated by commas). Access Keys are used for
conditional compiling of menu items based on a list of keys
assigned to a Logged-On user. Conditional compiling allows for
optionally excluding items from a menu in which the ACCESS key
does not match one of the keys in the list. < cAccessKeys > supports
wildcards. This allows for designing of menus allow access to
menu items based on assigned user keys. See DC_MENUEDIT() for
more information. If this parameter is not used, then all menu
items will be compiled and included in the menu, otherwise, only
the items in which the ACCESS KEY is EMPTY or matches one of the
keys in the list will be compiled.
@< aAccelKeys > is a reference to store an array of Accelerator
key data. Accelerator keys are hot-keys that perform the
same function as selecting the item from the menu, except
that the menu is not painted. This array is passed to
DC_MENUACCEL() along with the value of the key that was hit.
See DC_MENUACCEL() for a specification of this array.
< cMenuName > is the name of the menu. This is a name of up to
eight (8) digits. If a menu name is passed then the DCMENU.DBF
database will be searched and all menu items that match the
menu name be loaded into an array. If no name is passed, then
a pick-list of all menus stored in the DCMENU.DBF database will
be displayed.
< cMode > is a single character designating the source:
A - From an Array File. If this option is chosen then
the file named < cMenuName >.DCM will be used to load the
array (if it exists).
F - From a Function. If this option is chosen then the
function < cMenuName >_M() will be called to get the
array (if it exists).
D - From the DCMENU.DBF dictionary. A Menu Configuration
with the Tag Name < cMenuName > will be loaded into the
array (if it exists).
NONE - If no parameter is passed, then the array will be
loaded first from the function < cMenuName >_M(), if it
exists, and secondly from the file < cMenuName >.DCM if it
exists, and thirdly from the DCMENU.DBF dictionary.
< lCache > if .TRUE. (default) will save the menu to a static
cache so the next time it is requested it will be reloaded
from the cache for faster speed. If .FALSE. or if the
DC_MEMCACHE() setting is 0, then it will not be saved to the
static array.
< cType > is a character string designating the types of menus
to display in the pick-list of menus that will be displayed
(if no < cMenuName > is passed, or if the menu does not exist).
The default it all types (ABCPT).
< cTitle > is the title to display on the pick-list of menus
to display (if no < cMenuName > is passed, or if the menu does
not exist). The default is "Pick a Menu to Load".
< lImport > if .TRUE. will attempt to load the menu from a
dictionary file named DXMENU.DBF rather than the standard
dictionary named DCMENU.DBF.
Returns:
A multi-dimensional array that conforms to the
specification of the array returned by DC_MENUEDIT().
Description:
DC_MENULOAD() is used to retreive a menu from the
Menu-dictionary database. Menus are stored in the DCMENU.DBF
database via the DC_MENUEDIT() function or DC_MENUSAVE()
function.
Notes:
The DCMENU.DBF file is the data-dictionary database that
contains all menus. If this file does not exist in your
default directory or path then it will be created.
A Menu may also be restored from an ARRAY file by using the
DC_ARESTORE() function.
Example:
aMenu := DC_MenuLoad( "MAINMENU" )
DC_ASave( aMenu, "MAINMENU.DCM" )
aMenu := DC_ARestore( "MAINMENU.DCM" )
Examples:
/* -- Load the Main Menu -- */
aPreMenu := DC_MENULOAD( 'MAINMENU' )
/* -- Compile the menu -- */
aMenuMain := DC_MenuCompile( aPreMenu )
/* -- Install the menu -- */
DC_MenuOSys( aMenuMain, oDialog )
Source/Library:
_DCMENUE.PRG
See Also:
dc_menurun()
dc_menuedit()
dc_menulock()
Lock all Menu items
Syntax:
DC_MenuLock ( [< lMenuLock >] ) - > lMenuLock
Arguments:
< lMenuLock > if .TRUE. will lock all menu items. .FALSE. (default)
will unlock all menu items unless a lock has been placed on the
individual item.
Returns:
A logical value containing the previous setting.
Description:
DC_MENULOCK() modifies the behavior of the menu locking system.
The default is .FALSE. In this "normal" mode, all menu items are
accessible by all users if a menu item is not assigned a lock in
the menu editor. If <þlModeþ> is .TRUE., then NO menu item will be
accessible unless it is assigned a lock or an asterisk (*) to make
it accessible by everyone.
Notes:
The DCMENU.DBF file is the data-dictionary database that
contains all menus. If this file does not exist in your
default directory or path then it will be created.
A Menu may also be restored from an ARRAY file by using the
DC_ARESTORE() function.
Example:
aMenu := DC_MenuLoad( "MAINMENU" )
DC_ASave( aMenu, "MAINMENU.DCM" )
aMenu := DC_ARestore( "MAINMENU.DCM" )
Examples:
/* -- Lock all Menus -- */
DC_MENULOCK(.t.)
Source/Library:
_DCMENU2.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_lockmaint()
dc_menumain()
An "integrated" menu system with a bar and pull-downs
Syntax:
DC_MenuMain ( < aMenu >, ;
[< lMenuBar >], ;
[@< aMouseKeys >] ) - > cMenu
Arguments:
Parameters may be passed separately or in an array. If
the first element is a Numeric value, then it is assumed
that all data will be passed as separate parameters and
the two optional parameters ( < lMenuBar > and < aMouseKeys >
)
are not supported. This is provided for compatability with
previous versions of dCLIP so existing applications will
run without requiring source-code modifications. It is
recmmended that all parameters be passed in an array
< aMenu > with the following structure:
---------------------------------------------------------
Specification of < aMenu >:
Element Type Description (see below)
------- ---- -----------------------------------
[1] N < nRow >
[2] N < nCol >
[3] C < cMenuColor >
[4] C < cType >
[5] L < lSelectBar >
[6] C < cStart >
[7] A < aMenus >
[8] A < aSubMenus >
[9] C < cExitKeys >
[10] L < lReturnVal >
[11] N < nSubMenu >
[12] N < nSubSubMenu >
[13] A < aMouseKeys >
[14] L < lSticky >
[15] A < aMsgOptions >
[16] L < lReMenu >
[17] C < cHeirArchy >
< nRow > is the start display row
< nCol > is the start display column
< cMenuColor > is a single string of 5 colors (separated by
commas) to be used for the frame, menu prompts, hi-lited
letters, select bar, and "grayed" items respectively.
< cType > is a 3-character string defining the type of menu bar:
Char 1: A - no box around menu bar (default)
B - Single line box around menu bar
C - Single line below menu bar
Double line above menu bar
Char 2: A - Size box to size of menu items (default)
B - Size box to full screen width
Char 3: D - Pull-down menus
U - Pop-up menus
< lSelectBar > if .TRUE. (default) will make the menu resemble a
MENU TO, with a select bar. If you do not want a select bar,
and just want the items to be chosen by pressing the hot-key
letter only, set this to .FALSE.
< cStart > is a 2-character string defining which menu item to
pre-select. The first character is the "high-lighted"
character of the main menu. The second character is the
"high-lighted" character of the sub-menu.
< aMenus) is a 2-dimensional array of top-bar menu prompts and
optional code blocks. The first letter of each menu item will
be hilited and will be designated as that menu item's "hot-key".
If a different hot-key letter is desired for a item, precede
the desired hot-key letter with a tilde (~). If the item is a
"gray-scale" item (i.e. it displays only but is not
selectable), it must be preceded by an "*" character. If the
secondary array of code blocks is passed there must be one code
block for each menu item in sub array 1. If a code block array
is passed then the code block will be evaluated before
returning.
< aSubMenus > is an array of two sub-arrays. There must
be one sub-menu array for each < aMenu > prompt. The first
sub-array consists of up to 6 parallel arrays:
[1] - Prompts
[2] - Code-Blocks
[3] - Messages
[4] - Help Codes
[5] - Access Codes
[6] - Return Values
These arrays must conform to the specification for < aPrompts >
in DC_MENUPULL(). The second (parallel) sub-array is an optional
array of code-blocks which conforms to the specification for
code blocks < aBlocks > in DC_MENUPULL(). Nesting sub-sub-menus
from any one of the sub-menus is accomplished in the same
manner as described in the documentation for DC_MENUPULL().
< cExitKeys > is a string containing the character value of any
keys that will exit the menu and return the pressed key value.
The ESCape key always exits. If any "exit key" is pressed that
is not a menu item "hot key", then the key character value will
be returned.
< lReturnVal > if .FALSE. (default) will return the hot-key
character of the selected menu item. If .TRUE., the CHR()
value of the menu choice will be returned. For example, if
the 4th menu item is selected, then CHR(4) will be returned.
< nSubMenu > is the number of Pull down menu to select as the
default.
< nSubSubMenu > is the number of the SubMenu to select as the
default >
< aMouseKeys > is a multi-dimensional array of mouse-buttons
to active outside the menu area. See DC_MOUSEKEY() for
specifications.
< lSticky > is used to modify the behavior of DC_MENUMAIN() only
when a selected item has an associated code-block. If
< lSticky > is true, the code-block will be evaluated while the
menu is still displayed on the screen. If .FALSE. (default),
then the screen will be restored followed by the evaluation of
the code-block.
< aMsgOptions > is an array of options on how to display the
message for the selected prompt.
Element Type Description
------- ----- -----------------------------------------------
[1] N Display Row if TYPE 0
[2] N Display Column if TYPE 0 (-1 to center message)
[3] N Message TYPE (0-Line, 1-Box, 2-Add to Pull-Down
[4] N Start Row if TYPE 0,1 or Height if TYPE 2
[5] N Start Column if TYPE 0,1 (-1 to center message)
or Width if TYPE 2
[6] N End Row if TYPE 1
[7] N End Column if TYPE 1
< lReMenu > is used to re-paint the menu after evaluating the
code-block when a menu item is selected. If .FALSE. and if
< lSticky > is not .TRUE. then the menu will be exited after
the code-block is evaluated. Use this parameter in place of
< lSticky > to restore the screen before evaluating the code
block and then to repaint the menu after returning from the
code block.
< cHeirArchy > is a single character designating the heirarchal
characteristics of the menu.
------------------------------------------------------------
< lPaintBar > if .TRUE. will only paint the bar items on the
screen and then return. If .FALSE. (default), then the
menu will be executed.
< aMouseKeys > is a reference to store an array of mouse keys
that match the items on the bar menu. This parameter is
used in conjunction with < lPaintBar > as a .TRUE. value to
paint the menu-bar, store the coordinates to an array and
then use that array to determine if the mouse was clicked
on the menu bar area.
Returns:
A character string with the "hot-key" value of the main menu
and all sub-menus selected. For example, if the "A" key was
pressed to select an item in a sub-sub-menu that was selected
from a sub-menu with the 'G' key that was selected from the
top-bar menu with the "F" key, then "FGA" will be returned.
Description:
DC_MENUMAIN() is an "integrated", moused menu-system that
provides a set of pull-down or pop-up sub-menus from a main
menu.
Pull-down menus may be "nested" to as many levels as
desired to provide sub-menus and sub-sub-menus.
A "main menu" is displayed with a set of prompts. When
an item is selected from the main menu, the sub-menu will be
displayed with it's set of prompts. Items in sub-menus may
have sub-sub-menus. Each sub-sub-menu will be displayed to
the immediate right of the sub-menu from which it was
invoked. If there is no room on the right side of the
screen the sub-sub-menu will be displayed on the left side.
The LEFT mouse button or keyboard arrow keys are used to
navigate thru the menus. The ENTER key, RIGHT mouse button,
or Double-Click of the left button are used to make the
selection. If DC_INKEYWIN() is activated, then a menu
item is selected when the left mouse button is released
(similar to Windows).
If the mouse is clicked outside any active menu area the
display will be restored and DC_MENUMAIN() will return a null
"" string.
Sub-Arrays of Top-Bar Prompts, Sub-Menus, Code Blocks,
Enabler-Blocks, Help-Messages and Help-Codes are included in
the array that is passed to DC_MENUMAIN().
If a sub-array of Help-Messages is passed, then a more
descriptive message about the prompt can be displayed (based
on options) in a fixed window area on the screen or in a
window that connects to the bottom of each pull-down menu.
If a sub-array of Help-Codes is passed, then a context-
specific help screen in the DCHELP.DBF database will displayed
when the F1 key is pressed or the mouse is clicked in the
help-message area.
If a sub-array of Return-Values is passed, then the value of
the element associated with the selected menu item will be
posted to a STATIC variable which can be read with the
DC_MENURETURN() function.
If a FUNCTION KEY was pressed that was not previously set to
call a code-block with SETKEY(), then pressing that function
key will cause the value of the key (i.e. -10) to be saved
to the static variable to be returned by DC_MENURETURN().
Notes:
The source-code required to generate a complex pull-down
menu can be very complicated especially if the menu
needs to support multiple-level pull-downs, message boxes,
code-blocks, and help codes, therefore it is recommended
that you use the menu-designer, DC_MENUEDIT() or
MENU EDIT. This design tool will create and save your menus
in the data-dictionary, an array file or source code.
Examples:
-- Example 1 --
/* This example demonstrates using DC_MENUMAIN() to return a
code letter based on a user menu selection */
local aMenus, aSubMenus, cMenuCode
aMenus := { 'File','Edit','View','Run' }
aSubMenus := { { 'Open File','Close File','e~Xit to Dos' },;
{ 'Edit File','Save File' },;
{ 'View File','Print File' },;
{ 'Run Program','DOS ~Shell'} }
cMenuCode := ;
DC_MENUMAIN( { 1, 3, 'bg+/rb,n/bg,w+/bg,w+/r,n+/bg', 'BAD', ;
.t., 'FO', { aMenus }, { aSubMenus }, 'X' } )
do case
case cMenuCode = 'FX' .OR. lastkey()=K_ESC
quit
case cMenuCode = 'FO'
openfile()
case cMenuCode = 'FC'
closefile()
case cMenuCode = 'EE'
editfile()
case cMenuCode = 'ES'
savefile()
case cMenuCode = 'VS'
viewfile()
case cMenuCode = 'VP'
printfile()
case cMenuCode = 'RR'
runexe()
case cMenuCode = 'RS'
rundos()
endcase
return
-- Example 2 --
/* This example demonstrates using DC_MENUMAIN() to execute a
code block based on a user menu selection */
local aMenus, aSubMenus, aSubBlocks
aMenus := { 'File','Edit','View','Run' }
aSubMenus := { { 'Open File','Close File','e~Xit to Dos' },;
{ 'Edit File','Save File' },;
{ 'View File','Print File' },;
{ 'Run Program','DOS ~Shell'} }
aSubBlocks := { { {||openfile()}, {||closefile()}, ;
{ ||__quit()} },;
{ {||editfile()}, {||savefile()} },;
{ {||viewfile()}, {||printfile()} },;
{ {||runexe()}, {||rundos()} } }
do while .t.
DC_MENUMAIN( { 1, 3, 'bg+/rb,n/bg,w+/bg,w+/r,n+/bg', 'CAD', ;
.t., 'FO', ;
{ aMenus }, { aSubMenus, aSubBlocks }, 'X' } )
enddo
return
-- Example 3 --
/* This example demonstrates loading a menu from the Menu
Dictionary file and passing it to DC_MENUMAIN() for
execution */
local aPreMenu, aMenuMain, cMenuCodes
aPreMenu := DC_MenuLoad( 'MAINMENU' )
aMainMenu := DC_MenuCompile( aPreMenu )
cMenuCodes := DC_MENUMAIN( aMainMenu )
-- Example 4 --
/* See the _DCBROW3.PRG source code file for an example of
building a complex menu using source-code */
-- Example 5 --
/* This examples demonstrates using DC_MENUMAIN() in a
loop, where the menu is attached to the top of a window */
local aMenus, aSubMenus, cMenuCode, aMainMenu, aMouseKeys
aMenus := { 'File','Edit','View','Run' }
aSubMenus := { { 'Open File','Close File','e~Xit to Dos' },;
{ 'Edit File','Save File' },;
{ 'View File','Print File' },;
{ 'Run Program','DOS ~Shell'} }
aMainMenu := { 1, 3, 'bg+/rb,n/bg,w+/bg,w+/r,n+/bg', 'BAD', ;
.t., 'FO', { aMenus }, { aSubMenus }, 'X' }
/* -- Paint the menu bar and get the mouse coordinates -- */
DC_MENUMAIN( aMainMenu,.t.,@aMouseKeys )
do while .t.
nInkey := DC_Inkey(0) /* -- Get a key -- */
cCode := UPPER(CHR(nInkey))
do case
case nInkey = K_ESC
exit
/* -- mouse click -- */
case nInkey <= -101 .AND. !Empty(DC_MouseKeys(aMouseKeys))
/* -- Menu key was hit -- */
case cCode $ 'FEVR'
cMenuCode := DC_MENUMAIN( aMainMenu,,,cCode )
do case
case cMenuCode = 'FO'
openfile()
case cMenuCode = 'FC'
closefile()
case cMenuCode = 'EE'
editfile()
case cMenuCode = 'ES'
savefile()
case cMenuCode = 'VS'
viewfile()
case cMenuCode = 'VP'
printfile()
case cMenuCode = 'RR'
runexe()
case cMenuCode = 'RS'
rundos()
endcase
endcase
enddo
-- Example 6 --
/* -- See DC_MENUACCEL() example for an example of using
DC_MENUMAIN() with accelerator keys and an array of
numeric return values -- */
Source/Library:
_DCMENU2.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_menupull()
dc_menuedit()
dc_menurun()
dc_menuownerdrawdisable()
Disable owner draw menus throughout application
Syntax:
DC_MenuOwnerDrawDisable( [< lDisable >] ) - > lOldDisable
Arguments:
< lDisable > if .TRUE. will disable owner draw on menus. The
default is .FALSE.
Description:
DC_MenuOwnerDrawDisable() is a Get-Set function that disables
the OWNERDRAW feature on all menus created with DCMENUBAR or
DCSUBMENU commands. It is needed when using the CodeJock
SkinFramework.
Source/Library:
_dcclass.prg, dclipx.dll
See Also:
DCMENUBAR
DCSUBMENU
dc_menuownerdrawset()
dc_menuownerdrawset()
Sets or resets the ownerdraw flag on menu items
Syntax:
DC_MenuOwnerDrawSet( < oMenu > , < lSet > ) - > nil
Arguments:
< oMenu > is a menu object created with the DCSUBMENU command or
the DC_XbpMenu() class.
< lSet > if .TRUE. will set the ownerdraw flag on to insure that
all items are drawn using ownerdraw, otherwise the flag will
be set off.
Description:
DC_MenuOwnerDrawSet() is used to walk through a menu tree and
set or reset the ownerdraw flag on each item.
This function is used to enable or disable ownerdraw and an
existing menu.
Source/Library:
_dcclass.prg, dclipx.dll
See Also:
dc_menuownerdrawdisable()
dc_menupick()
Pop up a Pick list of all menus in the Menu Dictionary
Syntax:
DC_MenuPick() - > cMenuName
Arguments:
None.
Returns:
A character string.
Description:
DC_MENUPICK() is used to pop-up a pick-list of all Menus
in the DCMENU.DBF Menu Dictionary File.
Examples:
/* This example demonstrates how to use DC_MENUPICK()
to pop-up a pick-list of Menus in a DCSAY..GET */
#include 'dcdialog.ch'
LOCAL cMenuName := SPACE(8)
@ 10,10 DCSAY 'Enter Menu Name ' GET cMenuName ;
POPUP {|c|DC_MenuPick()}
Source/Library:
_DCMENUE.PRG
See Also:
dc_menuload()
dc_menuedit()
dc_menupull()
A nested, moused pull-down menu-system
Syntax:
DC_MenuPull ( < aMenus > ) - > cCodes
Arguments:
< aMenus > is a multidimensional array of information about
the pull-down menu.
Element Type Description (See below)
------- ---- ----------------------------------
[1] N < nRow >
[2] N < nCol >
[3] C < cTitle >
[4] C < cColors >
[5] C < cType >
[6] L < lBar >
[7] L < lRetVal >
[8] C < cExitKey >
[9] L < lRestScreen >
[10] L < lShadow >
[11] L < lSticky >
[12] L < lReMenu >
[13] C < cHeirArchy >
[14] A < aMouseKeys >
[15] A < aMsgOptions >
[16] A < aRowCol >
[17] A < aPrompts >
[18] A < aPromptBlock >
[19] A < aEvalBlocks >
[20] A < aMessage >
[21] A < aHelp >
[22] A < aAccess >
[23] A < aReturns >
< nRow > is the upper-left row (for pull-downs), or lower-left
row (for pop-up menus).
< nCol > is the upper-left column (for pull-downs), or lower-left
column for pop-up menus).
< cTitle > is an Optional title to be displayed centered on the
top or bottom line of the box (depending on if it's a pull-down
or a pop-up box.) If no title is desired use a null string
("").
< cColors > is a single string of 5 colors (separated by
commas) to be used for the frame, menu items, hi-lited letters,
select bar, grayed items respectively. If no argument is
passed, then the dCLIP default colors will be used.
< cType) is a single character defining the type of menu:
A - Pull-down menu
B - Pop-up menu
C - Plain menu, no borders (default)
< lBar > if .TRUE. (default) will make the menu resemble a
MENU TO, with a select bar. If you do not want a select bar,
and just want the items to be chosen by pressing the hot-key
letter only, set this to .FALSE.
< lRetVal > if .FALSE. (default) will return the hot-key
character of the selected menu item. If .TRUE., the CHR()
value of the menu choice will be returned. For example, if
the 4th menu item is selected, then CHR(4) will be returned.
This parameter should also be set to .TRUE. if you are
passing code-blocks to be evaluated and want to return from
the menu after evaluating the code-block.
< cExitKey > is a string containing the character value of any
keys that will exit the menu and return the pressed key value.
The ESCape key always exits. If any "exit key" is pressed that
is not a menu item "hot key", then the key character value will
be returned.
< lRestScreen > if .TRUE. (default) will restore the previous
screen after exiting the menu. If .FALSE. the menu and
highlighted selection will remain on the screen.
< lShadow > if .TRUE. (default only if < cType > is "A") will
display a shadow on the menu.
< lSticky > is used to modify the behavior of DC_MENU_P() only
when a selected item has an associated code-block. If
< lSticky > is true, the code-block will be evaluated while the
menu is still displayed on the screen. If .FALSE., then the
screen will be restored (only if < lRestoreScreen > is .TRUE.)
followed by the evaluation of the code-block.
< lReMenu > is used to re-paint the menu after evaluating the
code-block when a menu item is selected. If .FALSE. and if
< lSticky > is not .TRUE. then the menu will be exited after
the code-block is evaluated. Use this parameter in place of
< lSticky > to restore the screen before evaluating the code
block and then to repaint the menu after returning from the
code block.
< cHeirArchy > is a single character designating the heirarchal
characteristics of the menu.
M - Main Level heirarchy. This kind of menu will be
executed at the same level as the calling menu rather
than calling it as a sub-menu. Use this option to
prevent the user from blowing up the call stack.
S - Sub Level heirarchy (Default). This kind of menu will
be called as a sub-level menu and will return to the
previously called menu.
< aMouseKeys > is a multi-dimensional array of mouse-buttons
to active outside the menu area. See DC_MOUSEKEY() for
specifications.
< aMsgOptions > is an optional array of options for determining
where and how the message will be displayed.
Element Type Description
------- ----- -----------------------------------------------
[1] N Display Row if TYPE 0
[2] N Display Column if TYPE 0 (-1 to center message)
[3] N Message TYPE (0-Line, 1-Box, 2-Add to Pull-Down
[4] N Start Row if TYPE 0,1 or Height if TYPE 2
[5] N Start Column if TYPE 0,1 (-1 to center message)
or Width if TYPE 2
[6] N End Row if TYPE 1
[7] N End Column if TYPE 1
< aRowCol > is an optional ragged array of Row/Column positions
for each item in < aPrompts >. If a Row/Column array is not
passed then the prompts will be placed vertically starting at
< nRow > and < nCol >.
< aPrompts > is an array of menu prompts to be displayed. The
first letter of each menu item will be hilited and will be
designated as that menu item's "hot-key". If a different
hot-key letter is desired for a item, precede the desired
hot-key letter with a tilde (~). If the item is a
"gray-scale" item (i.e. it displays only but is not
selectable), it must be preceded by an "*" character. If the
item is a separator line, it must be passed as an "@"
character. If the item is a separator line with a sub-title,
then it must be passed as a "@" character plus the sub-title
string. "Nesting" of sub-menus is accomplished by passing an
array of sub-menu information rather than a character string.
< aPrompts > may contain any mixture of character strings
(single items) or arrays (nested items). Selection of a
nested item will pop-up a sub-menu. To create nested items
pass an array with the following structure:
Element Type Description
------- ---- ---------------------------------
[1] C Menu prompt
[2] A Array of sub-menu items
[3] A Array of sub-menu code-blocks (optional)
[4] A Array of sub-menu messages
[5] A Array of sub-menu help codes
< aPromptBlocks > is an optional array of code blocks. Must be
one code block for each item in < aPrompts >. If a prompt block
array is passed then the code block will be evaluated when the
item is being painted in the menu and the item will be "grayed"
(non-selectable) if the evaluated code block returns a .FALSE.
If the code block returns a .TRUE. or the array item is a NIL,
then the prompt item is selectable.
< aEvalBlocks > is an optional array of code blocks. Must be one
code block for each item in < aPrompts >. If a code block array
is passed then the code block will be evaluated when the item
is selected and the user presses enter.
< aCoord > is an optional ragged array of Row/Column positions
for each item in < aPrompts >. If a Row/Column array is not
passed then the prompts will be placed vertically starting at
< nRow > and < nCol >.
< aMessage > is an optional array of character-string messages to
be displayed for each item in < aPrompts >. The message will be
displayed in accordance with the message options defined in
< aMsgOptions >.
< aHelp > is an optional array of character-strings for each item
in < aPrompts >. The string will be passed as the fourth (4th)
parameter to the HELP procedure if the F1 key is pressed when
an item is selected. See DC_HELPF1() for more information.
< aAccess > is an optional array of character string access level
codes for each item in < aPrompts >. The logged on user will not
be allowed access to this item if the DC_USERACCESS() function
returns a logical .FALSE. when passed this access code. If
the access code is a nil or an empty null-string, or if the
menu is being run with no specific user logged onto the system
or if the user has access to all menus and items, then this
item will be accessible.
< aReturns > is an optional array of numerical return values for
each item in < aPrompts >. This value will be posted to a
static memory variable (when the menu item is selected ) which
is accessed by the function DC_MENURETURN().
Returns:
If <þlReturnValþ> is .FALSE. (default) the hot-key character of the
selected menu item will be returned. If <þlReturnValþ> is .TRUE.,
the CHR() value of the menu choice will be returned. For example,
if the 4th menu item is selected, then CHR(4) will be returned.
A null string is returned if the ESCape key is pressed.
Description:
DC_MENUPULL() is a menu-system that creates pull-down, pop-up,
or AT..PROMPT style menus with optional "high-lighted"
characters, separator lines, "grayed (non-selectable)" items,
message lines (or boxes), and optional code-block evaluation
and help codes.
DC_MENUPULL() automatically supports both keyboard and mouse
input. If the menu is a pop-up or pull-down menu, then clicking
the mouse outside the menu prompt area is equivalent to
pressing the escape key. The left button of the mouse is used
to select the menu item. Press the ENTER key, the right mouse
button, or double-click the left mouse button to invoke the
selected item.
Menus may be "nested" to provide sub-menus and sub-sub-menus.
Notes:
The behavior of DC_MENUPULL() depends on the current setting
of the DC_WINMODE() function.
This function is provided as a replacement for DC_MENU_P()
from earlier versions. DC_MENUPULL() is more powerful and
uses much less eval stack memory, therefore it can be
called recursively without memory problems.
If a FUNCTION KEY was pressed that was not previously set to
call a code-block with SETKEY(), then pressing that function
key will cause the value of the key (i.e. -10) to be saved
to the static variable to be returned by DC_MENURETURN().
Examples:
-- Example 1 --
/* This example demonstrates using DC_MENUPULL() to return a
code letter based on a user menu selection */
local aPrompts, cMenuCode
aPrompts := { 'Open File',;
'Close File',;
'Edit File',;
'Save File',;
'View File',;
'Print File',;
'Run Program',;
'DOS ~Shell' }
cMenuCode := ;
DC_MENUPULL( { 24, 28, ' File Options ', ;
'bg+/rb,n/bg,w+/bg,w+/r,n+/bg', 'B',,,,,,,,,,,, ;
aPrompts } )
do case
case cMenuCode = 'O'
openfile()
case cMenuCode = 'C'
closefile()
case cMenuCode = 'E'
editfile()
case cMenuCode = 'S'
savefile()
case cMenuCode = 'S'
viewfile()
case cMenuCode = 'P'
printfile()
case cMenuCode = 'R'
runexe()
case cMenuCode = 'S'
rundos()
endcase
return
-- Example 2 --
/* This example demonstrates using DC_MENU_P() to execute a
code block based on a user menu selection */
local aPrompts, aBlocks
aPrompts := { 'Open File',;
'Close File',;
'Edit File',;
'Save File',;
'View File',;
'Print File',;
'Run Program',;
'DOS ~Shell' }
aBlocks := { {||openfile()},;
{||closefile()},;
{||editfile()},;
{||savefile()},;
{||viewfile()},;
{||printfile()},;
{||runexe()},;
{||rundos()} }
DC_MENUPULL( { 24, 28, ' File Options ', ;
'bg+/rb,n/bg,w+/bg,w+/r,n+/bg', 'B',,,,,,,,,,,, ;
aPrompts,, aBlocks } )
return
-- Example 3 --
// This example shows how to "nest" sub-menus.
// In the below example, selecting item 2 (File Options) of
// the main menu will pop-up a sub-menu. Selecting Item 1
// (Delete a File) will pop-up another sub-menu. Selecting
// Item 2 (Binary File) will return "FDB".
LOCAL aSubPrompt, aSubBlock, aMainPrompt, aSubSubPrompt
aSubSubPrompt := {'ASCII File','Binary File','EXE File'}
aSubPrompt := { ;
{'Delete a file',aDelPrompt},;
'Copy a file', ;
'Move a file' }
aSubBlock := { , {||copyafile()}, {||moveafile()} }
aMainPrompt := { ;
'Edit Options',;
{'File Options', aSubPrompt, aSubBlock },;
'Search Options',;
'Print Options' }
cSelection := ;
DC_MENUPULL( { 10, 10,,,'B',,,,,,,,,,,, aMainPrompt } )
Source/Library:
_DCMENU2.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_menumain()
dc_menureversecolor()
Changes the way the color of the selected menu item behaves
Syntax:
DC_MenuReverseColor( [< lReverse >] ) - > lOldReversed
Arguments:
< lReverse > if .TRUE. will reverse the color. .FALSE. is default.
Description:
DC_MenuReverseColor() is used to change the way the color of the
selected menu item behaves. The default is .FALSE. to preserve
the look of existing menus. A .TRUE. will cause the foreground
and background colors to switch.
Source/Library:
_DCCLASS.PRG, DCLIPX.DLL
See Also:
DCMENUBAR
DCSUBMENU
DCMENUITEM
dc_menurun()
Run a menu
Syntax:
DC_MenuRun ( [ < cMenuName > | < aMenu > ], ;
[ < cCompileKeys > ], ;
[ < cAccessKeys > ], ;
[ < oDialog > ] ) - > cCodes
Arguments:
< cMenuName > is the name of the menu to load and run. If
the menu exists in the menu dictionary it will be loaded
and executed. If the menu does not exist in the dictionary
then an error message will be displayed. If no parameter is
passed then, a pick-list of menus will be displayed for the
operator to choose.
< aMenu > is a menu array that conforms to the specification
of the array passed to DC_MENUPULL(), DC_MENUMAIN() or
DC_MENUOSYS().
< cCompileKeys > is an optional list of keys (5-digit character
strings separated by commas). Compile Keys are used for
conditional compiling of menu items based on the COMPILE KEY
item of the menu array. See DC_MENUCOMPILE() for more
information.
< cAccessKeys > is an optional list of keys (5-digit character
strings separated by commas). Access Keys are used for
conditional compiling of menu items based on the ACCESS KEY
item of the menu array. See DC_MENUCOMPILE() for more
information.
< oDialog > is an XbpDialog() style Dialog window to install the
menu. If this parameter is passed, then it is assumed that the
menu will be GUI. If < oDialog > is not passed, and the DC_Gui()
flag is ON, a Dialog window will be created and the menu will
be installed in the new dialog window. If < oDialog > is not
passed and the DC_Gui() flag is OFF, the menu will be run as a
text-style menu in a CRT Window.
Returns:
A character string.
Description:
DC_MENURUN() is used to load a menu from the menu dictionary and
execute the menu or to run a menu that is a passed as an array.
Menu arrays may be top-bar style menus (with pull-downs), just
pull-downs, or tree-style menus DC_MENURUN() will determine
which type of menu array it is and pass the array to the appropriate
menu function for execution.
Examples:
-- Example 1 --
/* --- Run Main Menu from menu-dictionary --- */
DC_MENURUN( 'MAINMENU' )
-- Example 2 --
/* --- Pick a Menu and run it --- */
DC_MENURUN()
-- Example 3 --
/* -- Load a menu, compile and run it -- */
aPreMenu := DC_MenuLoad('BROWSE')
aMenu := DC_MenuCompile(aPreMenu)
DC_MENRUN( aMenu )
Source/Library:
_DCMENUE.PRG
See Also:
dc_menucompile()
dc_menuedit()
dc_menuto()
A Moused replacement for MENU TO
Syntax:
DC_MenuTo( < nRow >, ;
< nCol >, ;
[< cTitle >], ;
[< cBoxColor >], ;
[< lType >], ;
[< lBar >], ;
[< lReturnVal >], ;
[< nStart >], ;
< aItems >, ;
[< aBlocks >], ;
[< nExitKey >] ) - > cMenuLetter
Arguments:
< nRow > is the upper-left row (for pull-downs), or lower-left
row (for pop-up menus).
< nCol > is the upper-left column (for pull-downs), or lower-left
column (for pop-up menus).
< cTitle > is an Optional title to be displayed centered on the
top line of the box. If no title is desired use a null string
("").
< cBoxColor > is a single string of four colors to be used for
the frame, menu items, highlighted letters, and select bar,
respectively.
< lType > is .t. for pull-down menu, .f. for pop-up menu
< lBar > - If this is true (.t.) it will make the menu resemble a
MENU TO, with a select bar. If you do not want a select bar,
and just want the items to be chosen by pressing the hot-key
letter only, set this to false (.f.).
< lReturnVal > - If this is false (.f.), only the hot-key letter
is returned. If this is true (.t.), the entire menu item is
returned.
< nStart > is the number for which menu item to start on.
< aItems > is an array of up to 23 menu items to be displayed.
Each item is a character string. By default, the first letter
of each menu item will be highlighted and will be designated as
that menu item's "hot-key". If a different hot-key letter is
desired for a item, precede the desired hot-key letter with a
tilde (~).
If the item is a "gray-scale" item (i.e. it displays only but
is not selectable), it must be preceded by an "*" character.
If the item is a separator line, it must be passed as an "@"
character. If the item is a separator line with a sub-title,
then it must be passed as a "@" character plus the sub-title
string.
< aBlocks > is an optional parallel array of up to 23 code blocks
to be evaluated. The code block evaluated will be the one
corresponding to the menu item selected from < aItems >.
< nExitKey > is the INKEY() number of the key to exit the menu
after evaluating the code block. Default is ESCape key (27).
Returns:
The letter corresponding to the Hot-Key assigned to the menu item
that was selected, a <þ sign if the left arrow was pressed, a þ> if
the right arrow was pressed, or a null string if an error occured.
Description:
DC_MENUTO() is a Dual-mode replacement for _MenuTo(). When
the GUI flag is ON, DC_MENUTO() functions similiar to
_MenuTo() except that it is displayed in GUI mode. When the
GUI flag is OFF, DC_MENUTO() functions identical to _MenuTo()
except it is also activated by a mouse. The left button of the
mouse is used to select the menu item. The right button
or double-clicking works identical to the ENTER key.
In Text mode, DC_MENUTO() also supports highlighting of special
characters to use as "hot-keys".
Notes:
DC_MENUTO() is supported for compatability with previous
releases. It will not be supported in future releases. Use
DC_MENU_P() instead.
Examples:
// This example returns a code letter equal to the Hot Key of
// the selected item
code := DC_MENUTO( 23, 10,' FILE OPTIONS ', '', .f., .t., ;
.f., 1, ;
{ 'Select/Open ~Data File',;
'Select/Open ~Index File',;
'Open New Data File',;
'@',;
'IIF(!EMPTY(ALIAS()),'','*')+'Close Data File',;
'IIF(!EMPTY(INDEXKEY(0)),'','*')+'Close Index ~File(s)',;
'Set Default Directory',;
'Set ~Path Directories' } )
// This example executes a code block for the selected item.
// and exits the menu only if ESCape is pressed.
DC_MENUTO( 23,10, ' UTILITIES ', '', .f., .t., .f., 1,
{ 'Select/Open ~Data File',
'Select/Open ~Index File',
'Open New Data File',
'@',
'IIF(!EMPTY(ALIAS()),'','*')+'Close Data File',
'IIF(!EMPTY(INDEXKEY(0)),'','*')+'Close Index ~File(s)' } ,;
{ {||DC_DBFSEL()},;
{||DC_DBISEL()},;
{||DC_DBFOPEN()},;
{||dbCloseArea()},;
{||dbClearIndex()} }, K_ESC )
Source/Library:
_DCMENU2.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_menumain()
dc_mergeblocks()
Merge two code blocks for later evaluation
Syntax:
DC_MergeBlocks( < bBlock1 >, ;
< bBlock2 > ) - > bNewBlock
Arguments:
< bBlock1 > and < bBlock2 > are any code blocks with the
following
structure:
{|mp1,mp2,oXbp|...}
Returns:
A Code Block.
Description:
DC_MergeBlocks() is used to combine two codeblocks into one
code block for later evaluation.
This function is handy when it is required to add a code block
action to a callback slot but not overwrite any code block
which may already be assigned, thus allowing both code blocks
to be evaluated when the callback event occurs.
Examples:
oParent:resize := ;
DC_MergeBlocks(oParent:resize, ;
_MoveToolBar(oParent,oXbp,nAlign,.t.))
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_mergegetlists()
Merge two GetLists into one
Syntax:
DC_MergeGetLists( < aGetList1 >, ;
< aGetList2 > ) - > aGetList1
Arguments:
< aGetList1 > and < aGetList2 > are GetList arrays containing
DC* commands. The items in < aGetList2 > are added to
< aGetList1 >.
Description:
DC_MergeGetLists() is used to combine two GetList arrays into
a single GetList array. This is required when it is necessary to:
(1) create two separate dialog windows using DCREAD GUI with
the EXIT clause and then combine the GetLists to pass on to
the DC_ReadGuiEventLoop() event handler
(2) add dialog items to an existing dialog and GetList when
designing a dialog for optimum performance.
Only the options assigned to the first GetList will be carried
forward to the merged GetLists.
Examples:
FUNCTION XTest()
/* This example shows how to merge to dialogs into one
with a common GetList and a single event loop */
LOCAL GetList := {}, aGetList1, aGetList2, dDate1 := Date(), ;
dDate2 := Date() + 2, cName1 := Space(10), cName2 := Space(10), ;
oDlg1, oDlg2
@ 0,0 DCSAY 'Enter Date 1' GET dDate1 ;
GETTOOLTIP 'Enter a Valid Start Date'
@ 1,0 DCSAY 'Enter Date 2' GET dDate2 ;
GETTOOLTIP 'Enter a Valid End Date'
DCREAD GUI FIT ADDBUTTONS EXIT PARENT @oDlg1 SAVE ;
TITLE 'Enter Date Information'
aGetList1 := GetList
GetList := {}
@ 0,0 DCSAY 'Enter Name 1' GET cName1 ;
GETTOOLTIP 'Enter a Valid Start Name'
@ 1,0 DCSAY 'Enter Name 2' GET cName2 ;
GETTOOLTIP 'Enter a Valid End Name'
DCREAD GUI FIT EXIT PARENT @oDlg2 SAVE ;
TITLE 'Enter Name Information'
oDlg2:setPos( { oDlg1:currentPos()[1], ;
oDlg1:currentPos()[2] + oDlg1:currentSize()[2]} )
aGetList2 := GetList
GetList := DC_MergeGetLists( aGetList1, aGetList2 )
DC_ReadGuiEventLoop( GetList )
oDlg1:destroy()
oDlg2:destroy()
RETURN nil
--------------------------
FUNCTION XTest2
/* This example demonstrates how to create a dialog that
builds objects and adds items to the GetList on demand
rather than all at once. This improves performance
by creating the objects only when they are needed.
The Gets on a Tab Page will be created the first time
the respective Tab Page is selected and only if it
is selected. */
LOCAL GetList := {}, aTabPages[8], aGets[8,20], i, j, aBuildGets[8], ;
GetOptions
AFill(aBuildGets,.t.)
FOR i := 1 TO 8
IF i = 1
@ 0,0 DCTABPAGE aTabPages[i] SIZE 80,23 ;
CAPTION 'Page ' + Alltrim(Str(i)) PREOFFSET 0 POSTOFFSET 90 ;
EVAL BuildBlock(aTabPages,aBuildGets,i,GetList,aGets)
ELSE
@ 0,0 DCTABPAGE aTabPages[i] RELATIVE aTabPages[i-1] ;
CAPTION 'Page ' + Alltrim(Str(i)) ;
GOTFOCUS BuildBlock(aTabPages,aBuildGets,i,GetList,aGets)
ENDIF
NEXT
DCREAD GUI FIT TITLE 'Tab Pages full of Data'
RETURN nil
* ------------------
STATIC FUNCTION BuildBlock( aTabPages, aBuildGets, i, GetList, aGets )
RETURN {||BuildGets(aTabPages,aBuildGets,i,GetList,aGets)}
* ------------------
STATIC FUNCTION BuildGets( aTabPages, aBuildGets, i, aGetList, aGets )
LOCAL j, GetOptions, GetList := {}
IF aBuildGets[i]
aBuildGets[i] := .f.
FOR j := 1 TO 20
aGets[i,j] := Pad('This is the data in Get ' + ;
Alltrim(Str(i)) + '/' + Alltrim(Str(j)),40)
@ j+1, 5 DCSAY 'This is Say ' + ;
Alltrim(Str(i)) + '/' + Alltrim(Str(j)) ;
GET aGets[i,j] PARENT aTabPages[i] ;
SAYSIZE 15
NEXT
DCREAD GUI PARENT aTabPages[i] EXIT SAVE
DC_MergeGetLists(aGetList,GetList)
ENDIF
RETURN nil
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
dc_messageoff()
Display a blinking message in a GUI message box
Syntax:
DC_MessageOff ( < aMessage > ) - > lStatus
Arguments:
< aMessage > is an array that was returned by DC_MessageOn().
Returns:
A logical .TRUE. if the message was terminated properly, a .FALSE.
it an error occurred.
Description:
DC_MessageOff() is used to terminate a message thread that was
created with DC_MessageOn().
Source/Library:
_DCEXPL.PRG, DCLIPX.DLL
See Also:
dc_messageon()
dc_messageoptions()
dc_messageparent()
dc_messageon()
Display a blinking message in a GUI message box
Syntax:
DC_MessageOn ( < bcMessage >, ;
[< oParent >], ;
[< nBlink >], ;
[< nColor >], ;
[< cFont >], ;
[< nMode >], ;
[< nTimeOut >] ) - > aMessage
Arguments:
< bcMessage > is the message to display. This may be a character
string or a code block that returns a character string. If it is
a code block, then the code block is evaluated at the blink rate.
< nBlink >. If < nBlink > is 0, then the code block is
evaluated each
1/10 second.
< oParent > is a pointer to the XbpStatic() object that will display
the message. If this parameter is not passed, then the function
DC_MessageParent() must be called first to establish a receiving
object. The object may be any class of object that supports the
:setCaption(), :setFontCompoundName() and :setColorFG() methods.
< nBlink > is the blink rate, in 1/100 seconds. The default is 0
(meaning no blinking). If this parameter is not passed then the
blink rate is established by the DC_MessageOptions() default
value.
< nColor > is the foreground color of the message. This must be
a numeric value starting with GRA_CLR_* as defined in GRA.CH or
the numeric equivalent of an RGB color. The color of the message
object will be temporarily changed for this message only.
< cFont > is the font of the message. This must be a valid font
string (eg. "10.Arial Bold"). The font of the message object
will be temporarily changed for this message only.
< nMode > is reserved.
< nTimeOut > is the timeout (in seconds) of the message blinking
thread. The default is 0 (meaning no timeout). Normally a
timeout is not needed provided that DC_MessageOff() is called to
terminate the thread. A timeout may be desirable in the event
that an error may occur which prevents DC_MessageOff() from
being called.
Returns:
An array containing information needed to destroy the thread and
terminate the message blinking.
Description:
DC_MessageOn() is used to display a message in an XbpStatic()
object at a specified blinking rate. DC_MessageOn() starts a new
thread to cause the message to blink until it is removed with
DC_MessageOff().
Examples:
#include "dcdialog.ch"
FUNCTION XTest()
LOCAL n, GetList[0], oMsgBox, oDialog, aMessage
@0,0 DCSTATIC TYPE XBPSTATIC_TYPE_TEXT SIZE 100,2 ;
FONT '8.Arial Bold' COLOR GRA_CLR_BLUE, GRA_CLR_WHITE ;
OBJECT oMsgBox OPTIONS XBPSTATIC_TEXT_CENTER + XBPSTATIC_TEXT_BOTTOM
DCREAD GUI FIT EXIT PARENT @oDialog TITLE 'Message Test' OPTIONS GetOptions
DC_MessageParent(oMsgBox)
DC_MessageOptions( { 0, 10, 2 } )
aMessage := DC_MessageOn( 'Indexing File B')
MyReindex('B')
DC_MessageOff(aMessage)
aMessage := DC_MessageOn( 'Indexing File C', oMsgBox, 5, ;
GRA_CLR_RED, '30.Courier Bold' )
MyReindex('C')
DC_MessageOff(aMessage)
aMessage := DC_MessageOn( 'Indexing File D', oMsgBox )
MyReindex('D')
DC_MessageOff(aMessage)
aMessage := DC_MessageOn( 'Indexing File E', oMsgBox, 5,,,, 2 )
MyReindex('E')
DC_MessageOff(aMessage)
oDialog:destroy()
DC_MsgBox('done')
RETURN nil
Source/Library:
_DCEXPL.PRG, DCLIPX.DLL
See Also:
dc_messageoff()
dc_messageoptions()
dc_messageparent()
dc_messageoptions()
Set the default options for DC_MessageOn()
Syntax:
DC_MessageOptions ( < aOptions > ) - > aOldOptions
Arguments:
< aOptions > is an array of options.
Element Type Description
------- ---- ---------------------------------------------
[1] N Mode (reserved)
[2] N Blink rate (1/100 seconds)
[3] N Time out (seconds)
[4] L Clear message window on close
Returns:
An array containing the previously set options.
Description:
DC_MessageOptions() is used to set default options for
DC_MessageOn().
Examples:
aOptions := Array(4)
aOptions[2] := 30
aOptions[3] := 100
aOptions[4] := .t.
DC_MessageOptions(aOptions)
Source/Library:
_DCEXPL.PRG, DCLIPX.DLL
See Also:
dc_messageon()
dc_messageoff()
dc_messageparent()
dc_messageparent()
Set the Parent object for DC_MessageOn()
Syntax:
DC_MessageOptions ( [< oParent >] ) - > oOldParent
Arguments:
< oParent > is an XbpStatic() object or any object that supports
the methods :setCaption(), :setColorFG() and :setFontCompoundName().
Returns:
The previously set parent object.
Description:
DC_MessageParent() is used to set the default parent object for
DC_MessageOn().
Source/Library:
_DCEXPL.PRG, DCLIPX.DLL
See Also:
dc_messageon()
dc_messageoff()
dc_messageoptions()
dc_modstru()
Modify the structure of a database
Syntax:
DC_ModStru( [< cNewFileName >] ) - > lStatus
Arguments:
< cNewFileName > is the name to assign to the new modified file.
If no argument is given, then the new file name will be the
same as the original and the original file will be renamed to
the same name as the file alias with a .DBK extension. If the
file contained at least one memo field, then the memo file
will be renamed to the same name as the file alias with the
.DTK extension.
Returns:
A logical .TRUE. if the file was successfully updated, .FALSE.
if the operation was aborted by the user or otherwise failed.
Description:
DC_MODSTRU() is used to change the structure of the database in
the current work area and restore all the data in the file or
save the database to a new name.
You can add perform the following operations with a GUI dialog:
1. Add a new field
2. Delete a field
3. Move a field
4. Rename a field
5. Replicate a set of new fields
6. Change the type of a field
7. Change the length of a field
All data in the former file will restored to the modified
file except for any fields that were deleted.
Examples:
do while .t.
@ 10,10 prompt "open a database"
@ 11,10 prompt "browse database"
@ 12,10 prompt "modify structure"
menu to nChoice
do case
case nChoice = 1
dc_dbfopen()
case nChoice = 2
dc_browsedb()
case nChoice = 3
DC_MODSTRU()
endcase
enddo
Source/Library:
_DCFCSTR.PRG, DCLIP1.DLL
See Also:
dc_struupdate()
dc_moubutton()
Test the status of the mouse buttons
Syntax:
DC_MouButton ( ) - > nStatus
Arguments:
None
Returns:
A numeric value.
0 - All buttons up
1 - Left button down
2 - Right button down
3 - Left and Right button down
4 - Right button released
Description:
DC_MOUBUTTON() returns the status of the mouse buttons.
Examples:
FUNCTION key_mouse ( nMouseRow, nMouseCol )
// Get a key or mouse event
// returns -100 is left button down, 13 if right button
// released
do while .t.
nInkey := inkey()
nMouseStatus := DC_MOUBUTTON()
do case
case nMouseStatus = 1
dc_mougetposition( @nMouseRow, @nMouseCol )
nInkey := -100
exit
case nMouseStatus = 4
nInkey := 13
exit
case nInkey # 0
exit
endcase
enddo
return nInkey
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_mousekey()
dc_mouclick()
Set the mouse button double-click delay
Syntax:
DC_MouClick ( < nDelay > ) - > nDelay
Arguments:
< nDelay > is a number representing tenths of a second to wait
for successive depressions of the left button. Default is 4.
If nDelay is set to 0, then the double-click action will be
disabled.
Returns:
A numeric value.
0 - All buttons up
1 - Left button down
2 - Right button down
3 - Left and Right button down
4 - Right button released
Description:
DC_MOUCLICK() is used to set the delay between successive
clicks of the left button to determine whether or not the
operator has "double-clicked" the button. DC_MOUCLICK()
works in conjunction with DC_MOUBUTTONSTATUS() and DC_INKEY().
DC_MOUBUTTONSTATUS() returns a 2 when the right button is
pressed or the left button is double-clicked. DC_INKEY()
returns a -104 when the right button is pressed or the left
button is double-clicked.
Examples:
// Set double-click delay to 3. seconds.
DC_MOUCLICK( .3 )
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_inkey()
dc_moucol()
Get current screen column of mouse cursor
Syntax:
DC_MouCol () - > nColumn
Arguments:
None
Returns:
A numeric value
Description:
DC_MOUCOL() returns the column location of the mouse cursor.
Examples:
nRow := nil
nCol := nil
GetMouse( @nRow, @nCol )
? 'Mouse position is:', nRow, nCol
return
function GetMouse ( @nRow, @nCol )
nRow := dc_mourow()
nCol := DC_MOUCOL()
return nil
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_mourow()
dc_mougetpos()
dc_moudisable()
Disable the mouse functions
Syntax:
DC_MouDisable ( ) - > lStatus
Arguments:
None.
Returns:
A logical .TRUE. if the mouse driver is installed and initialized,
.FALSE. otherwise.
Description:
DC_MOUDISABLE() is used to temporarily disable mouse functions.
The default after DC_MOUINITIALIZE() is called at the start of
the application is "enabled". DC_MOUDISABLE() and
DC_MOUENABLE() are used in conjunction with each other if you
wish to disable mouse capability only in certain areas of the
program and reinstate it again without reinitializing.
Examples:
dc_moudisable() // shut off the mouse
do myapp
DC_MOUENABLE() // turn the mouse back on whenever mouse
// functions are called
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_mouenable()
dc_mouenable()
Enable the mouse functions
Syntax:
DC_MouEnable ( ) - > lStatus
Arguments:
None.
Returns:
A logical .TRUE. if the mouse driver is installed and initialized,
.FALSE. otherwise.
Description:
DC_MOUENABLE() is used to enable mouse functions. This is the
default after DC_MOUINITIALIZE() is called at the start of the
application. DC_MOUDISABLE() and DC_MOUENABLE() are used in
conjunction with each other if you wish to disable mouse
capability only in certain areas of the program and reinstate
it again without reinitializing.
Examples:
dc_moudisable() // shut off the mouse
do myapp
DC_MOUENABLE() // turn the mouse back on whenever mouse
// functions are called
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_moudisable()
dc_mougetevent()
Get a mouse event from the Mouse Click buffer
Syntax:
dc_mougetevent ( ) - > nStatus
Arguments:
None
Returns:
nil
Description:
DC_MOUGETEVENT() is used to remove the status of a mouse event
from the mouse click buffer.
DC_MOUSTART() maintains a queue of outstanding mouse events,
i.e., events which the Clipper program has not enquired about.
The DC_MOUNUMEVENTS(), DC_MOUGETEVENT(), DC_MOUROW(), and
DC_MOUCOL() functions all operate on this queue.
DC_MOUSTART() starts monitoring for mouse clicks and stuffs a
key into the keyboard buffer each time a mouse button is
pressed and released. The mouse button status is also stuffed
into a mouse click buffer for extracting with DC_MOUGETEVENT().
Notes:
A numeric value, encoded as follows:
0 - No event, queue is empty.
2 - Left button pressed
4 - Left button released
8 - Right button pressed
16 - Right button released
Examples:
dc_mouinitialize()
dc_moustart( -29 ) // Key CTRL-F10 is reserved for the mouse
dc_moushow()
set key -29 to myfunc
memo = memoread('dclip.sys')
memo := memoedit( memo, 5,5,20,75 )
dc_moustop()
dc_mouhide()
set key -29 to
return
function myfunc
local nStatus := DC_MOUGETEVENT()
@ 23, 0 say ''
do case
case nStatus = 2
?? ' left button pressed'
case nStatus = 4
?? ' left button released'
case nStatus = 8
?? ' right button pressed'
case nStatus = 16
?? 'right button released'
endcase
?? ' at row', dc_mourow(), ', col', dc_moucol()
return nil
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_moustart()
dc_mougetpos()
Get the current row and column of the mouse
Syntax:
dc_mougetpos ( @< nRow >, ;
@< nCol > ) - > nil
Arguments:
< nRow > is an integer variable to store the mouse row
< nCol > is an integer variable to store the mouse column
Returns:
nil
Description:
DC_MOUGETPOS() is used to get the current row and column
position of the mouse.
Examples:
FUNCTION key_mouse ( nMouseRow, nMouseCol )
// Get a key or mouse event
// returns -100 is left button down, 13 if right button
// released
do while .t.
nInkey := inkey()
nMouseStatus := dc_moubutton()
do case
case nMouseStatus = 1
DC_MOUGETPOS( @nMouseRow, @nMouseCol )
nInkey := -100
exit
case nMouseStatus = 4
nInkey := 13
exit
case nInkey # 0
exit
endcase
enddo
return nInkey
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_moucol()
dc_mourow()
dc_mouhide()
Hide the mouse cursor
Syntax:
dc_mouhide () - > nil
Arguments:
None
Returns:
nil
Description:
DC_MOUHIDE() is used to hide the mouse cursor, but still leave
the mouse enabled to monitor mouse clicks in the event that the
user's program is displaying it's own cursor.
Examples:
nRow := nil
nCol := nil
DC_MOUHIDE()
// hide the mouse and track it with the screen cursor instead
set cursor on
do while .t.
dc_mougetpos( @nRow, @nCol )
@ nRow, nCol SAY ''
endif
return
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_moushow()
dc_mouinitialize()
Initialize the mouse functions
Syntax:
dc_mouinitialize ( ) - > nil
Arguments:
None
Description:
DC_MOUINITIALIZE() is used to enable all the DC_MOU*()
functions. If the mouse is not initialized then all DC_MOU*()
functions will return NIL or 0 values.
DC_MOUINITIALIZE() resets the mouse, hides the mouse cursor,
and positions the mouse cursor to the center of the screen.
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
dc_moupresent()
Is a mouse present?
Syntax:
dc_moupresent ( ) - > lStatus
Arguments:
None
Description:
DC_MOUPRESENT() is used to determine if a mouse driver is
present.
Examples:
if DC_MOUPRESENT()
dc_mougetpos( @nRow, @nCol )
? 'mouse is at ', nRow, nCol
else
? 'No mouse found.. Make sure driver is loaded'
endif
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
dc_mourow()
Get current screen row of mouse cursor
Syntax:
dc_moucol () - > nColumn
Arguments:
None
Returns:
A numeric value
Description:
DC_MOUROW() returns the row location of the mouse cursor.
Examples:
nRow := nil
nCol := nil
GetMouse( @nRow, @nCol )
? 'Mouse position is:', nRow, nCol
return
function GetMouse ( @nRow, @nCol )
nRow := DC_MOUROW()
nCol := dc_moucol()
return nil
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_moucol()
dc_mougetpos()
dc_mousebutton()
Paint a mouse button on the screen
Syntax:
DC_MouseButton( @< aButtons >, ;
< nStRow >, ;
< nStCol >, ;
< nEnRow >, ;
< nEnCol >, ;
< aText >, ;
< xKeys >, ;
< nAltKey >, ;
[< nWait >], ;
[< cColor >], ;
[< lBox >] ) - > aButtons
Arguments:
< aButtons > is a the multi-dimensional array that will hold
the mouse button information. This array must conform to
the specifications for DC_MOUSEKEY().
< nStRow >, < nStCol >, < nEnRow >, < nEnCol >
are the screen
coordinates of the mouse button.
< aText > is an array of character strings to display in the
box. The first line of text will display in the first open
row of the box, etc.
< xKeys > may be a Type C, N, or B.
If type C, then this is a string to stuff into the keyboard
buffer. If type N, then this is an INKEY() value to stuff
into the keyboard buffer. If type B, then this is a code
block to evaluate.
< nAltKey > is an Alternate INKEY() value to stuff in the
keyboard buffer after evaluating the code block.
< nWait > is the number of seconds to pause (optional). Use
this parameter to specify the amount of delay between key
stuffings when the operator holds down the mouse button.
< cColor > is the color of the button. This must be a
standard Clipper color string. If no parameter is passed,
the currently selected system color will be used.
< lBox > if .TRUE. (default) will paint a box around the button
and the text will be inserted within the box. If .FALSE., then
the text will be painted at the starting coordinate and no box
will be painted.
Returns:
A pointer to the array passed as <þaButtonsþ>.
Description:
DC_MOUSEBUTTON() is used to paint a button on the screen and
add the button to an array for later evaluating with
DC_MOUSEKEY().
Examples:
//paint some calculator buttons
aMouseKeys := {}
DC_MOUSEBUTTON( @aMouseKeys, nStRow+4, nStCol+2, nStRow+6,;
nStCol+5, {'AC'}, 'AC' )
DC_MOUSEBUTTON( @aMouseKeys, nStRow+4, nStCol+7, nStRow+6,;
nStCol+10, {' 7'}, '7' )
DC_MOUSEBUTTON( @aMouseKeys, nStRow+4, nStCol+11, nStRow+6,;
nStCol+14, {' 8'}, '8' )
DC_MOUSEBUTTON( @aMouseKeys, nStRow+4, nStCol+15, nStRow+6,;
nStCol+18, {' 9'}, '9' )
DC_MOUSEBUTTON( @aMouseKeys, nStRow+4, nStCol+20, nStRow+6,;
nStCol+23, {' /'}, '/' )
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_mousekey()
dc_mousekey()
Scan array of mouse buttons and stuff keyboard or evaluate
Syntax:
DC_MouseKey( < aButtons >, ;
< lStuff > ) - > cCode
Arguments:
< aButtons > is a multi-dimensional array with coordinates and
Keyboard Codes, Inkey values or Code Blocks for establishing
mouse buttons. Each button in the main array is a sub-array of
7 elements:
Element Type Description
------- ---- ---------------------------------
1 N Top Row of button
2 N Left Column of button
3 N Bottom Row of button (optional)
4 N Right Column of button (optional)
5 C Keyboard character to stuff
or N Keyboard INKEY value to stuff
or B Code block to evaluate
6 N Secondary INKEY value to stuff (optional)
7 N Number of seconds to pause (optional). Use
this parameter to specify the amount of
delay between key stuffings when the
operator holds down the mouse.
If Element 3 is a NIL, then the value of Element 1 will be
used.
IF Element 4 is a NIL, then the value of Element 2 will be
used.
< lStuff > if .TRUE. (default) will stuff the keyboard character
into the keyboard buffer if the mouse was clicked in the button
coordinate area defined by elements 1-4. If .FALSE. the value
of element 5 will be returned only, not stuffed in the
keyboard.
Returns:
The CHR() value in element 5 of the <þaButtonsþ> array if
the mouse was clicked in the coordinate area. If the mouse
was not clicked in an area designated by one of the sub-
arrays, a null "" string will be returned.
Description:
DC_MOUSEKEY() will scan an array of mouse button definitions
and stuff the keyboard or evaluate a code-block with a
pre-defined value if the mouse was clicked in a designated
area.
Examples:
@ 10,0 to 12,6
@ 11,2 SAY CHR(24)+' '+CHR(25)
@ 10,20 to 12,25
@ 11,21 say 'Kill'
@ 10,40 to 12,45
@ 11,41 say 'Add'
@ 10,60 to 12,65
@ 11,61 say 'Quit'
aButtons := { { 10,20,12,25,'K' },;
{ 10,40,12,45,'A' },;
{ 10,60,12,65,K_ESC },;
{ 10,2,,,K_UP,,.5 },;
{ 10,4,,,K_DOWN,,.5 } }
do while .t.
nInkey := dc_inkey(0)
do case
case nInkey = -101 .AND !empty(DC_MOUSEKEY(aButtons))
case nInkey = 'K'
do kill
case nInkey = 'A'
do add
case nInkey = K_UP
skip -1
case nInkey = K_DOWN
skip
case nInkey = K_ESC
exit
endcase
enddo
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
dc_mousetpos()
Set the current row and column of the mouse
Syntax:
dc_mousetpos ( < nRow >, ;
< nCol > ) - > nil
Arguments:
< nRow > is an integer variable to set the mouse row
< nCol > is an integer variable to set the mouse column
Returns:
nil
Description:
DC_MOUSETPOS() is used to set the current row and column
position of the mouse.
Examples:
// make sure the mouse is at the upper left corner when
// starting the drag
DC_MOUSETPOSITION( 10, 20 )
dc_drag ( 10, 20, 22, 70 )
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_mougetpos()
dc_moushow()
Show the mouse at it's current screen position
Syntax:
dc_moushow ( ) - > nil
Arguments:
None
Returns:
nil
Description:
DC_MOUSHOW() displays the mouse cursor on the screen, leaving
the mouse enabled.
Examples:
if dc_moupresent()
dc_mouinitialize()
MOU_SHOW()
else
? 'Mouse not present'
endif
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_mouhide()
dc_moustart()
Enable automatic keyboard stuffing on a Mouse Click
Syntax:
dc_moustart( < nInkey > ) - > nil
Arguments:
< nInkey > is the INKEY value of the key to be placed into the
keyboard buffer when a mouse event occurs.
Returns:
nil
Description:
DC_MOUSTART() maintains a queue of outstanding mouse events,
i.e., events which the Clipper program has not enquired about.
The DC_MOUNUMEVENTS(), DC_MOUGETEVENT(), DC_MOUROW(), and
DC_MOUCOL() functions all operate on this queue.
DC_MOUSTART() starts monitoring for mouse clicks and stuffs a
key into the keyboard buffer each time a mouse button is
pressed and released. The mouse button status is also stuffed
into a mouse click buffer for extracting with DC_MOUGETEVENT().
DC_MOUSTART() is handy when using Clipper functions that wait
for a key hit such as __WAIT(), ACHOICE(), READMODAL(),
MEMOEDIT(), etc, and you wish to call a user-defined function
when a mouse-button is clicked.
Examples:
dc_mouinitialize()
DC_MOUSTART( -29 ) // Key CTRL-F10 is reserved for the mouse
dc_moushow()
set key -29 to myfunc
memo = memoread('dclip.sys')
memo := memoedit( memo, 5,5,20,75 )
dc_moustop()
dc_mouhide()
set key -29 to
return
function myfunc
local nStatus := dc_mougetevent()
@ 23, 0 say ''
do case
case nStatus = 2
?? ' left button pressed'
case nStatus = 4
?? ' left button released'
case nStatus = 8
?? ' right button pressed'
case nStatus = 16
?? 'right button released'
endcase
?? ' at row', dc_mourow(), ', col', dc_moucol()
return nil
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_moustop()
dc_mougetevent
dc_moustop()
Turn off the Mouse Event driver
Syntax:
dc_moustop ( ) - > nil
Arguments:
None.
Returns:
Nil
Description:
DC_MOUSTOP() is used to disable mouse events that were started
with DC_MOUSTART(). This function must be called when exiting
mouse handling routines to insure that mouse clicks don't go
into the keyboard buffer when not desired.
Examples:
dc_mouinitialize()
dc_moustart( -29 ) // Key CTRL-F10 is reserved for the
// mouse
dc_moushow()
set key -29 to myfunc
memo = memoread('dclip.sys')
memo := memoedit( memo, 5,5,20,75 )
DC_MOUSTOP()
dc_mouhide()
set key -29 to
return
function myfunc
local nStatus := dc_mougetevent()
@ 23, 0 say ''
do case
case nStatus = 2
?? ' left button pressed'
case nStatus = 4
?? ' left button released'
case nStatus = 8
?? ' right button pressed'
case nStatus = 16
?? 'right button released'
endcase
?? ' at row', dc_mourow(), ', col', dc_moucol()
return nil
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_moustart()
dc_mouvisible()
Is the mouse cursor visible?
Syntax:
dc_mouvisible ( ) - > lStatus
Arguments:
None
Returns:
A logical .TRUE. if the mouse is visible, .FALSE. otherwise.
Description:
DC_MOUVISIBLE() is used to determine if the mouse cursor is
visible on the screen.
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
dc_movecursortoobject()
Move mouse cursor to the center of an object
Syntax:
DC_MoveCursorToObject( < oXbp > ) - > nil
Arguments:
< oXbp > is the object to receive the cursor.
Returns:
Nil.
Description:
DC_MoveCursorToObject() will position the mouse cursor to the
center of an Xbase Parts object.
Notes:
CAUTION:
1. Moving the cursor to an object that is hidden could cause your
mouse to disappear.
2. Moving the cursor to an object that is off the screen could
cause your mouse to leap off your desktop and may cause
damage. Donnay Software is not responsible for such damage.
3. Moving the cursor to an object that is a large distance from
the current location could cause the mouse to shift laterally
at near "warp speed". If your hand is on the mouse when this
movement occurs, it could cause injury. Donnay Software is
not responsible for personal injury.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_moveobject()
Move or resize an Xbase Parts object with the mouse
Syntax:
DC_MoveObject ( < oXbp >, ;
< aPos >, ;
< nDragMode >, ;
< nCursor >, ;
< aDesign >, ;
< nStopEvent >, ;
< nGridRows >, ;
< nGridCols > ) - > nil
Arguments:
< oXbp > is a pointer to the object to move or resize.
< aPos > is a two-element array containing the current mouse
coordinates relative to location 0,0 (bottom-left) of the
object.
< nDragMode > is a number defined in DCDIALOG.CH designating
how to drag the object. < nCursor > is the resource number of
a mouse POINTER that has been linked to the .EXE of the
application. DCCURSOR.CH lists the defines for pointers that
are available EXPRESS.RES. When using the DESIGN feature of
DC_READGUI() in eXPress++, the following pointers are used.
Drag Mode Cursor Pointer
----------------------- --------------------------
DRAG_ENTIRE_OBJECT POINTER_ARROW_1
DRAG_RIGHT POINTER_SIZE3_1
DRAG_RIGHT_TOP POINTER_SIZE1_2
DRAG_RIGHT_BOTTOM POINTER_SIZE2_1
DRAG_LEFT POINTER_SIZE3_1
DRAG_LEFT_TOP POINTER_SIZE2_1
DRAG_LEFT_BOTTOM POINTER_SIZE1_1
DRAG_TOP POINTER_SIZE4_1
DRAG_BOTTOM POINTER_SIZE4_1
< aDesign > and < nStopEvent > are reserved for internal
calls.
Pass a NIL.
< nGridRows > and < nGridCols > are the number for pixels for
columns and rows respectively. Moving and object will cause it
to snap to the grid.
Returns:
nil.
Description:
DC_MOVEOBJECT() is used to dynamically move or resize an object
in a Dialog window with the mouse. An optional GRID is
displayed in the drawing area of the parent object to make it
simple to align the objects on the screen.
Examples:
#include 'dcdialog.ch'
#include 'dccursor.ch'
#include 'appevent.ch'
PROCEDURE Xtest( )
LOCAL GetList := {}, cGet1 := 'This is GET 1', ;
cGet2 := 'This is GET 2', cMemo := 'This is a memo', ;
lDesignMode := .f.
@ 0,0 DCSAY 'This is SAY 1' GET cGet1
@ 3,0 DCSAY 'This is SAY 2' GET cGet2
@ 5,0 DCMULTILINE cMemo SIZE 40,5
@ 12,0 DCPUSHBUTTON CAPTION 'Design' ;
SIZE 9,1.5 ;
ACTION {||lDesignMode := .t.}
DCREAD GUI ;
FIT ;
ADDBUTTONS ;
HANDLER myHandler ;
REFERENCE @lDesignMode
RETURN
/* -------------------- */
STATIC FUNCTION ;
myHandler ( nEvent, mp1, mp2, oXbp, oDlg, GetList, lDesignMode )
LOCAL nWidth, nHeight
STATIC nCursor := POINTER_ARROW_1, nDragMode := 0
IF lDesignMode .AND. nEvent = xbeM_Motion
nWidth := oXbp:CurrentSize()[1]
nHeight := oXbp:CurrentSize()[2]
IF oXbp == oDlg .OR. oXbp == oDlg:drawingArea .OR. ;
Upper(oXbp:ClassName()) == 'XBPTABPAGE'
nCursor := POINTER_ARROW_1
ELSEIF mp1[1] >= nWidth - 5 .AND. mp1[2] >= nHeight - 5
nDragMode := DRAG_RIGHT_TOP
nCursor := POINTER_SIZE1_1
ELSEIF mp1[1] >= nWidth - 5 .AND. mp1[2] <= 5
nDragMode := DRAG_RIGHT_BOTTOM
nCursor := POINTER_SIZE2_1
ELSEIF mp1[1] <= 5 .AND. mp1[2] >= nHeight - 5
nDragMode := DRAG_LEFT_TOP
nCursor := POINTER_SIZE2_1
ELSEIF mp1[1] <= 5 .AND. mp1[2] <= 5
nDragMode := DRAG_LEFT_BOTTOM
nCursor := POINTER_SIZE1_1
ELSEIF mp1[1] <= 5
nDragMode := DRAG_LEFT
nCursor := POINTER_SIZE3_1
ELSEIF mp1[1] >= nWidth - 5
nDragMode := DRAG_RIGHT
nCursor := POINTER_SIZE3_1
ELSEIF mp1[2] <= 5
nDragMode := DRAG_BOTTOM
nCursor := POINTER_SIZE4_1
ELSEIF mp1[2] >= nHeight - 5
nDragMode := DRAG_TOP
nCursor := POINTER_SIZE4_1
ELSE
nDragMode := DRAG_ENTIRE_OBJECT
nCursor := POINTER_MOVE_1
ENDIF
IF IsMethod(oXbp,'SetPointer')
oXbp:SetPointer( nil, nCursor, 1 )
ENDIF
RETURN DCGUI_IGNORE
ELSEIF lDesignMode .AND. nEvent = xbeM_LbDown
DC_MoveObject( oXbp, mp1, nDragMode, nCursor )
RETURN DCGUI_IGNORE
ENDIF
RETURN DCGUI_NONE
Source/Library:
_DCFUNCT.PRG/.OBJ, DCLIPX.DLL, DCLIPX.LIB
See Also:
dc_readgui()
dc_moveparentwindow()
Move a parent window by clicking mouse on child object
Syntax:
DC_MoveParentWindow( < mp1 >, ;
< mp2 >, ;
< oXbp > ) - > nil
Arguments:
< mp1 >, < mp2 > and < oXbp > are the parameters passed
to the
code block.
Description:
DC_MoveParentWindow() is used to move the parent window with
the mouse by clicking on a child object at any level.
Notes:
Example: oStatic:lbDown := {|a,b,c|DC_MoveParentWindow(a,b,c)}
Clicking the left button on oStatic will allow movement of the
entire window until the mouse is released.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_msgbox()
Display an array of messages in a window
Syntax:
DC_MsgBox ( [< nStartRow >], ;
[< nStartCol >], ;
< aMessages >, ;
[< cTitle >], ;
[< lWait >], ;
[< nSeconds >], ;
[< lYesNo >], ;
[@< nChoice >], ;
[< aButtons >], ;
[< aMenuId >], ;
[< cMenuName >], ;
[@< cHotKey >], ;
[< cFont >], ;
[< bEval >], ;
[< nIcon >], ;
[< lNoRestore >], ;
[< lAlwaysOnTop >], ;
[< aColor >], ;
[< aButtonSize >, ;
[< lHorizontal >], ;
[< oOwner >] ) - > lStatus
Arguments:
< nStartRow > is the starting screen row.
< nStartCol > is the starting screen column.
If no coordinates are given, then the message box will be
displayed in the middle of the screen.
< aMessages > is an array of character strings.
< cTitle > is the title to place at the top of the message box.
If this parameter is not passed, then the title will be the
default title established by DC_MsgBoxTitle().
< lWait > will add an additional line to the message box - "Press
any key to continue..." and wait for the user to press a key.
< nSeconds > will display the box for a specified number of
seconds or until a key is hit.
< lYesNo > if .t. will display YES / NO menu items below the
message text. .F. (default) will behave normally.
< nChoice > : 1 will default to YES (default), 2 will default
to NO. If passed by reference and an array of < aItems > is
also passed, then the value returned will be equivalent to
the menu item selected.
< aButtons > - An array of menu buttons to choose from. The number
of the selected item will be returned in the < @nChoice >
variable. This is a single dimensional array containing captions
for the buttons.
< aMenuId > - An optional array of unique Menu ID codes (up to 8
characters) for each menu item in < aButtons >. This array is
needed to enable the PERSISTENT MENU SELECTION feature. See
DC_MenuPull() for more information.
< cMenuName > - An optional parameter with a "unique" name for
this menu. This name is needed to enable the PERSISTENT MENU
SELECTION feature. See DC_MenuPull() for more information.
@< cHotKey > - An optional parameter to return the value of the
high-lighted letter in the selected menu item when using
DC_MSGBOX() with an array of menu items. This must be a variable,
passed by reference, in which to store a character value.
< cFont > is the font to use for the message text. This must conform
to standard font declarations used with the :setFontCompoundName()
method of XbpStatic().
< bEval > is a code block to evaluate after the Message box is
created. The Messsage box dialog object is passed to the code
block.
< nIcon > is the icon to use in the message box text area.
The default is XBPSTATIC_SYSICON_ICONQUESTION when the YESNO clause
is used otherwise it is XBPSTATIC_SYSICON_ICONINFORMATION.
< lNoRestore > overrides the setting of DC_AutoRestoreWindow().
< lAlwaysOnTop > forces the window to remain on the top of all
other application windows.
< aColor > is a 2-element array of foreground and background colors.
The default color is set by the DC_MsgBoxColor() get-set function.
< aButtonWidth > is an array containing the width and height, in
pixels, of the buttons created with the < aItems > parameter,
otherwise the buttons will be sized to the longest caption.
< lHorizontal > will create the buttons horizontally instead of
vertically.
< oOwner > < oOwner > is the owner of the message box. If the
owner
parameter is not used, the message box will center in the
object returned by the SetAppWindow() function, otherwise it
will center on the owner.
Returns:
A logical .TRUE. if the last key pressed by the user is a "Y",
.FALSE. otherwise.
Description:
DC_MSGBOX() is used to display a set of message lines in a
window. The two (2) starting coordinates and an array of
characters strings are passed. The width and length of the box
will be determined automatically by the width of the longest
item and the number of items.
Notes:
If only one parameter, a Character string or an Array is passed,
then DC_MSGBOX() will display the contents of the character
string or the array and an "OK".
Examples:
PROCEDURE Xtest( )
LOCAL oOldAppWin := SetAppWindow(DC_QOUTWINDOW()), cFileName
DC_Gui(.f.)
DC_MSGBOX( 10,5, { 'You must open a data file first' },,.t. )
SetAppWindow( oOldAppWin )
DC_Gui( .t. )
cFileName := 'JUNK'
IF DC_MSGBOX( ,, { 'Delete '+cFileName+'? ' }, ;
'Delete a File',,,.t. )
ERASE (cFileName)
ENDIF
RETURN
Source/Library:
_DCMSG.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_alert()
DCMSGBOX
dc_msgboxtitle()
dc_msgboxgui()
dc_msgboxescape()
DC_MsgBoxColor()
A Get-set function to set the default color for DCMSGBOX.
Syntax:
DC_MsgBoxColor( [< aColor >] - > < aOldColor >
Arguments:
< aColor > is a 2-element array containing a foreground color and a
background color. Each element must be a numeric value or a 3-element
array containing the RGB values.
Description:
DC_MsgBoxColor() is used to get or set the default color value for
DC_MsgBox() and DCMSGBOX.
Examples:
DC_MsgBoxColor( { {255,0,0}, {255,255,255} } )
Source/Library:
_dcmsg.prg, dclipx.dll
See Also:
dc_msgbox()
DCMSGBOX
dc_msgboxescape()
Set the behavior of the ESC key when using DC_MsgBox()
Syntax:
DC_MsgBoxEscape( < lFalse > ) - > lOldValue
Arguments:
< lFalse > if .TRUE. will cause DC_MsgBox() to return a .FALSE. if
the ESCAPE key is hit, otherwise it will return the value
associated with the default choice.
Returns:
A logical value.
Description:
DC_MsgBoxEscape() is a Get/Set function that is used to set the
behavior of the ESCAPE key when using DC_MsgBox() or DCMSGBOX.
Source/Library:
_dcmsg.prg
See Also:
dc_msgbox()
DCMSGBOX
dc_msgboxgui()
Force DC_MsgBox() to always display a GUI dialog
Syntax:
DC_MsgBoxGui ( [< lGui >] ) - > lStatus
Arguments:
< lGui > if .TRUE. will force all DC_MsgBox() dialogs to be
displayed as GUI. If < lGui > is .FALSE. (default) then DC_MsgBox()
dialogs will be displayed in accordance with the DC_Gui()
function.
Returns:
A logical .TRUE. if the last key pressed by the user is a "Y",
.FALSE. otherwise.
Description:
DC_MsgBoxGui(.t.) is used to force DC_MsgBox() to always display
a GUI dialog even if the DC_Gui() flag is set to .FALSE.
Notes:
If only one parameter, a Character string or an Array is passed,
then DC_MSGBOX() will display the contents of the character
string or the array and an "OK".
Source/Library:
_DCMSG.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_msgbox()
dc_msgboxtitle()
Set the default title for DC_MsgBox()
Syntax:
DC_MsgBoxTitle ( [< cTitle >] ) - > cOldTitle
Arguments:
< cTitle > is the title to place at the top of the message box.
If this parameter is NIL, then the name of the .EXE will be
placed in the title.
Returns:
A character string.
Description:
DC_MsgBoxTitle() is used to establish a default title for
message boxes created by DC_MsgBox() in the event that the <þcTitleþ>
parameter is not passed to DC_MsgBox().
Examples:
PROCEDURE Xtest( )
LOCAL oOldAppWin := SetAppWindow(DC_QOUTWINDOW()), cFileName
DC_MSGBOXTITLE('Attention!')
DC_Gui(.f.)
DC_MsgBox( 10,5, { 'You must open a data file first' },,.t. )
SetAppWindow( oOldAppWin )
DC_Gui( .t. )
cFileName := 'JUNK'
IF DC_MsgBox( ,, { 'Delete '+cFileName+'? ' }, ;
'Delete a File',,,.t. )
ERASE (cFileName)
ENDIF
RETURN
Source/Library:
_DCMSG.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_msgbox()
DCMSGBOX
dc_num2bin()
Converts a Decimal number to a Binary String
Syntax:
DC_Bin2Num( < nDecimal > ) - > cBinary
Arguments:
< nDecimal > is a numeric value from 0 to 255.
Returns:
A Binary string from "00000000" to "11111111".
Description:
DC_NUM2BIN() will convert a numeric value to a binary string.
Source/Library:
_DCAND.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_bin2num()
dc_num2word()
dc_num2word()
Convert an integer number to a 2-byte word
Syntax:
DC_Num2Word ( < nInteger > ) - > c2ByteWord
Arguments:
< nInteger > is any integer number.
Returns:
A 2-character string.
Description:
DC_NUM2WORD() is used to convert an integer to a 2-byte word.
Examples:
The following example shows how to use DC_NUM2WORD() and
DC_WORD2NUM() to save numeric values to a file and restore
them.
FUNCTION savenumbers ( aNumbers )
// aNumbers := { 10, 45, 134, 678, 3, 200 }
nHandle := fcreate( 'numbers.bin' )
for i := 1 to len(aNumbers)
fwrite( nHandle, DC_NUM2WORD( aNumbers[i] )
next
fclose( nHandle )
return
FUNCTION restnumbers
local nHandle := fopen( 'numbers.bin' )
local aNumbers := {}
aadd( aNumbers, DC_WORD2NUM( freadstr( nHandle, 2 ) ) )
fclose( nHandle )
return aNumbers
Source/Library:
_DCNUM.PRG, DCLIP2.DLL
See Also:
dc_word2num()
dc_numincr()
Increment a numeric value within a string
Syntax:
DC_NumIncr ( < cString >, ;
[< cLoVal >], ;
[< cHiVal >] ) - > cNewString
Arguments:
< cString > is a character string.
< cLoVal > and < cHiVal > are optional parameters for setting a
low
and high value. If the number increments past < cHiVal > it will
automatically be set to < cLoVal >.
Returns:
A string containing the new value.
Description:
DC_NUMINCR() is used to increment the last numeric portion of
a string. This function is handy for incrementing serial
numbers, coded strings, etc.
Examples:
// print 100 serial number labels
cSerial := 'DON-4567-A'
set print on
for i := 1 to 100
? ' '+cSerial
?
?
cSerial := DC_NUMINCR( cSerial )
next
set print off
Source/Library:
_DCNUM.PRG, DCLIP2.DLL
dc_object2js()
Convert an object to JSON
Syntax:
DC_Object2Js( < oObject > ) - > cJson
Arguments:
< oObject > is any Xbase++ object.
Returns:
A character string.
Description:
DC_Object2Js() converts an Xbase++ object to JSON (Javascript
Object Notation). Only the iVars of the object will be included.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_array2js()
dc_array2xml()
dc_object2xml()
dc_object2xml()
Convert an object to XML
Syntax:
DC_Object2Xml( < oObject > ) - > cXML
Arguments:
< oObject > is an Xbase++ object. Only iVars are included in the XML.
Returns:
A character string.
Description:
DC_Object2Xml() is used to convert an Xbase++ object to an XML
string.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_array2xml()
dc_array2js()
dc_object2js()
dc_objload()
Dynamically load an Xbase++ compiled .OBJ for execution
Syntax:
DC_ObjLoad ( < cObjName >, ;
[< bcRunProc >] ) - > lStatus
Arguments:
< cObjName > is the name of the .OBJ file to link. If no drive/
directory is included in the file name, then the .OBJ must
exist in the directory specified by the SET ODIR command, ODIR=
in DCLIP.SYS, or DC_SETT('ODIR',< path >).
If a < bcRunProc > argument is passed, the < bcRunProc >
procedure or
function will be automatically executed. This may be the name
of a procedure or function in quotes or a code block.
Returns:
A logical .TRUE. if the .OBJ file could be linked into a .DLL
and the .DLL loaded for execution, .FALSE. otherwise.
Description:
DC_OBJLOAD() is used to "dynamic-link" an Xbase++-compiled .OBJ
file into memory for execution of any functions within the
compiled .OBJ. This is done by creating a temporary .DLL with
the same name as the .OBJ file and loading the .DLL.
Examples:
-- Example 1 --
do while .t.
@ 10,10 prompt "Calculator"
@ 11,10 prompt "Calendar"
@ 12,10 prompt "Note Book"
menu to nChoice
do case
case nChoice = 1
DC_OBJLOAD( "calc", "pop_calc(.t.)" )
case nChoice = 2
DC_OBJLOAD( "calendar", "time_chart()" )
case nChoice = 3
DC_OBJLOAD( "notebook", "notebook()" )
endcase
enddo
-- Example 2 --
accept "enter a function to execute" to cFunction
cObjName := dc_objfind( cFunction )
DC_OBJLOAD( cObjName )
dc_do( cFunction )
Source/Library:
_DCLINK.PRG
See Also:
dc_compile()
dc_objpublic()
List .OBJ(s) that contain public function
Syntax:
DC_ObjPublic( [< cProc >], ;
[< lDisplayWindow >], ;
[< lListAll >] ) - > acObjName
Arguments:
< cProc > is the name of the procedure/function to find.
If this argument is empty, a GUI dialog will be displayed to
prompt the user for a procedure name.
< lDisplayWindow > if .TRUE. (default) will display a window
with the results.
< lListAll > if .TRUE. (default) will list all occurrences.
Returns:
A single dimensional array containing the names of all the
.OBJs that contain the function/procedure.
Description:
DC_ObjPublic() is used to scan a set of .OBJ files and list
the names of all .OBJs that contain a PUBLIC declaration of
a specified function.
A file named DCPUBLIC.TXT will be created using the Xbase++
XPPFILT.EXE utility program. This file will contain a listing
of all public functions in all .OBJs.
Notes:
All .OBJs in the search directory(s) established by the
SET ODIR (eXPress++) environment variable. If this environment
variable is empty, then the search path is established by the
operating system SET OBJ environment variable.
Examples:
. aProcs := DC_ObjPublic('MAIN')
. ? aProcs
{ TEST.OBJ, TEST2.OBJ, JUNK.OBJ }
Source/Library:
_DCOFIND.PRG, DCLIP2.DLL
See Also:
WHERE PUBLIC
dc_objsource()
dc_objsource()
Get the source code name from an .OBJ file
Syntax:
DC_ObjSource( < cObjFile > ) - > cSourceFile
Arguments:
< cObjFile > is the name of the XPP-Compiled .OBJ file.
Returns:
A character string.
Description:
DC_ObjSource() is used to extract the full path name of the
original source code from an .OBJ file.
Notes:
This function assumes that the source file has the same name
as the obj file except with the .PRG extension. This function
is needed when it is not known which directory the source
resides.
Examples:
. ? DC_ObjSource('C:\OBJS\BROWSE.OBJ')
C:\SOURCE\BROWSE.PRG
Source/Library:
_DCOFIND.PRG, DCLIP2.DLL
See Also:
WHERE SOURCE
dc_objpublic()
dc_objsourcelist()
Display a list of .OBJ/.PRG files containing PUBLIC proc
Syntax:
DC_ObjSourceList( < cProc > ) - > lStatus
Arguments:
< cProc > is the name of the PUBLIC procedure to find.
Returns:
A logical .TRUE. if a list was displayed, .FALSE. otherwise.
Description:
DC_ObjSourceList() is used to display a list of .OBJ files
and the location of the original source that contain a
specified PUBLIC procedure.
Notes:
This function assumes that the source file has the same name
as the obj file except with the .PRG extension. This function
is needed when it is not known which directory the source
resides.
Examples:
. DC_ObjSourceList('main')
Source/Library:
_DCOFIND.PRG, DCLIP2.DLL
See Also:
WHERE SOURCE
dc_objsource()
dc_odblock()
Get a Progress indicator code block to pass to dbeval()
Syntax:
DC_OdBlock ( [< bWhileCondition >], ;
[< bForCondition >], ;
[< nNext >], ;
[< nStep >], ;
[< cMessage >], ;
[< lForExit >], ;
[< lWait >], ;
[< nRecords >], ;
[< lRest >], ;
[< cTitle >] ) - > bProgress
Arguments:
< bWhileCondition > is the same code block that would be passed
to dbeval() as the WHILE condition.
< bForCondition > is a code block which will be evaluated for
each record. If the code block evaluates .TRUE. then the tally
count in the progress indicator will be incremented by 1.
< nNext > is the number of records.
< nStep > is an optional parameter which is used to specify how
often the odometer function will be called. < nStep > is a
numeric value representing the number of records that will be
processed before the odometer function will be called.
Increasing the < nStep > number will improve speed performance,
however the progress indicator resolution will be lowered.
< cMessage > is the the message to be displayed in the progress
box. For example, if you are deleting records, then the message
may be "deleted", or if you are copying records the message may
be "copied".
< lForExit > if .TRUE. will display the progress indicator until
the < bForCondition > evaluates .TRUE. Use this option when
performing an operation such as a LOCATE, where the FOR
condition terminates the operation as soon as it evaluates
.TRUE.
< lWait > if .TRUE. will leave the odometer status on the screen
after all records are evaluated until a key is pressed.
Default is .FALSE.
< nRecords > is used only when working with an index that contains
a subset of the total records in the database. An example would
be using a filter on the database, a conditional index, or
features like SCOPETOP and SCOPEBOTTOM. If your RDD supports
a function that returns the amount of keys in the index then
use this value, otherwise you may need to calculate the value.
If no argument is given or the value of < nRecords > doesn't
exactly match the number of valid records in the database then
the progress indicator may not be accurate when reporting
percentage.
< lRest > should be the same value as the < lRest > parameter
in
your DBEVAL() function that uses DC_ODBLOCK().
< cTitle > is the title you wish to appear at the top of the
progress window.
Returns:
A code block that usess the DC_ODOMETER() function.
Description:
DC_ODBLOCK() returns a code-block that is a substitute for the
WHILE condition code block that is used with database functions
such as DBEVAL().
Use DC_ODBLOCK() to install a progress odometer to your
database operations that perform tasks on multiple records,
such as indexing, deleting, copying, recalling, etc.
The code block returned by DC_ODBLOCK() uses the DC_ODOMETER()
function to display the progress indicator. This odometer also
checks the keyboard after each record and will abort the
operation if the ESCape key is pressed.
Examples:
lOdometer := .t.
cFor := space(40)
@ 10,10 say "Enter FOR condition " get cFor
@ 11,10 say "Do you want a progress odometer? " get lOdometer
bFor := {||&cFor}
if lOdometer
bWhile := DC_ODBLOCK( ,bFor,,,"Deleted",,.t.,,,;
'Deleting Records' )
else
bWhile := { || .t. }
endif
dbeval( { || dbDelete() }, bFor, bWhile )
Source/Library:
_DCODD.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_odometer()
dc_progress()
dc_working()
dc_odometer()
Display a progress indicator for database/index operations
Syntax:
DC_Odometer ( < bForCondition >, ;
< nStep >, ;
< cMessage >, ;
< lForExit >, ;
< lWait > ) - > lStatus
Arguments:
< bForCondition > is a code block which will be evaluated for
each record. If the code block evaluates .TRUE. then the tally
count in the progress indicator will be incremented by 1.
< nStep > is an optional parameter which is used to specify how
often the odometer function will be called. < nStep > is a
numeric value representing the number of records that will be
processed before the odometer function will be called.
Increasing the < nStep > number will improve speed performance,
however the progress indicator resolution will be lowered.
< cMessage > is the the message to be displayed in the progress
box. For example, if you are deleting records, then the message
may be "deleted", or if you are copying records the message may
be "copied".
< lForExit > if .TRUE. will display the progress indicator until
the < bForCondition > evaluates .TRUE. Use this option when
performing an operation such as a LOCATE, where the FOR
condition terminates the operation as soon as it evaluates
.TRUE.
< lWait > if .TRUE. will leave the odometer status on the screen
after all records are evaluated until a key is pressed.
Default is .FALSE.
Returns:
A logical .T. until the end-of-file is reached or until the
ESCape key is pressed.
Description:
DC_ODOMETER() displays a progress indicator odometer for
database operations that perform tasks on multiple records,
such as indexing, deleting, copying, recalling, etc.
The code block returned by DC_ODBLOCK() uses the DC_ODOMETER()
function to display the progress indicator. This odometer also
checks the keyboard after each record and will abort the
operation if the ESCape key is pressed.
Notes:
Use DC_ODACTIVE(.t.) before calling your database function
that invokes DC_ODOMETER() followed by DC_ODACTIVE(.f.) when
the operation is completed.
DC_ODOMETER() requires that a value for all parameters is
passed, no NIL arguments allowed. Parameter validation is
not included in this function to improve speed.
Examples:
lOdometer := .t.
cFor := space(40)
@ 10,10 say "Enter FOR condition " get cFor
@ 11,10 say "Do you want a progress odometer? " get lOdometer
bFor := {||&cFor}
if lOdometer
bWhile := { || DC_ODOMETER( bFor,1,"Deleted",.f.,.t. ) }
else
bWhile := { || .t. }
endif
dbeval( { || dbDelete() }, bFor, bWhile )
Source/Library:
_DCODD.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_odpercent()
dc_odblock()
dc_progress()
dc_working()
dc_odpercent()
Set numeric value for progress indicator percentage of update
Syntax:
DC_OdPercent ( < nPercent > ) - > nil
Arguments:
< nPercent > is a numeric value for the percentage of update
you want on the progress odometer. If you have very large
files and want to see progress more often, then it is
recommended you lower this number from the default of 5
percent.
Description:
DC_ODPERCENT() sets how often to update the progress
indicator odometer when using DC_ODOMETER() or
DC_ODBLOCK().
Examples:
DC_ODPERCENT( 1 ) // 1 percent
index on cust_nmbr to custnmbr
Source/Library:
_DCODD.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_odometer()
dc_odblock()
dc_openindex()
Open a set of index files
Syntax:
DC_OpenIndex ( [< cDirectory >], ;
[< cCombName >], ;
< aTagInfo >, ;
[< lCombined >], ;
[< lCreate >], ;
[< lNoProgress >], ;
[< cTitle >] ) - > lStatus
Arguments:
< cDirectory > is the directory to search for the index. If no
parameter is passed then the current SET_DEFAULT followed by
SET_PATH will be searched.
< cCombName > is the name of a "combined index" file name to
create if < lCombined > is .TRUE. and if the current DBE supports
combined indexes. If the current DBE does not support combined
indexes, then these parameters are ignored.
< aTagInfo > is a multi-dimensional array containing the
information about each index to open (or create if it does not
exist). Each sub-array consists of 6 elements:
Element Type Description
------- ---- ----------------------------------------------
[1] C FileName of Index (ignored if combined index)
[2] C Tag Name
[3] C Index Key expression
[4] C "For" condition expression
[5] L .True. if index is UNIQUE, .False. otherwise
[6] L .True. if index is DESCENDING, .False.
otherwise
[7] C Description of this index
< lCombined > if .TRUE. designates that the index is a combined
index containing multiple tags.
< lCreate > if .TRUE. will re-create the indexes even if they
already exist. If .FALSE. (default) then the indexes will
be created only if they don't exist.
< lNoProgress > if .TRUE. will not display the progress bar
while indexing. If .FALSE. (default) then a progress bar
is displayed showing the percentage of progress during the
index creation. Some data drivers (i.e. DBFNTX) create
larger index files when a progress bar is displayed
via the EVAL option. The progress bar may also slow the
indexing by approximately 20%.
< cTitle > is the title of the progress bar dialog window.
Returns:
A logical .TRUE. if the index(es) were opened successfully,
.FALSE. otherwise.
Description:
DC_OPENINDEX() is used to open a set of index files. It
allows for designing of an application that is easily
configurable to any database driver by simply setting the
DBE before starting the application. If index files are
opened via DC_OPENINDEX(), they will be created if they don't
already exist using the current DBE.
Examples:
// In this example, if the DBFNTX driver is active then three
// index files named DCHELP1.NTX, DCHELP2.NTX and DCHELP3.NTX
// will be created. If the DBFCDX driver is active then 1
// combined index named DCHELP.CDX will be created with 3
// tags: COMMAND, SORT and CATEGORY. In either case,
// SET ORDER TO 1,2 or 3 will select the same index.
DC_OPENINDEX( , 'DCHELP',;
{{ 'DCHELP1','COMMAND','COMMAND',,.t. }, ;
{ 'DCHELP2','SORT','SORT+COMMAND'}, ;
{ 'DCHELP3','CATEGORY','CATEGORY+COMMAND'} }, .t. )
Source/Library:
_DCDBIND.PRG, DCLIP1.DLL
See Also:
dc_dbfile()
dc_usearea()
dc_pack()
Pack the current database
Syntax:
DC_Pack ( [< lUserPrompt >], ;
[< cPackMethod >] ) - > lStatus
Arguments:
< lUserPrompt > if .TRUE. will prompt the user to continue or
abort the packing process, if .FALSE. the pack will be
performed with no user input.
< cPackMethod > is a single character designating the type
of pack to perform.
cPackMethod
-----------
"F" - Fast (default)
"S" - Slow (removes dead-space from memo file)
Returns:
A logical .TRUE. if the database was successfully packed,
.FALSE. otherwise.
Description:
DC_PACK() is a high-level function that will pack the database
in the currently selected work area. This function does not
use the Clipper dbPack() function but instead packs the file as
follows:
1. Displays a progress odometer during the packing process.
2. Optimizes size of memo fields (removes dead space).
3. Creates a backup file.
Examples:
do while .t.
@ 10,10 prompt "open a database"
@ 11,10 prompt "browse database"
@ 12,10 prompt "pack database"
menu to nChoice
do case
case nChoice = 1
dc_dbfopen()
case nChoice = 2
dc_browsedb()
case nChoice = 3
DC_PACK()
endcase
enddo
Source/Library:
_DCDBPK.PRG, DCLIP1.DLL
dc_parent()
Get the Alias name of the Parent database
Syntax:
DC_Parent ( [< lSelect >] ) - > cAlias
Arguments:
< lSelect > if .TRUE. will also select the parent database's
work area. .FALSE. is the default.
Returns:
A character string.
Description:
DC_PARENT() is used to determine the alias name of a database
that is that has a parent to child relationship to the
currently selected database.
If there is no parent to child relationship, a null string
will be returned.
Examples:
. USE invoices INDEX invcust
. USE customer NEW
. SET RELATION TO cust_nmbr INTO invoice
. SELECT invoice
. ? DC_PARENT()
CUSTOMER
Source/Library:
_DCPAREN.PRG
See Also:
dc_parentval()
dc_parentval()
Get the Alias name of the Parent database
Syntax:
DC_ParentVal ( [@< cParentName >], ;
[@< cRelExpr >] ) - > xValue
Arguments:
@< cParentName > is the name of a variable to store the name of
the parent alias.
@< cRelExpr > is the name of a varialbe to store the relational
expression.
Returns:
A value equivalent to the relational expression based on the
currently selected record of the Parent Database.
Description:
DC_PARENTVAL() is used to get the value of the parent to
child relational data that is being used to make the
relation.
Examples:
. USE invoices INDEX invcust
. USE customer NEW
. SET RELATION TO cust_nmbr INTO invoice
. SKIP 10
. ? cust_nmbr
23876
. SELECT invoice
. ? DC_PARENTVAL()
23876
Source/Library:
_DCPAREN.PRG
See Also:
dc_parent()
dc_path()
Return the path or file name from a file specification string
Syntax:
DC_Path ( < cFileSpec >, ;
[< lFileName >] ) - > cPath / cFileName
Arguments:
< cFileSpec > is a string containing a directory and file name.
< lFileName > if .False. (default) will return the path from the
string. If .True. then the file name will be returned.
Returns:
A character string.
Description:
DC_PATH() is used to extract only the drive and directory name
or the file name from a string that contains both.
Examples:
set default to g:\customer\data
use customer
cFileSpec := dc_dbfname()
? cFileSpec
G:\CUSTOMER\DATA\CUSTOMER.DBF
? DC_PATH(cFileSpec)
G:\CUSTOMER\DATA\
? DC_PATH(cFileSpec,.t.)
CUSTOMER.DBF
Source/Library:
_DCPATH.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_ispath()
dc_pathfound()
dc_pathfound()
Return the directory name in which a file is found
Syntax:
DC_PathFound ( < cFileName > ) - > cDirectory
Arguments:
< cFileName > is the name of the file to find.
Returns:
A character string.
Description:
DC_PATHFOUND() will search the directory designated as the SET
DEFAULT directory, then all the directories in the SET PATH
directory path to see if a file exists and return the first
directory name in which the file is found. This function is a
companion to the FILE(), FOPEN(), DBUSEAREA(), DBSETINDEX()
functions or any other functions in which the directories are
searched in the above order. This function is handy when it is
necessary to know in which directory a file is found.
Examples:
SET DEFAULT TO \customer\data
SET PATH TO \mytools;\dclip
? DC_PATHFOUND('CUSTOMER.DBF')
\customer\data\
? DC_PATHFOUND('MYTOOLS.DBF')
\mytools\
? DC_PATHFOUND('DCPRINT.DBF')
\dclip
Source/Library:
_DCPATH.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_path()
dc_pause()
Pause program execution for a specified amount of time
Syntax:
DC_Pause ( < nSeconds >, ;
< lAbort > ) - > nil
Arguments:
< nSeconds > is the amount of time to pause.
< lAbort > if .TRUE. will abort the pause if any key is
pressed or if a mouse button is pressed. If .FALSE.
(default), then the pause will continue regardless of
the keyboard or mouse activity.
Returns:
nil
Description:
DC_PAUSE() is used add a delay to the program by using the
SECONDS() function in a loop. The processor will continue to
service all other threads during the pause.
Examples:
PROCEDURE Xtest( )
LOCAL nStartTime, nEndTime, cScrn
DC_Gui(.t.)
cScrn := DC_WaitOn()
nStartTime := Seconds()
DC_PAUSE( 2.5 ) // Pause 2.5 seconds
nEndTime := Seconds()
DC_Impl(cScrn)
DC_MsgBox('Elapsed time is ' + Str(nEndTime-nStartTime))
RETURN
Source/Library:
_DCPAUSE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_wait()
dc_pickcase()
A function that replaces CASE..ENDCASE statements
Syntax:
DC_PickCase ( < xValue >, ;
< cOperator >, ;
< aValues >, ;
< aReturn > ) - > xValue
Arguments:
< xValue > is any value of the same TYPE as the values in
< aValues >. For example, if < aValues > is a set of
character
strings, then < xValue > must be a character string.
< cOperator > is the operator to use when performing the CASE
evaluation. Only the following operators are valid:
Operator Description
-------- --------------------------
= Equal to
== Exactly equal to
> Greater than
< Less than
>= Greater than or Equal to
< = Less than or Equal to
< > Not Equal to
$ Contains
< aValues > is an array of values to match to < xValue > based
on < cOperator >. The position in the array (element number) of
the first CASE that matches will become a pointer the the
value in < aReturns > to return.
< aReturn > is an array of the same length as < aValues >.
This
array may contain data elements of any type.
Returns:
An element from <þaReturnsþ>.
Description:
DC_PICKCASE() is a handy function that can be used as a
replacement for DO CASE.. CASE.. ENDCASE statements in your
code. Sometimes it is necessary to replace a set of commands
with a simple function.
For example this code:
nInkey := INKEY(0)
DO CASE
CASE nInkey = K_ALT_A
bBlock := {||AddRecord()}
CASE nInkey = K_ALT_B
bBlock := {||DelRecord()}
CASE nInkey = K_ALT_E
bBlock := {||EditRecord()}
ENDCASE
Eval(bBlock)
can be replaced by this code:
nInkey := INKEY(0)
bBlock := ;
DC_PICKCASE( nInkey, '=', { K_ALT_A, K_ALT_B, K_ALT_E },;
{ {||AddRecord()}, {||DelRecord()}, {||EditRecord()} } )
Eval(bBlock)
Examples:
aArray1 := { 1000000, 100000, 10000, 1000, 100, 10 }
aArray2 := { 1, 2, 3, 4, 5, 6 }
? DC_PICKCASE( 500000, '>=', aArray1, aArray2 )
2
Source/Library:
_DCEVAL.PRG/.OBJ, DCLIPX.LIB
dc_pointerarrow()
Set the mouse pointer to an arrow
Syntax:
DC_SetPointerArrow ( < oXbp > ) - > nil
Arguments:
< oXbp > is the parent object. For example, to insure that the
mouse pointer will be changed for all child objects in the current
application window, < oXbp > would be SetAppWindow().
Returns:
Nil.
Description:
DC_POINTERARROW() is used to change the mouse pointer to an
an arrow for all objects in an object tree. This
function walks down the :ChildList() tree and sets the mouse
pointer on all children of the specified object.
Use this function to set a the pointer to an arrow after
previously setting it to an hourglass style pointer when
performing operations that create a busy state.
Examples:
#include "dcdialog.ch"
#include "dccursor.ch"
PROCEDURE Xtest()
LOCAL GetList := {}, oDlg, GetOptions
@ 1,1 DCSAY "Please wait while packing file..." SAYSIZE 40,2 ;
FONT 'Helv.24.Bold'
DCGETOPTIONS ;
NOMINBUTTON ;
NOMAXBUTTON
DCREAD GUI FIT EXIT OPTIONS GetOptions PARENT @oDlg
DC_PointerWait( oDlg )
DC_Pause(5)
DC_PointerArrow( oDlg )
oDlg:Destroy()
RETURN
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_setpointertree()
dc_pointerwait()
dc_pointerwait()
Set the mouse pointer to an hourglass
Syntax:
DC_SetPointerTree ( < oXbp > ) - > nil
Arguments:
< oXbp > is the parent object. For example, to insure that the
mouse pointer will be changed for all child objects in the current
application window, < oXbp > would be SetAppWindow().
Returns:
Nil.
Description:
DC_POINTERWAIT() is used to change the mouse pointer to an
hourglass (wait) for all objects in an object tree. This
function walks down the :ChildList() tree and sets the mouse
pointer on all children of the specified object.
Use this function to set an hourglass style pointer when
performing operations that create a busy state.
Examples:
#include "dcdialog.ch"
#include "dccursor.ch"
PROCEDURE Xtest()
LOCAL GetList := {}, oDlg, GetOptions
@ 1,1 DCSAY "Please wait while packing file..." SAYSIZE 40,2 ;
FONT 'Helv.24.Bold'
DCGETOPTIONS ;
NOMINBUTTON ;
NOMAXBUTTON
DCREAD GUI FIT EXIT OPTIONS GetOptions PARENT @oDlg
DC_PointerWait( oDlg )
DC_Pause(5)
oDlg:Destroy()
RETURN
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_setpointertree()
dc_pointerarrow()
dc_popcalc()
A popup, full-function calculator
Syntax:
DC_PopCalc( [< nValue >], ;
[< nStRow >], ;
[< nStCol >], ;
[< cTitle >],;
[< @lOK >], ;
[< lModal >], ;
[< bHelp >], ;
[< lInteger >]) - > nValue
Arguments:
< nValue > is the starting value to place in the accumulator.
If no value is passed then the STATIC value stored in memory
will be the default.
< nStRow > and < nStCol > are the start display coordinates.
If
no values are passed then the calendar will be displayed
relative to the current cursor position (in TEXT mode)
or in the center of the screen (in GUI mode). These coordinates
are text-based coordinates based on a home position of 0,0.
In GUI mode they are automatically converted to GUI-based
coordinates.
@< lOk > is a logical variable, passed by reference. If the user
exits with an ABORT or ESCAPE, the variable will contain a
.FALSE., otherwise it will contain a .TRUE.
< cTitle > is the title in the titlebar area of the calculator.
< lModal > if .TRUE. (default) will make the dialog window modal,
otherwise it will be modeless.
< bHelp > is a code block that is evaluated when the user presses
the F1 key or clicks on the HELP button.
< lInteger > if .TRUE. will display the calculator accumulator without
decimals.
Returns:
The value of the calculator accumulator (numeric).
Description:
DC_POPCALC() is a calculator that can be called from Xbase++
code or in a code-block via the POPUP clause in the DCSAY..GET
command. This is a Dual-Mode function that is displayed as
a TEXT-mode calculator when TEXT mode is invoked via DC_GUI(.f.)
or as a GUI-mode calculator when GUI mode is invoked via
DC_GUI(.t.)
Examples:
#include "dcdialog.ch"
FUNCTION XTest()
LOCAL GetList := {}, nNumber := 1234.56, oMsgBox
DC_GUI(.t.)
@ 1,1 DCSAY 'Enter Number' GET nNumber ;
POPUP {|n|DC_PopCalc(n)} ;
MESSAGE 'Click on arrow for a calculator' ;
INTO oMsgBox
@ 3,1 DCMESSAGEBOX OBJECT oMsgBox SIZE 30
DCREAD GUI FIT ADDBUTTONS
RETURN nil
Source/Library:
_DCCALC.PRG/.OBJ, DCLIPX.DLL
See Also:
dc_guipopcalc()
dc_popcolor()
A pop-up dialog for selecting Colors
Syntax:
DC_PopColor( [< acColor >], ;
[< nMode >], ;
[< lRGB >], ;
[< cTitle >], ;
[< lSafe >], ;
[< lModal >], ;
[< oParent >] ) - > acColor
Arguments:
< acColor > is the default color or code block to return if the
operator aborts the dialog.
< nMode > is used to select a dialog mode and the type of value
to return.
If < nMode > is 0, then DC_PopColor() is used to choose a
foreground and background color and return the choice as an
array of two numeric values.
If < nMode > is 1, then DC_PopColor() is used to choose a
foreground and background color and return the choice as a
character string in the form of a code block that can be macro
compiled and evaluated to return the 2-element array. This is
handy for data-driven applications where the color must be stored
as a string.
If < nMode > is 2, then DC_PopColor() is used to choose a single
color and return the choice as a numeric value.
< lRGB > if .TRUE. will popup a color palette of RGB colors and
return the values as a RGB color. The default is .FALSE.
< cTitle > is the title of the color dialog window.
< lSafe > if .TRUE. will present only 216 colors to choose from.
This is the color-safe palette used in Web applications and
Citrix / Terminal Server clients that choose only 256 colors.
Default is .FALSE. (16 million colors).
< lModal > if .TRUE. makes the dialog modal. Default is .FALSE.
< oParent > is the parent of the window. Default is AppDeskTop().
Note: do not pass a parent if using the < lModal > clause.
Returns:
An array of numeric values.
Description:
DC_POPCOLOR() is a Color Choosing Dialog that can be called
from Xbase++ code or in a code-block via the POPUP clause in
the DCSAY..GET command.
Examples:
#include "dcdialog.ch"
FUNCTION XTest()
LOCAL GetList := {}, cColor := Space(50), oMsgBox
@ 1,1 DCSAY 'Enter a Color Code Block' GET cColor ;
POPUP {|c|DC_PopColor(c,0,.f.)} ;
MESSAGE 'Click on arrow for a Color Picker' ;
INTO oMsgBox
@ 3,1 DCMESSAGEBOX OBJECT oMsgBox SIZE 30
DCREAD GUI FIT ADDBUTTONS
RETURN cColor
Source/Library:
_DCCOLOR.PRG/.OBJ, DCLIPX.DLL
See Also:
dc_presedit()
dc_popdate()
A pop-up calendar for selecting a date
Syntax:
DC_PopDate( [< dCurDate >],;
[< nStRow >], ;
[< nStCol >], ;
[@< lOk >], ;
[< cTitle >], ;
[< lModal >], ;
[< nStyle >], ;
[< bHelp >], ;
[< lHide >], ;
[< lInstall >], ;
[@< oDialog >], ;
[@< aGetList >], ;
[< bIsHoliday >], ;
[< aColors >] ) - > dDate
Arguments:
< dCurDate > is the starting date to highlight in the calendar.
If no value is passed then the current system date will be
the default.
< nStRow > and < nStCol > are the start display coordinates.
If
no values are passed then the calendar will be displayed
relative to the current cursor position (in TEXT mode)
or in the center of the screen (in GUI mode). These coordinates
are text-based coordinates based on a home position of 0,0.
In GUI mode they are automatically converted to GUI-based
coordinates.
@< lOk > is a logical variable (passed by reference). This variable
will receive a .TRUE. if the user clicks on OK, double-clicks
on a date. or presses ENTER. It will receive a .FALSE. if the
use clicks on ABORT or presses ESCape.
< cTitle > is the title in the Dialog Window.
< lModal > if .TRUE. (default) will make the dialog window modal,
otherwise it will be modeless.
< nStyle > is used to determine the style of the popup calendar.
This parameter is ignored in non-GUI mode.
< nStyle > Description
--------- ------------------------------------------------
1 Large Calendar (original version)
2 Small Calendar (with fancy buttons)
3 Reserved.
4 Small Calendar (without fancy buttons)
< bHelp > is a code block that is evaluated when the user presses
the F1 key.
If < lHide > is .TRUE., the calendar dialog is not destroyed when
exited. Instead it is hidden until DC_PopDate() is called again.
This provides the benefit of displaying the calendar instantly
after the first call to DC_PopDate(). The small calendar takes
longer to create because there are many more objects required
to handle the fancy buttons. The default is .FALSE.
< lInstall > is used only with the < lHide > parameter. It
should
be passed as .TRUE. and used only once at the beginning of the
program in the main thread. It installs the calendar as a
hidden calendar under the main thread to prevent lockups caused
by creating the hidden calendar in a different thread that is
later terminated.
@< oDialog > is a variable, passed by reference, to store a pointer
to the dialog window created by DC_PopDate(). This variable is
ignored if < nStyle > is 1 or < lHide > is .FALSE.
@< aGetList > is a variable, passed by reference, to store a
pointer to to GetList array used to create the calendar dialog.
This variable is ignored if < nStyle > is 1 or < lHide > is
.FALSE.
< bIsHoliday > is a code block to evaluate to determine if a date
is a holiday. This code block is called before painting each
date on the calendar. The date is passed to the code block and
the code block must return a logical .T. if the date is a holiday
or a .F. if it is not a holiday. Dates which are holidays are
displayed in the "holiday" color defined in the < aColors > array.
NOTE: this feature is available only in the "small calendar" -
style 2.
< aColors > is an array of 4 colors. Each element of the array is
a 2-element array containing a foreground and a background color
for the four different calendar colors. See the below table.
Array Element Description
------------- -------------------------------------------
[1] Normal Color
[2] Today Color (Today's date)
[3] Passed-In Date Color
[4] Holiday Color
Example:
aColors := { ;
{ GRA_CLR_BLACK, GRA_CLR_WHITE }, ; // normal color
{ GRA_CLR_BLUE, GRA_CLR_WHITE }, ; // today color
{ GRA_CLR_RED, GRA_CLR_WHITE }, ; // passed date color
{ GRA_CLR_GREEN, GRA_CLR_WHITE }, ; // holiday color
}
Returns:
The date selected.
Description:
DC_POPDATE() is a calendar that can be called from Xbase++
code or in a code-block via the POPUP clause in the DCSAY..GET
command. This is a Dual-Mode function that is displayed as
a TEXT-mode calendar when TEXT mode is invoked via DC_GUI(.f.)
or as a GUI-mode calendar when GUI mode is invoked via DC_GUI(.t.).
Examples:
#include "dcdialog.ch"
FUNCTION XTest()
LOCAL GetList := {}, dDate := Date(), oMsgBox
DC_GUI(.t.)
@ 1,1 DCSAY 'Enter Date' GET dDate ;
POPUP {|d|DC_PopDate(d,,,,,,3)} ;
MESSAGE 'Click on arrow for a calendar' ;
INTO oMsgBox
@ 3,1 DCMESSAGEBOX OBJECT oMsgBox SIZE 30
DCREAD GUI FIT ADDBUTTONS
RETURN nil
* ------------ Display Holidays ------------- *
FUNCTION XTest2()
LOCAL dDate := Date()+2, cTitle, lModal, bIsHoliday, nStyle, aColors
cTitle := 'Pick a Holiday'
bIsHoliday := {|d,x|x:=Dow(d)==1,x}
lModal := .T.
nStyle := 2
aColors := { ;
{ GRA_CLR_BLACK, GRA_CLR_WHITE }, ; // normal color
{ GRA_CLR_BLUE, GRA_CLR_WHITE }, ; // today color
{ GRA_CLR_RED, GRA_CLR_WHITE }, ; // passed date color
{ GRA_CLR_GREEN, GRA_CLR_WHITE }, ; // holiday color
}
DC_PopDate( dDate,,,,cTitle,lModal,nStyle,,,,,, ;
bIsHoliday, aColors )
RETURN nil
Source/Library:
_DCCALEN.PRG/.OBJ, DCLIPX.DLL
See Also:
dc_guipopdate()
dc_popdatestart()
Select Monday or Sunday as start of week
Syntax:
DC_PopDateStart( [< lMonday >] )
Arguments:
< lMonday > if .TRUE. will set the start of the week as Monday.
If .FALSE. (default), the start of the week will be Sunday.
Returns:
The previous setting (a logical value).
Description:
DC_POPDATESTART() is used to set Sunday or Monday as the start
of the week when displaying the calendar with DC_POPDATE() or
DC_GUIPOPDATE().
Source/Library:
_DCCALEN.PRG/.OBJ, DCLIPX.DLL
See Also:
dc_guipopdate()
dc_popdate()
dc_popdateweek()
Set the suffix to use when displaying the calendar week
Syntax:
DC_PopDateWeek( [< cSuffix >] ) - > cOldSuffix
Arguments:
< cSuffix > is the suffix to display. If no week number is to be
displayed then use "".
Returns:
A Character string.
Description:
DC_PopDateWeek() is used to enable the display of the manufacturing
week in the calendar.
Examples:
DC_PopDateWeek('Wk') will display the week number with the
suffix "Wk".
Source/Library:
_DCCALEN.PRG/.OBJ, DCLIPX.DLL
See Also:
dc_guipopdate()
dc_popdate()
dc_popdir()
A dialog for choosing a directory
Syntax:
DC_PopDir ([< cDirectory >], ;
[< cAvailDrives >], ;
[< cExcludeDrives >], ;
[< cWildCard >] ) - > cDirectory
Arguments:
< cDirectory > is the name of the default directory. If this
argument is not passed, then the current directory is default.
< cAvailDrives > is a character string containing the letters of
all drives which are available for browsing. For example the
string "CDEHIJK" will allow only these drives to be accessed.
The default is all mapped drives.
< cExcludeDrives > is a character string containing the letters of
all drives which are excluded from browsing. For example the
string "AB" will prevent the floppy drives (A and B) from
being accessed. The default is no excluded drives.
< cWildCard > is a wildcard template for files to include in the
files panel.
Returns:
When the file dialog is closed with the "OK" pushbutton, this
function returns the selected directory. If it is closed with
the "CANCEL" button, then the passed directory is returned.
Description:
DC_POPDIR() is a directory picker that can be called from Xbase++
code or in a code-block via the POPUP clause in the DCSAY..GET
command.
Examples:
#include "dcdialog.ch"
FUNCTION XTest()
LOCAL GetList := {}, cDirectory := Space(60), oMsgBox
DC_GUI(.t.)
@ 1,1 DCSAY 'Enter Directory' GET cDirectory ;
POPUP {|c|DC_PopDir(c)} ;
MESSAGE 'Click on button for directory picker dialog' ;
INTO oMsgBox
@ 3,1 DCMESSAGEBOX OBJECT oMsgBox SIZE 30
DCREAD GUI FIT ADDBUTTONS
RETURN nil
Source/Library:
_DCFUNCT.PRG/.OBJ, DCLIPX.DLL
See Also:
dc_popfile()
@ DCDIRTREE
dc_popfile()
A dialog for choosing a file
Syntax:
DC_PopFile([< cFileName >], ;
[< cDirectory >], ;
[< cWildCard >]. ;
[< cTitle >], ;
[< aFileFilters >], ;
[< lSaveAs >], ;
[< lRestoreDir >], ;
[< lMultiple >], ;
[< oParent >], ;
[< oOwner >] ) - > cFileName
Arguments:
< cFileName > is the starting file name to select in the file
dialog window. If no value is passed then a choice of files in
the current directory will be the default.
< cDirectory > is the name of the default directory. If this
argument is not passed, then the current directory is default.
< cWildCard > is a wildcard string for the type of files to
display in the dialog window. The default is '*.*' (all files).
< cTitle > is the title of the dialog window.
< aFileFilters > optionally defines filters that are used to
show or hide certain files within the dialog. This is
similar to using wildcards with Shell commands and affects
the range of files selectable by the user. The format of
the array for defining file filters is as follows:
aFileFilters := { {< cFilterName1 >, < cExprList1 >},
{< cFilterName2 >, < cExprList2 >},
...,
{< cFilterNameN >, < cExprListN >} }
< cFilterName > can be an arbitrary string that defines the
name of the filter in human-readable form. < cExprList >
is a string that defines one or more filter expressions
that a file must match in order to be included in the file list if the filter
is active. If more than one filter expression is to be defined, individual
expressions must be separated by a semicolon (;). Filter expressions may
contain the asterisk (*) wildcard character but no spaces.
If :fileFilters contains the empty array ({}), no file
filters are defined. This is equivalent to the filter
expression "*.*" (include all files).
Example:
aFileFilters := { {"Xbase++ Sources", "*.PRG;*.CH"}, ;
{"All Files" , "*.*" } }
This filter definition would cause the file dialog to
display two entries in its list of file filters.
electing the entry "Xbase++ Sources" would include all
.PRG- and .CH-files in the current directory in the list
of files the user can select from. Files not matching
the filter pattern would not be selectable. If the filter
"All Files" is activated, the file dialog would display
all files in the current folder.
< lSaveAs > should be a .T. when a user needs to save a file
(or save it under a different name).
< lRestoreDir > if .TRUE. (default) will restore the system
directory setting.
< lMultiple > if .TRUE. will allow the user to select more than
one file in the file dialog. It will return a list of files
selected by the user.
< oParent > is the optional parent of the dialog. If no parent
is given then the parent is the AppDeskTop().
< oOwner > is the optional owner of the dialog. If no owner
is given then the owner is the parent.
Returns:
When the file dialog is closed with the "OK" pushbutton, this
function returns the entire file name as a character string
including the drive and directory. If the dialog is not closed
using the "OK" pushbutton, the return value is the value
passed as <þcDefaultFileþ>.
Description:
DC_POPFILE() is a file picker that can be called from Xbase++
code or in a code-block via the POPUP clause in the DCSAY..GET
command.
Examples:
#include "dcdialog.ch"
FUNCTION XTest()
LOCAL GetList := {}, cFileName := Space(60), oMsgBox
DC_GUI(.t.)
@ 1,1 DCSAY 'Enter BitMap File Name' GET cFileName ;
POPUP {|c|DC_PopFile(c,'\bitmaps\','*.BMP')} ;
MESSAGE 'Click on button for file dialog' ;
INTO oMsgBox
@ 3,1 DCMESSAGEBOX OBJECT oMsgBox SIZE 30
DCREAD GUI FIT ADDBUTTONS
RETURN nil
Source/Library:
_DCFUNCT.PRG/.OBJ, DCLIPX.DLL
See Also:
dc_popdir()
dc_popfont()
A pop-up dialog for selecting a Font name
Syntax:
DC_PopFont( [< cFont >] - > cNewFont
Arguments:
< cFont > is the starting font to highlight in the font dialog
window. If no value is passed then the first font will be
the default.
Returns:
The Compound Name of the font selected (a character string).
Description:
DC_POPFONT() is a Font Dialog that can be called from Xbase++
code or in a code-block via the POPUP clause in the DCSAY..GET
command.
Examples:
#include "dcdialog.ch"
FUNCTION XTest()
LOCAL GetList := {}, cFont := Space(50), oMsgBox
@ 1,1 DCSAY 'Enter Font Name' GET cFont ;
POPUP {|c|DC_PopFont(c)} ;
MESSAGE 'Click on arrow for a Font Picker' ;
INTO oMsgBox
@ 3,1 DCMESSAGEBOX OBJECT oMsgBox SIZE 30
DCREAD GUI FIT ADDBUTTONS
RETURN cFont
Source/Library:
_DCFONT.PRG/.OBJ, DCLIPX.DLL
See Also:
dc_presedit()
dc_poppresalign()
A popup dialog for selection Presentation Alignment
Syntax:
DC_PopPresAlign( [< nAlign >] ) - > nAlign
Arguments:
< nAlign > is a numeric value containing the alignment options.
Returns:
A numeric value.
Description:
DC_POPPRESALIGN() is a popup editor that can be used to
edit Presentation Parameters that affect alignment. This function
can be called from Xbase++ code or in a code-block via the
POPUP clause in the DCSAY..GET command.
The following Xbase++ Presentation Parameters are used to
define the layout of a dialog item:
XBP_PP_ALIGNMENT - Generic Alignment
XBP_PP_COL_DA_CELLALIGNMENT - Browse Cell Alignment
XBP_PP_COL_HA_ALIGNMENT - Browse Header Alignment
XBP_PP_COL_FA_ALIGNMENT - Browse Footer Alignment
A numeric value is assigned to each of these PP items to
establish the alignment options. This numeric value is a bitwise
summation of options. DC_PopPresAlign() reads the numeric
value and separates the options, allowing each one to be selected
individually by GUI dialog checkboxes, then it combines them
back into a numeric value to be used with the associated PP.
Examples:
#include 'xbp.ch'
nAlign := XBPALIGN_LEFT + XBPALIGN_BOTTOM
nAlign := DC_PopPresAlign( nAlign )
aPres := { { XBP_PP_COL_FA_ALIGNMENT, nAlign } }
Source/Library:
_DCPRES.PRG, DCLIPX.DLL
See Also:
dc_presedit()
dc_poppresborder()
A popup dialog for selection Presentation Border
Syntax:
DC_PopPresBorder( [< nBorder >] ) - > nBorder
Arguments:
< nBorder > is a numeric value containing the Border option.
Returns:
A numeric value.
Description:
DC_POPPRESBORDER() is a popup editor that can be used to edit
Presentation Parameters that affect a border. This function
can be called from Xbase++ code or in a code-block via the
POPUP clause in the DCSAY..GET command.
XbpDialog() and XbpCrt() classes provide the option of selecting
a border by assigning a numeric value to the :border iVar.
A numeric value is assigned to the iVar to establish the
border of the window. DC_PopPresBorder() reads the numeric
value and allows a new value to be selected via GUI Radio Buttons.
Examples:
#include 'xbp.ch'
nBorder := XBPDLG_RAISEDBORDERTHICK_FIXED
nBorder := DC_PopPresBorder( nBorder )
oDialog:border = nBorder
Source/Library:
_DCPRES.PRG, DCLIPX.DLL
See Also:
dc_presedit()
dc_poppreslayout()
A popup dialog for selection Presentation Layout
Syntax:
DC_PopPresLayout( [< nLayout >] ) - > nLayout
Arguments:
< nLayout > is a numeric value containing the layout options.
Returns:
A numeric value.
Description:
DC_POPPRESLAYOUT() is a popup editor that can be used to
edit Presentation Parameters that affect layout. This function
can be called from Xbase++ code or in a code-block via the
POPUP clause in the DCSAY..GET command.
The following Xbase++ Presentation Parameters are used to
define the layout of a dialog item:
XBP_PP_COL_DA_FRAMELAYOUT - Browse Data Frame Layout
XBP_PP_COL_DA_CELLFRAMELAYOUT - Browse Cell Frame Layout
XBP_PP_COL_DA_HILITEFRAMELAYOUT - Browse Hilite Frame Layout
XBP_PP_COL_HA_FRAMELAYOUT - Browse Header Frame Layout
XBP_PP_COL_FA_FRAMELAYOUT - Browse Footer Frame Layout
A numeric value is assigned to each of these PP items to
establish the frame layout. This numeric value is a bitwise
summation of options. DC_PopPresLayout() reads the numeric
value and separates the options, allowing each one to be selected
individually by GUI dialog checkboxes, then it combines them
back into a numeric value to be used with the associated PP.
Examples:
#include 'xbp.ch'
nLayout := XBPFRAME_BOX + XBPFRAME_RECESSED
nLayout := DC_PopPresLayout( nLayout )
aPres := { { XBP_PP_COL_DA_FRAMELAYOUT, nLayout } }
Source/Library:
_DCPRES.PRG, DCLIPX.DLL
See Also:
dc_presedit()
dc_poppressep()
A popup dialog for selection Presentation Separator
Syntax:
DC_PopPresSep( [< nSep >] ) - > nSep
Arguments:
< nSep > is a numeric value containing the separator option.
Returns:
A numeric value.
Description:
DC_POPPRESSEP() is a popup editor that can be used to edit
Presentation Parameters that affect separators. This function
can be called from Xbase++ code or in a code-block via the
POPUP clause in the DCSAY..GET command.
The following Xbase++ Presentation Parameters are used to
define the separators of a dialog item:
XBP_PP_COL_DA_ROWSEPARATOR - Browse Data Row separator
XBP_PP_COL_DA_COLSEPARATOR - Browse Data Column separator
A numeric value is assigned to each of these PP items to
establish the separator type. DC_PopPresSep() reads the
numeric value and allows a new value to be selected via
GUI Radio Buttons.
Examples:
#include 'xbp.ch'
nSep := XBPCOL_SEP_DASHED
nSep := DC_PopPresSep( nSep )
aPres := { { XBP_PP_COL_DA_COLSEPARATOR, nSep } }
Source/Library:
_DCPRES.PRG, DCLIPX.DLL
See Also:
dc_presedit()
dc_popscrn()
Restore a screen area from the screen stack
Syntax:
DC_PopScrn( < aScrnStack > ) - > aScrnStack
Arguments:
< aScrnStack > is an array that contains screens created by
DC_PUSHSCRN().
Returns:
An array containing the new contents of the screen stack.
Description:
DC_POPSCRN() is used to restore the screen from the screen
contents that was pushed onto the stack with DC_PUSHSCREEN().
Examples:
aStack := {}
aStack := dc_pushscrn(aStack) // save current screen
cls // clear the screen
aStack := dc_pushscrn(aStack,4,10,8,70,.T.,,,,;
' Enter a Command ',10)
cCommand := space(50)
@ 6,12 get cCommand
read
aStack := DC_POPSCRN(aStack)
aStack := DC_POPSCRN(aStack)
Source/Library:
_DCEXPL.PRG/.OBJ, DCLIPX.LIB
dc_poptime()
A pop-up browse for selecting a time
Syntax:
DC_PopTime( [< cCurTime >],;
[< nMinuteIncrement >] ) - > cTime
Arguments:
< cCurTime > is the starting time to highlight in the picker.
< nMinuteIncrement > is the number of minute increments to display in
the
picker. The default is 5 minutes.
Returns:
A Character String - the time selected.
Description:
DC_PopTime() is a time picker that can be called from Xbase++
code or in a code-block via the POPUP clause in the DCSAY..GET
command.
Examples:
#include "dcdialog.ch"
FUNCTION XTest()
LOCAL GetList := {}, cTime := Space(5), oMsgBox
@ 1,1 DCSAY 'Enter Time for this appointment' GET cTime ;
POPUP {|c|DC_PopTime(c,15)} ;
MESSAGE 'Click on arrow for a time picker' ;
INTO oMsgBox
@ 3,1 DCMESSAGEBOX OBJECT oMsgBox SIZE 30
DCREAD GUI FIT ADDBUTTONS
RETURN nil
Source/Library:
_DCCALEN.PRG/.OBJ, DCLIPX.DLL
See Also:
dc_popdate()
dc_popupbuttonstyle()
Get or Set the default style for DCGET popup buttons
Syntax:
DC_PopupButtonStyle( [< oConfig >] ) - > oOldConfig
Arguments:
< oConfig > is an object of the DC_XbpPushButtonXPConfig() class.
Description:
DC_PopupButtonStyle() is a Get-Set function that is used
to Set or Get the default configuration object for popup
pushbuttons that are automatically added to DCGET objects
via the POPUP clause of @ DCSAY..GET.
Examples:
oConfig := DC_XbpPushButtonXPConfig():new()
oConfig:radius := 5
oConfig:bgColor := GRA_CLR_CYAN
DC_PopupButtonStyle( oConfig )
Source/Library:
_dcxbutt.prg, dclipx.dll
See Also:
dc_xbppushbuttonxpconfig()
dc_presadd()
Add Presentation Parameters to a PP Array
Syntax:
DC_PresAdd( < aPP >, ;
< aItem > ) - > aNewPP
Arguments:
< aPP > is a Presentation Parameters array that conforms to the
standard Xbase++ specification for Presentation Parameters.
< aItem > is a 2-element array that conforms to the standard
Xbase++ specification for individual items in a Presentation
Parameters array.
Returns:
An Array.
Description:
DC_PresAdd() is used to add a presentation parameter to a
Presentation Parameters array. It will first test to see if
parameter already being added already exists in the array and
if it does it will overwrite it with the new value.
Examples:
aItem := { XBP_PP_DISABLED_BGCLR, GraMakeRGBColor({20,45,80}) }
aPres := DC_Str2Ar(MYDIALOG->pp) // get PP from a database
aPres := DC_PresAdd( aPres, aItem )
Source/Library:
_DCPRES.PRG, DCLIPX.DLL
See Also:
dc_presedit()
dc_presedit()
A GUI Editor for a Presentation Parameters Array
Syntax:
DC_PresEdit( < aPP > ) - > aNewPP
Arguments:
< aPP > is a Presentation Parameters array that conforms to the
standard Xbase++ specification for Presentation Parameters.
Returns:
An Array.
Description:
DC_PresEdit() is used to edit a Presentation Parameters array.
This array must conform to the standard Xbase++ specifications
for presentation parameters. DC_PresEdit() will display
pushbuttons, picklists and popup windows for selecting colors,
fonts, borders, alignment, etc. and save the selection to
a new array or allow editing of an existing array.
The Editor allows provides for saving the PP to source code
for pasting into application code.
Examples:
aPres := DC_Str2Ar(MYDIALOG->pp) // get PP from a database
aPres := DC_PresEdit( aPres )
MYDIALOG->pp := DC_Ar2Str(aPres) // store PP back to database
Source/Library:
_DCPRES.PRG, DCLIPX.DLL
See Also:
dc_presadd()
dc_browpres()
dc_printbrowse()
Print the contents of a Browse object
Syntax:
DC_PrintBrowse( < oBrowse >, ;
[< aOptions >] ) - > NIL
Arguments:
< oBrowse > is any browse object derived from XbpBrowse().
< aOptions > is an array of print options that conforms to the
array structure created by the DCPRINT OPTIONS command.
Description:
DC_PrintBrowse() will print the contents of any browse object that
has been derived from XbpBrowse() as a WYSIWIG printout.
Examples:
DCPRINT OPTIONS ORIENTATION 2 ACROBAT TO aOptions
DC_PrintBrowse( oBrowse, aOptions )
Source/Library:
_dcprc.prg, dclipx.dll
See Also:
DCPRINT OPTIONS
dc_printclipboard()
Print the contents of the ClipBoard (BitMap Only)
Syntax:
DC_PrintClipBoard( [< lPreview > ] ) - > lStatus
Arguments:
< lPreview > if .TRUE. will preview the contents before allowing
the user to print. If .FALSE. (default), then the output will
go to the printer without previewing.
Returns:
A logical .TRUE. if the contents were previewed or printed, .FALSE.
otherwise.
Description:
DC_PrintClipBoard() will print the contents of the ClipBoard.
Only items of type BITMAP will be printed. This function is
used in conjunction with DC_Scrn2ClipBoard() to print the
contents of a dialog window.
Examples:
DC_Scrn2ClipBoard()
DC_PrintClipBoard(.T.)
Source/Library:
_DCPRC.PRG, DCLIPX.DLL
See Also:
dc_scrn2clipboard()
dc_printercol()
Returns the current Printer Column position
Syntax:
DC_PrinterCol( [< oPrinter >] ) - > nRow
Arguments:
< oPrinter > is the printer object. If no parameter is passed then
the STATIC printer object created by the last DCPRINT ON command
is the default.
Returns:
A numeric value.
Description:
DC_PRINTERCOL() is used as a replacement for PCOL() when using
DCPRINT commands to convert existing text-based reports. This
function makes it easy to convert reports that are heavily-laden
with commands like @ PROW(), PCOL() SAY <þtextþ>.
Examples:
#include "dcprint.ch"
procedure Xtest()
USE COLLECT
DCPRINT ON PREVIEW
DCPRINT EJECT
DO WHILE !Eof()
@ dc_printerrow()+1, 10 DCPRINT SAY COLLECT->descrip
@ dc_printerrow(), DC_PRINTERCOL()+2 DCPRINT SAY COLLECT->type
SKIP
IF dc_printerrow() > 60
DCPRINT EJECT
ENDIF
ENDDO
DCPRINT OFF
RETURN
Source/Library:
_DCPRC.PRG, DCLIPX.LIB
See Also:
dc_printerrow()
DCPRINT ON
dc_printerdialog()
A Printer Dialog for setting up printing options
Syntax:
DC_PrinterDialog ( < aOptions > ) - > aOptions
Arguments:
< aOptions > is an single-dimensional array of printing options.
Element Type Description
--------- ------ -------------------------------------------
1 C Printer Name. If not empty, then the user
will not be allowed to choose the printer.
2 N From (first page #). If not empty, then
the user will not be allowed to choose
the first and last page to print.
3 N To (last page #)
4 N Rows (number of print rows) default is 66.
If not empty, then the user will not be
allowed to choose the number of print rows.
5 N Cols (number of print cols) default is 80.
If not empty, then the user will not be
allowed to choose the number of print
columns.
6 N Copies (number of copies to print) default
is 1. If not empty, then the user will not
be allowed to choose the number of copies.
7 X Spare
8 L Collate (default is .F.)
9 L Print to file (default is .F.)
10 A Paper Size (an array of 6 elements) default
is ::self:PaperSize().
11 C/O Font. May be a character string with a
Font name or a font object. Default is
12.Courier. If not empty, then the user
will not be allowed to choose the font.
12 X Spare
13 L Fixed. If .TRUE. (default), will print each
character in fixed columns (even when using
proportional fonts). IF .FALSE. will print
characters in the same proportion as the
chosen font. If this parameter is passed,
then the user will not be allowed to select
the fixed option.
14 L Pixel. If. .TRUE., then coordinates will be
pixel-based, otherwise they will be text-
based.
15 L Preview. If .TRUE. will cause the printed
output to be sent to the display rather than the
print device. This causes the methods of the
DC_PRINTER() class to write to an XbpDialog() GUI
dialog screen rather than to an XbpPrinter()
object.
16 Reserved.
17 L All Pages. If .TRUE. will default to printing
all pages.
18 Reserved.
19 Reserved.
20 Reserved.
21 Reserved.
22 Reserved.
23 Reserved.
24 Reserved.
25 Reserved.
26 Reserved.
27 Reserved.
28 Reserved.
29 Reserved.
30 L Enable Font Button. When .TRUE. this will
enable the font button for the user to select
a print font.
31 Reserved.
32 N Orientation. 1 = Portrait, 2 = Landscape
33 C Comment (output only) from Printer driver selected
34 C Port (output only) from Printer driver selected.
35 C Status (output only) from Printer driver selected.
36 AN Margin. May be a numeric value (LEFT margin only)
or an array of two numeric values (TOP and LEFT
margins. May be negative and/or decimal values.
37 C Title. This is the title of the preview window
and the document. This title will be sent to the
spooler as the name of the print job.
38 L Stop on Eject. If .TRUE. the print job will stop
when a DCPRINT EJECT command or oPrinter:eject()
method is encountered in the program and the
preview window will be displayed. If .FALSE.
(default) the print job will continue to run and
buffer pages and will not stop until the DCPRINT OFF
command or DC_PrinterOff() function is encountered
in the program.
39 L Hide. A .TRUE. value will hide the previewer window
until the command DCPRINT OFF or the function
DC_PrinterOff() are encountered in the program.
If .FALSE. (default) each page will be visible in
the preview window as they are being created.
40 N PaperBin. Used to instruct the printer which paper
bin to use for the print job. A #define constant
from XBPDEV.CH must be used for this value. Valid
constants have the prefix XBPPRN_PAPERBIN_.
41 N FormSize. Used to instruct the printer what paper
format is being used. Common formats are Letter,
Legal or A4. They are selected by their numeric ID
which is available as a #define constant from
XBPDEV.CH. Valid constants have the prefix
XBPPRN_FORMSIZE_.
42 L PrintButton. A logical .TRUE. (default) will
paint a 'Print' button on the preview window,
thereby enabling the ability to print while
previewing.
43 L EnableCancel. A logical .TRUE. (default) will
display a dialog window during printing that
includes a CANCEL button to cancel the print job.
44 C BusyMessage. A message to display while each
screen is being created. Use this clause if your
application takes a long time to create a screen.
45 L ForceDialog. A logical .TRUE. will force the
Printer dialog window to be display for choosing
a printer and/or options. A .FALSE. (default)
will suppress the display of the printer dialog
if the DEFAULT printer (element 28) is selected
or a PRINTER NAME (element 1) is passed.
46 L AutoEject. If .TRUE. (default) an automatic page
eject will occurs whenever an attempt is made to
print past the last print row defined by the
SIZE < nRows >, < nCols > command or when an
:AtSay()
prints text on a row that is a lower numeric
value than the last row printed.
47 L CopyLoop. Used to disable the sending of the
request to the print driver to print multiple
copies. If the user selects copies from the
print dialog screen the value selected will be
placed in the oPrinter:nCopies variable and the
programmer must used this value in a FOR..NEXT
loop to print multiple copies.
48 N DialogStyle. Allows users of eXPress++ 1.3 and
earlier versions to display the same style
dialog in their 1.5 applications as was displayed
in 1.3. Xbase++ 1.5 introduced a new
XbpPrinterDialog() class which was incorporated
in eXPress++ 1.5. This new dialog is created by
the print driver whereas the old dialog was
created by eXPress++ and also included a FONT
button for selecting a print font. Style
DCPRINT_DIALOG_EXPRESS (defined in DCPRINT.CH)
will display the 1.3 style printer dialog.
Returns:
An array with the same structure as the <þ aOptions þ> array which
is passed as a parameter to DC_PrinterDialog().
Description:
DC_PRINTERDIALOG() is a printer dialog that allows the
user to choose a printer, font, and other print options
when using the DC_PRINTER() class or the DCPRINT commands.
Source/Library:
_DCPRC.PRG/.OBJ, DCLIPX.LIB
See Also:
DCPRINT ON
dc_printername()
Retrieve the last printer name selected by user.
Syntax:
DC_PrinterName() - > cPrinterName
Returns:
A Character string.
Description:
DC_PrinterName() is a Get-Set function used to retrieve the
last printer name selected by the user from the printer dialog.
This function is handy when it is necessary to print a second
print job to the same printer.
Examples:
DCPRINT ON // Users Selects a printer
.. Print some stuff
DCPRINT OFF
DCPRINT ON NAME DC_PrinterName() // Print to last selected printer
.. Print some more stuff
DCPRINT OFF
Source/Library:
_DCPRC.PRG
See Also:
DCPRINT ON
dc_printerobject()
Return a reference to the static printer object
Syntax:
DC_PrinterObject( [< oObject >], ;
[< lPost >] ) - > oPrinter
Arguments:
< oObject > contains a pointer to a printer object to post to the
static variable when < lPost > is .TRUE. This is the object that
will be returned when DC_PRINTEROBJECT() is called with no
parameters.
Returns:
An object.
Description:
DC_PRINTEROBJECT() returns the static printer object created by
the DCPRINT ON command or the DC_Printer() class. In single-
threaded environments, programming reports can be simplified by
eliminating the need to reference the printer object when using
various DCPRINT commands. If the PRINTER <þoPrinterþ> clause is
not used with the commands then the static printer object is
used. The static object is posted to DC_PRINTEROBJECT() when a
new DCPRINT ON command is issued and is set to a NIL when the
DCPRINT OFF command is used.
When programming in a multi-threaded environment, the PRINTER
clause must be used with all DCPRINT commands to insure that the
correct object is referenced.
Source/Library:
_DCPRC.PRG, DCLIPX.LIB
See Also:
dc_printeron()
DCPRINT ON
dc_printeroff()
Destroy a printer object
Syntax:
DC_PrinterOff( [< oPrinter >] ) - > nil
Arguments:
< oPrinter > is the printer object. If no parameter is passed then
the STATIC printer object created by the last DCPRINT ON command
is the default.
Description:
DC_PRINTEROFF() destroys a printer object that was created
with DC_PRINTERON().
Examples:
PROCEDURE Xtest()
LOCAL oPrinter
USE COLLECT NEW SHARED
BEGIN SEQUENCE
oPrinter := dc_printeron()
IF Valtype(oPrinter) # 'O' .OR. !oPrinter:lActive
BREAK
ENDIF
oPrinter:AtSay(24,10,' Description:')
oPrinter:AtSay(25,10,' Type:')
oPrinter:AtSay(26,10,' Sub-Type:')
oPrinter:SetFont('14.Terminal')
oPrinter:AtSay(24,32,COLLECT->descrip)
oPrinter:AtSay(25,32,COLLECT->type)
oPrinter:AtSay(26,32,COLLECT->sub_type)
oPrinter:Eject()
END SEQUENCE
DC_PRINTEROFF()
CLOSE
RETURN
Source/Library:
_DCPRC.PRG, DCLIPX.LIB
See Also:
dc_printeron()
DCPRINT OFF
dc_printerok()
Test whether or not the user aborted the Print process
Syntax:
DC_PrinterOk( [< oPrinter >] ) - > lStatus
Arguments:
< oPrinter > is the printer object. If no parameter is passed then
the STATIC printer object created by the last DCPRINT ON command
is the default.
Returns:
A Logical .FALSE. if the user aborted the print/preview, otherwise
a logical .TRUE.
Description:
DC_PRINTEROK() is used to test whether the user clicked on "Abort"
when printing or previewing a report.
Examples:
#include 'dcprint.ch'
PROCEDURE Xtest( lPreview )
LOCAL nSaveRec
USE COLLECT NEW SHARED
nSaveRec := RecNo()
GO TOP
IF lPreview
DCREPORT FORM collect XBP FONT '10.Courier' ;
TITLEFONT '10.Helv.Bold' HEADFONT '10.Courier.Bold' PREVIEW ;
WHILE {||DC_PRINTEROK()}
ELSE
DCREPORT FORM collect XBP FONT '10.Courier' ;
TITLEFONT '10.Helv.Bold' HEADFONT '10.Courier.Bold' ;
WHILE {||DC_PRINTEROK()}
ENDIF
GO nSaveRec
RETURN
Source/Library:
_DCPRC.PRG, DCLIPX.LIB
See Also:
DCPRINT ON
dc_printeron()
Create a printer class object for @..SAY style printing
Syntax:
DC_PrinterOn( { < cPrinterName >, ;
< nFrom >, ;
< nTo >, ;
< nRows >, ;
< nCols >, ;
< nCopies >, ;
< lSelection >, ;
< lCollate >, ;
< lToFile >, ;
< aPaperSize >, ;
< ocFont >, ;
< oFontDlg >, ;
< lFixed >, ;
< lPixel >, ;
< lPreview >, ;
< aViewPort > } ) - > oPrinter
Arguments:
< aOptions > is an single-dimensional array of printing options.
Element Type Description
--------- ------ -------------------------------------------
1 C < cPrinterName > is the Printer Name. If
empty, then a printer dialog will appear for
the user to select printing options.
2 N < nFrom > is the first page #. If not empty, then
the user will not be allowed to choose
the first and last page to print.
3 N < nTo > is the last page #
4 N < nRows > (number of print rows) default is 66.
If not empty, then the user will not be
allowed to choose the number of print rows.
5 N < nCols > (number of print cols) default is 80.
If not empty, then the user will not be
allowed to choose the number of print
columns.
6 N < nCopies > (number of copies to print) default
is 1. If not empty, then the user will not
be allowed to choose the number of copies.
7 X < lSelection > Spare
8 L < lCollate > is for Collate. (default is .F.)
9 L < lToFile > is Print to file (default is .F.)
10 A < aPaperSize > is the Paper Size (an array of
6 elements) default is ::self:PaperSize().
11 C/O < ocFont > is the Font. May be a character
string with a Font name or a font object.
Default is 12.Courier. If not empty, then
the user will not be allowed to choose the
font.
12 X < oFontDlg > Spare
13 L < lFixed > If .TRUE. (default), will print each
character in fixed columns (even when using
proportional fonts). IF .FALSE. will print
characters in the same proportion as the
chosen font. If this parameter is passed,
then the user will not be allowed to select
the fixed option.
14 L < lPixel > If. .TRUE., then coordinates will be
pixel-based, otherwise they will be text-
15 L < lPreview > If .TRUE. will cause the printed
output to be sent to the display rather than the
print device. This causes the methods of the
DC_PRINTER() class to write to an XbpDialog() GUI
dialog screen rather than to an XbpPrinter()
object.
16 A < aViewPort > A 4 element array defined the
View Port window.
Description:
DC_PRINTERON() creates a printer class which is used to
create reports that use row/column addressing identical to
the @..SAY addressing used by Clipper. This class provides
for an easy migration of existing reports so that they
may use the more powerful features of the Windows print
manager like font selection and selection of a network
printer.
DC_PRINTERON() also posts the printer object to a static
variable which can be accessed at any time via
DC_PRINTEROBJECT().
Examples:
PROCEDURE Xtest()
LOCAL oPrinter
USE COLLECT NEW SHARED
BEGIN SEQUENCE
oPrinter := DC_PRINTERON()
IF Valtype(oPrinter) # 'O' .OR. !oPrinter:lActive
BREAK
ENDIF
oPrinter:AtSay(24,10,' Description:')
oPrinter:AtSay(25,10,' Type:')
oPrinter:AtSay(26,10,' Sub-Type:')
oPrinter:SetFont('14.Terminal')
oPrinter:AtSay(24,32,COLLECT->descrip)
oPrinter:AtSay(25,32,COLLECT->type)
oPrinter:AtSay(26,32,COLLECT->sub_type)
oPrinter:Eject()
END SEQUENCE
dc_printeroff()
CLOSE
RETURN
Source/Library:
_DCPRC.PRG, DCLIPX.LIB
See Also:
DCPRINT ON
dc_printerporttoname()
Returns name of a Printer that is assigned to a specified Port.
Syntax:
DC_PrinterPortToName( < cPort > ) - > cPrinterName
Arguments:
< cPort > is the printer port.
Returns:
A character string.
Description:
DC_PrinterPortToName() is used to return the name of a printer
that is assigned to a specified port.
Examples:
cPrinterName := DC_PrinterPortToName( 'LPT1' )
Source/Library:
_DCPRC.PRG, DCLIPX.DLL
dc_printerrow()
Returns the current Printer Row position
Syntax:
DC_PrinterRow( [< oPrinter >] ) - > nRow
Arguments:
< oPrinter > is the printer object. If no parameter is passed then
the STATIC printer object created by the last DCPRINT ON command
is the default.
Description:
DC_PRINTERROW() is used as a replacement for PROW() when using
DCPRINT commands to convert existing text-based reports. This
function makes it easy to convert reports that are heavily-laden
with commands like @ PROW(), <þcolþ> SAY <þtextþ>.
Examples:
#include "dcprint.ch"
procedure Xtest()
USE COLLECT
DCPRINT ON PREVIEW
DCPRINT EJECT
DO WHILE !Eof()
@ DC_PRINTERROW()+1, 10 DCPRINT SAY COLLECT->descrip
@ DC_PRINTERROW(), dc_printercol()+2 DCPRINT SAY COLLECT->type
SKIP
IF DC_PRINTERROW() > 60
DCPRINT EJECT
ENDIF
ENDDO
DCPRINT OFF
RETURN
Source/Library:
_DCPRG.PRG, DCLIPX.LIB
See Also:
dc_printercol()
DCPRINT ON
dc_printfile()
Print an ASCII file using Windows Print Driver
Syntax:
DC_PrintFile( [< cFileName >], ;
[< lPreview >], ;
[< cFont >], ;
[< aOptions >] ) - > lStatus
Arguments:
< cFileName > is the name of the ASCII file to print. If no
parameter is passed, a dialog window will appear prompting the
user for a file name.
< lPreview > if .TRUE. will display the contents of the file in a
preview window. If .FALSE., a printer selection dialog window
will appear and the output will be sent to the selected printer
device.
< cFont > is a character string that conforms to standard Xbase++
font definitions. The default is '8.Courier New'.
< aOptions > is an options array created with the DCPRINT OPTIONS
command.
Returns:
A Logical .FALSE. if the user aborted the print/preview, otherwise
a logical .TRUE.
Description:
DC_PRINTFILE() is used to print or preview the contents of an
ASCII file. xxxxxx
Examples:
/*
This example uses DC_PrintFile() to simplify the conversion of
old Clipper reports to using the Windows print driver.
*/
cPrintFile := 'REPORT.TXT'
SET PRINTER TO cPrintFile
SET DEVICE TO PRINT
...Clipper printer commands
SET DEVICE TO SCREEN
SET PRINTER TO
DC_PRINTFILE(cPrintFile)
Source/Library:
_DCPRC.PRG, DCLIPX.LIB
See Also:
DCPRINT OPTIONS
dc_printimage()
WYSIWIG print of a selected GUI object
Syntax:
DC_PrintImage( < oXbp >, ;
[< nMode >] ) - > nil
Arguments:
< oXbp > is the object to print.
< nMode > if a 1 (default) will print only the selected object.
< nMode > if a 2 will print all the tabpages within a group,
provided that < oXbp > is an object of the type XbpTabPage.
Returns:
Nil.
Description:
DC_PrintImage() is a WYSIWIG function that prints the screen image
of an object.
Examples:
Run XDEMO.EXE then place the mouse over any object and press
the middle mouse button.
* -----------
STATIC FUNCTION Xdemo_Handler( nEvent, mp1, mp2, oXbp, oDlg, aGetList )
LOCAL oPrintMenu, GetList[0]
IF nEvent == xbeM_MbDown
DCSUBMENU oPrintMenu PARENT oXbp
DCMENUITEM 'Print WYSIWYG (Current Object)' PARENT oPrintMenu ;
ACTION {||DC_PrintImage(oXbp,1)} ;
WHEN {||!oXbp:isDerivedFrom('XbpDialog')}
DCMENUITEM 'Print WYSIWYG (All TabPages)' PARENT oPrintMenu ;
ACTION {||DC_PrintImage(oXbp,2)} ;
WHEN {||oXbp:isDerivedFrom('XbpDialog')}
DCREAD GUI PARENT AppDeskTop() EXIT
oPrintMenu:popup( oXbp, mp1, 1 , XBPMENU_PU_DEFAULT +
XBPMENU_PU_MOUSE_RBDOWN )
RETURN DCGUI_IGNORE
ENDIF
RETURN DC_HelpHandler( nEvent, mp1, mp2, oXbp, oDlg, GetList )
Source/Library:
_DCPRC.PRG, DCLIPX.LIB, DCLIPX.DLL
See Also:
DCPRINT ON
dc_printpreviewacrobat()
A print previewer that uses the Acrobat Reader
Syntax:
DC_PrintPreviewAcrobat( < cPDFName >, ;
[< cTitle >] ) - > nil
Arguments:
< cPDFName > is the name of the Acrobat File (*.PDF format) to
preview.
< cTitle > is the title of the window. If this parameter is
not used, then the file name will be displayed as the
title.
Returns:
Nil
Description:
DC_PrintPreviewAcrobat() is used to display the Acrobat
Reader (Adobe) in a window to be used as the print previewer
for the DCPRINT ON command.
The options for how the preview is to be displayed are
controlled by DC_PrintPreviewAcrobatOpt().
Notes:
To insure that the Acrobat Reader OCX runs correctly, use
the DC_JazzAgeKey() function to post your individual JazzAge
key. If this is not done, then the JazzAge "demonstration"
dialog may be displayed.
Examples:
aOptions := { 2, oDialog:drawingArea, '5' }
DC_PrintPreviewAcrobatOpt( aOptions )
DC_PrintPreviewAcrobat( 'MYREPORT.PDF', 'My Report' )
Source/Library:
_DCPRC.PRG, DCLIPX.DLL
See Also:
dc_printpreviewacrobatopt()
DCPRINT ON
dc_jazzagekey()
dc_printpreviewacrobatopt()
Sets the options for the Acrobat previewer
Syntax:
DC_PrintPreviewAcrobatOpt( [< aOptions >] ) - > aOldOptions
Arguments:
< aOptions > is an array of options:
Element Type Description
------- ---- ----------------------------------------
[1] N Modal State (1 = Modeless, 2 = Modal)
[2] O Parent Window. Default is AppDeskTop()
[3] C Acrobat OCX version. Default is '5'. This is
ignored if element 8 is a value of 3.
[4] B A code block to evaluate before the viewer
window is displayed. Parameters passed to code
block are the XbpDialog() object and the OCX
object.
[5] B A code block to evaluate when the viewer window
is closed. Parameters passed to code block are
the XbpDialog() object and the OCX object.
[6] L Add Ok/Cancel buttons. Default is .T.
[7] C Driver Name. Default is "Win2PDF"
[8] N 1 - Use Acrobat control (default)
2 - Use Universal Web Browser control
3 - Use RunShell() to call Acrobat Reader
NOTE: Using the Universal Web Browser Control will
eliminate a memory leak in the AcroRd32.exe process
that is spawned from the ActiveX control, however
the window closes slower.
[9] C The path to the directory where temporary *.PDF
files are created.
[10] L A logical .TRUE. if the temporary file name is the
same as the title. A logical .FALSE. if the temporary
file name is a cryptic name.
Returns:
An array.
Description:
DC_PrintPreviewAcrobatOpt() is a Get-Set function that is
used to set the options for the preview window displayed by
DC_PrintPreviewAcrobat().
Examples:
aOptions := { 2, oDialog:drawingArea, '5' }
DC_PrintPreviewAcrobatOpt( aOptions )
DC_PrintPreviewAcrobat( 'MYREPORT.PDF', 'My Report' )
Source/Library:
_DCPRC.PRG, DCLIPX.DLL
See Also:
dc_printpreviewacrobat()
DCPRINT ON
dc_printpreviewimagewriteropt(
Sets the options for the Image Writer previewer
Syntax:
DC_PrintPreviewImageWriterOpt( [< aOptions >] ) - > aOldOptions
Arguments:
< aOptions > is an array of options:
Element Type Description
------- ---- ----------------------------------------
[1] C Driver Name.
Default is "Microsoft Office Document Image Writer"
[2] C The path to the directory where temporary *.MDI
files are created.
[3] L A logical .TRUE. if the temporary file name is the
same as the title. A logical .FALSE. if the temporary
file name is a cryptic name.
Returns:
An array.
Description:
DC_PrintPreviewImageWriterOpt() is a Get-Set function that is
used to set the options for the preview window displayed when
using the IMAGEWRITER clause of DCPRINT ON.
Source/Library:
_DCPRC.PRG, DCLIPX.DLL
See Also:
dc_printpreviewacrobatopt()
DCPRINT ON
dc_printpreviewxpswriter()
A print previewer that uses the Microsoft XPS Document Writer
Syntax:
DC_PrintPreviewAcrobat( < cPDFName >, ;
[< cTitle >], ;
[< lNoSpawn >] ) - > nil
Arguments:
< cXPSName > is the name of the XPS Document File (*.XPS format) to
preview.
< cTitle > is the title of the window. If this parameter is
not used, then the file name will be displayed as the
title.
< lNoSpawn > is a logical .TRUE. to supress the spawning of the
printed documented to the XPS viewer at the completion of the
print job. Default is .FALSE.
Returns:
Nil
Description:
DC_PrintPreviewXPSWroter() is used to display the Microsoft
XPS Document Writer in a window to be used as the print previewer
for the DCPRINT ON command.
The options for how the preview is to be displayed are
controlled by DC_PrintPreviewXPSWriterOpt().
Source/Library:
_DCPRC.PRG, DCLIPX.DLL
See Also:
dc_printpreviewxpswriteropt()
DCPRINT ON
dc_printpreviewxpswriteropt()
Sets the options for the XPS Document Writer previewer
Syntax:
DC_PrintPreviewXPSWriterOpt( [< aOptions >] ) - > aOldOptions
Arguments:
< aOptions > is an array of options:
Element Type Description
------- ---- ----------------------------------------
[1] C Driver Name.
Default is "Microsoft XPS Document Writer"
[2] C The path to the directory where temporary *.XPS
files are created.
[3] L A logical .TRUE. if the temporary file name is the
same as the title. A logical .FALSE. if the temporary
file name is a cryptic name.
Returns:
An array.
Description:
DC_PrintPreviewXpsWriterOpt() is a Get-Set function that is
used to set the options for the preview window displayed when
using the XPSWRITER clause of DCPRINT ON.
Source/Library:
_DCPRC.PRG, DCLIPX.DLL
See Also:
dc_printpreviewxpswriter()
DCPRINT ON
dc_progload()
Load a Program from the Program Dictionary to an Array
Syntax:
DC_ProgLoad( [< cProgName >], ;
[< lMessage >], ;
[< lCache >], ;
[@< cProgram >] ) - > aProgram
Arguments:
< cProgName > is the Tag Name of the program in the DCPROG.DBF
Program Catalog file. If no parameter is passed, then a pick-
list of available programs will be displayed.
< lMessage > if .TRUE. (default) will display an error message
if the program could not be found in the DCPROG.DBF
dictionary. If .FALSE., then no message will be displayed.
@< cProgram > is an optional character string (memo text)
containing the program to convert to an array. If the program
is found in the dictionary the text of the program will be
stored in this variable.
< lCache > if .TRUE. (default) will store the output array into
a cache memory for faster loading of the program if it is
called again. If < lCache > is .FALSE. or if DC_MEMCACHE()
is set to 0, then the program will be loaded each time from
the dictionary file.
@< lCompile > is an optional variable that will contain a .TRUE.
if the loaded program is to be compiled and a .FALSE. if the
loaded program is to be interpreted.
Returns:
If the program is to be interpreted, a multi-dimensional array
containing the program commands, compiler pointers, etc. is
returned, otherwise a NIL is returned.
Description:
DC_PROGLOAD() is used to load a program from the DCPROG.DBF
Program Catalog file into an array for later processing with
DC_INTERPRET().
Examples:
-- Example 1 --
/* Program stored in 'TEST' record of DCPROG.DBF :
PARAMETERS a,b,c,d
CLS
USE CUSTOMER
nReceivables := 0
DO WHILE !EOF()
? 'Record',RecNo()
?? FieldGet(a)
?? FieldGet(b)
?? FieldGet(c)
?? FieldGet(d)
IF !EMPTY(phone1)
?? phone1
ELSEIF !EMPTY(phone2)
?? phone2
ENDIF
nReceivables += balance
ENDDO
RETURN nReceivables
*/
aProgram := DC_PROGLOAD('TEST')
nMoneyDue := DC_Interpret( aProgram, { 3, 5, 6, 9 } )
? nMoneyDue
wait
Source/Library:
_DCPROG.PRG
See Also:
dc_interpret()
dc_progmaint()
dc_progmaint()
Maintain the DCPROG.DBF Program Dictionary File
Syntax:
DC_ProgMaint() - > nil
Arguments:
None.
Returns:
Nil.
Description:
DC_PROGMAINT() is used to maintain a database catalog of programs
for later interpreting with DC_PROGRAM(). This system in
intended for creating small programs that may be run from the
dot-prompt, menus, data-entry validations, etc. DC_PROGMAINT()
provides an editor, search routines, print routines, etc.
Programs are saved in a MEMO field in the DCPROG.DBF/.DBT file.
These "interpreted" programs are not intended to replace compiled
code but are instead a handy way of creating additional on-the-fly
functions and procedures to give a data-driven system some extra
convenience and functionality.
Source/Library:
_DCPROG.PRG
See Also:
dc_interpret()
dc_progload()
dc_program()
Run a Program from the Program Dictionary
Syntax:
DC_Program( [< cProgName >], ;
[< aParams >], ;
[< cProgram >], ;
[< lCompile >] ) - > Nil
Arguments:
< cProgName > is the Tag Name of the program in the DCPROG.DBF
Program Catalog file. If no parameter is passed, then a pick-
list of available programs will be displayed. If an array
< aProgram > is passed then it must conform to the structure
of the array returned by DC_PROGLOAD() or interpreted
programs.
< aParams > is a single-dimensional array of parameters to pass
to the program being interpreted. There should be one element
in the array for each parameter included in the PARAMETERS
statement in the interpreted program. If less parameters are
passed than specified in the PARAMETERS statement, the unpassed
parameters will be initialized to NIL.
< cProgram > is an optional character string. If < lCompile >
is
.TRUE. then it must contain the full path name of the program
to compile and run. If < lCompile > is .FALSE. then it must
contain the text of the program to interpret. If this parameter
is passed, then the Program Catalog will not be searched and
< cProgName > will be ignored.
< lCompile > if .TRUE. will compile < cProgram > and load it
for
execution of any functions or procedures contained in < cProgram >.
< lCompile > if .FALSE. (default) will interpret < cProgram >.
Returns:
Nil.
Description:
DC_PROGRAM() is used to load a program from the DCPROG.DBF
program catalog database and execute the program using the
interpreter or runtime compiler. Programs in the dictionary
are pre-designated as "Interpreted" or "Compiled".
Interpreted programs may contain any command that can be
intrepreted at the dot-prompt plus the same type of structural
elements as standard Clipper programs such as DO..WHILE and
FOR..NEXT loops, IF..ELSE, DO..CASE statements, PARAMETERS
statement and RETURN value, however they cannot contain
CLASS statements, FUNCTION statements, LOCALS or STATICS. If
a program is designated to be Interpreted, the program is
passed to the DC_INTERPRET() function.
Compiled programs may contain any type of code that can be
compiled with the XPP.EXE compiler. IF a program is designated
to be Compiled, the program is first compiled by the DC_COMPILE()
function, then loaded into memory with the DC_OBJLOAD() function
and executed.
Source/Library:
_DCPROG.PRG
See Also:
dc_interpret()
dc_progload()
dc_progmaint()
dc_progress()
Display a Progress bar
Syntax:
DC_Progress ( < nMode >, ;
[< nValue >], ;
[< nMaxValue >], ;
[< nStRow >], ;
[< nStCol >], ;
[< nEnCol >], ;
[< lBox >], ;
[< cColors >] ) - > Nil
Arguments:
< nMode > is a number 0,1, or 2 depending on the function
desired:
0 - Initialize Static values and display starting bar
1 - Refresh bar with current value
2 - Terminate and restore screen
< nValue > is the "start" value to evaluate if < nMode > is 0
and
the "current" value to evaluate if < nMode > is 1. This must be
less than or equal to < nMaxValue >. If this parameter is not
passed then a static value will automatically be incremented
by a value of 1.
< nMaxValue > is the maximum numeric value.
< nStRow > is the start display row. This parameter is used
only if < nMode > is 0.
< nStCol > is the start display column. This parameter is used
only if < nMode > is 0.
< nEnCol > is the end display column. This parameter is used
only if < nMode > is 0.
< lBox > if .TRUE. (default) will paint a box around the progress
bar starting at the passed coordinates, otherwise the progress
bar only will be painted starting at the passed coordinates.
< cColors > is a character string containing 2 color specfications
separated by a comma. The first color is the color of the box,
the second is the color of the progress bar. If no parameter
is passed, then the current system color will be used for both
colors.
Returns:
Nil
Description:
DC_PROGRESS() is used to display a progress bar for displaying
the progress of any operation. The progress bar will fill in
the specified area with a graphic progress bar and the text
value in % of the actual progress.
Examples:
? 'Recalling all records'
DC_PROGRESS( 0,,RecCount() )
dbSetOrder(0)
go top
do while !Eof()
DC_PROGRESS( 1, RecNo() )
dbRecall()
SKIP
enddo
DC_PROGRESS( 2 )
Source/Library:
_DCODD2.PRG/.OBJ,DCLIPX.LIB
See Also:
dc_odometer()
dc_odblock()
dc_working()
dc_purge()
Purge duplicate records from a database
Syntax:
DC_Purge ( [< cIndexExpr >], ;
[< cFileName >], ;
[< cRetainExpr >], ;
[< lMax >], ;
[< cFieldName >] ) - > Nil
Arguments:
< cIndexExpr > is an expression of field names to use in determining
how to determine the duplication of records. For example, if
you want to purge records that have duplication of information
in which LAST_NAME, FIRST_NAME and STREET are identical, then
use "UPPER(LAST_NAME+FIRST_NAME+STREET)" as the expression.
If < cIndex > expression is not given then a window will appear
with a user prompt to enter an expression or to press ALT-F for
the index builder. If ALT-F is pressed, a pick-list of fields
will appear to aid in building the expression.
< cFileName > is an optional parameter that is the name of a new
database which will contain the purged records. If no argument
is given, then no database will be created, instead the delete
flag of the purged records will be set.
< cRetainExpr > is an expression that determines which record of
the set of duplicate records to retain (not mark for deletion).
The default is "RECNO()".
< lMax > if .TRUE. will retain the maximum value. If .FALSE.
(default) will retain the minimum value.
< cFieldName > is the name of an optional numeric field in the
database being purged. This field is used to write a number
from 0 to N. If there are no duplicates, then a 0 will be written
to the record. If there ARE duplicates then a 1 will be written
to the RETAINED record and a number from 2 to N will be written to
each duplicate.
Returns:
Nil.
Description:
DC_PURGE() is used to remove records from a database that have
duplicates based on a test of specified fields. The purged
records will be marked as *deleted* but will not actually be
removed from the data file until the file is packed. This will
allow you to BROWSE the file and monitor the purged information
before completing the final reduction.
DC_PURGE() actually creates a temporary index file based on an
expression that is passed or created from the pop-up index
builder.
Purged records can be written to a new data file for recovery
at any time.
Examples:
/* Purge all duplicate records that have an exact match
for Last Name, First Name, Phone Number and Street.
Retain the record that has the latest Mail Date */
. USE MAILLIST
. DC_PURGE("LAST+FIRST+PHONE+STREET",,"MAIL_DATE",.t.)
. dc_browsedb()
. dc_pack()
Source/Library:
_DCPURGE.PRG
dc_pushbuttonstyle()
Get or Set the default style for legacy push buttons
Syntax:
DC_PushButtonStyle( [< oConfig >] ) - > oOldConfig
Arguments:
< oConfig > is an object of the DC_XbpPushButtonXPConfig() class.
Description:
DC_PushButtonStyle() is a Get-Set function that is used
to Set or Get the default configuration object for "legacy"
pushbuttons.
Legacy pushbuttons are pushbuttons that were created with the
@ DCPUSHBUTTON or DCADDBUTTON commands. The objects created
from the commands are derived from the XbpPushButton class and
have the basic look of windows pushbuttons.
The DC_XbpPushButtonXP class is also derived from the
XbpPushButton class however it used the OWNERDRAW capability of
the class and therefore supports a much richer and visually
appealling class of pushbuttons.
DC_PushButtonStyle() is used to automatically convert all
buttons created by the legacy commands to using the new class
and thereby giving legacy applications a new look with a very
minor code addition to the beginning of the application.
Examples:
oConfig := DC_XbpPushButtonXPConfig():new()
oConfig:radius := 20
oConfig:bgColor := GRA_CLR_CYAN
DC_PushButtonStyle( oConfig )
Source/Library:
_dcxbutt.prg, dclipx.dll
See Also:
@ DCPUSHBUTTON
DCADDBUTTON
@ DCPUSHBUTTONXP
dc_xbppushbuttonxpconfig()
dc_putkey()
Stuff any keyboard value into Keyboard Buffer
Syntax:
DC_PutKey ( < nKey > | < cKey > | < aKeys > ) - >
nil
Arguments:
< nKey > is the INKEY() value of the key to stuff in the
keyboard buffer. This must be a value between -39
and 320.
< cKey > is a character string value to stuff in the keyboard
buffer.
< aKeys > is a single dimensional array consisting of elements
that are single characters or Inkey() values or both.
Returns:
nil
Description:
DC_PUTKEY() will stuff any INKEY() value into the keyboard
buffer, including function keys, ALT-<þnþ> keys, etc.
DC_PUTKEY() functions similar to the KEYBOARD command except
that only one key may be stuffed per call and the keyboard
buffer is not cleared.
Examples:
-- Example 1 --
#include 'inkey.ch'
DC_PUTKEY( K_ESC )
-- Example 2 --
// Add a set of keys to keyboard buffer
DC_PutKey( { K_ALT_F, K_F10, K_ALT_K } )
-- Example 3 --
// Stuff a character string in the keyboard buffer
DC_Putkey( 'USE JUNK' + CHR(13) )
Source/Library:
_DCPUTK.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_mousekey()
dc_qout()
Send data to the default CRT window
Syntax:
DC_QOut ( [< xText >] ) - > nil
Arguments:
< xText > is any variable.
Returns:
An array of information about the screen object that is used
with DC_Say(), DC_Cls() and DC_Impl().
Description:
DC_QOUT() and DC_QQOUT() are used to send data to the default
CRT window when debugging GUI applications. The CRT window is
used with the DC_QOUT() function to echo any information. Using
the ? command or Qout() function will cause an error if
SetAppWindow() is not set to an XbpCrt() object. This makes it
very difficult to use ? or Qout() inside GUI applications where
SetAppWindow() is pointing to a GUI object like an XbpDialog().
Examples:
DC_QOUTWINDOW()
DC_QOUT( "This is a test" )
Source/Library:
_DCQOUT.PRG/.OBJ, DCLIPX.LIB
See Also:
DCQOUT
dc_qoutwindow()
dc_qoutwindow()
Establish or Create a CRT window for debugging GUI apps
Syntax:
DC_QOutWindow ( [< oCrt >], ;
[< bEval >], ;
[< lAppWindow >] ) - > oOldCrtWindow
Arguments:
< oCrt > is a pointer to an existing XbpCrt() object to post
as the object for DCQOUT commands. If no argument is passed
then a new XbpCrt() object will be created.
< bEval > is a code block to evaluate after the XbpCrt() window
is created. The Crt object is passed to the code block.
< lAppWindow > if .TRUE. will set the Crt object as the
application window with SetAppWindow().
Returns:
An array of information about the screen object that is used
with DC_Say(), DC_Cls() and DC_Impl().
Description:
DC_QOUTWINDOW() is used to Create a CRT window for debugging
GUI applications. The CRT window is used with the DC_Qout()
function and DCQOUT command to echo any information. Using the
? command or Qout() function will cause an error if SetAppWindow()
is not set to an XbpCrt() object. This makes it very difficult
to use ? or Qout() inside GUI applications where SetAppWindow()
is pointing to a GUI object like an XbpDialog().
Examples:
DC_QOUTWINDOW()
DCQOUT "This is a test"
Source/Library:
_DCQOUT.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_qout()
DCQOUT
dc_random()
Return a random number between 0 and 255
Syntax:
DC_Random ( [< nMax >] ) - > nNumber
Arguments:
< nMax > is a value of the maximum number size to return.
If no parameter is passed then the maximum size will
be 255. If a number greater than 255 is passed then
the maximum size will still be 255.
Returns:
A numeric value.
Description:
DC_RANDOM() is used to generate a random number from 0 to 255.
Examples:
. ? DC_RANDOM()
137
. ? DC_RANDOM(10)
6
Source/Library:
_DCSCRNS.PRG, DCLIP2.DLL
dc_rddsel()
Select a database driver
Syntax:
DC_RddSel( [< cDbe >], ;
[< lSet >] ) - > cDbe
Arguments:
< cDbe > is the database driver to select.
< lSet > if .TRUE. will load and set the selected driver as the
default. The default is .FALSE.
Returns:
A Character string containing the name of the selected database
driver.
Description:
DC_RddSel() is used to select a database driver (DBE) from a
picklist of available drivers.
Examples:
. ? DC_RddSel() // return the name of selected driver
. DC_RddSel( nil, .t. ) // select a driver from pick list.
Source/Library:
_dcrdd.prg
dc_readalt()
Establish alternate usage of Ctrl-END in table of Gets
Syntax:
DC_ReadAlt ( [< lMode >] ) - > lMode
Arguments:
< lMode > if .TRUE. will Set the alternate mode. The default
is .FALSE.
Returns:
The current mode.
Description:
DC_READALT() provides an alternate usage of K_CTRL_END and
K_CTRL_W in a table of GETS when using DC_READMODAL().
This function is used to set the Read mode to cause K_CTRL_END
and K_CTRL_W to go to the last GET. The default condition is
that K_CTRL_END and K_CTRL_W will terminate the read.
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readnav()
dc_readapick()
Pops up array pick-list if GET not valid or double-clicked
Syntax:
DC_ReadAPick ( < xGetValue >, ;
< aPickList >|< bPickList >, ;
[< nStRow >], ;
[< nStCol >], ;
[< nEnRow >], ;
[< nEnCol >], ;
[< lAccept >], ;
[< lStringList >], ;
[< nSubList >], ;
[< lAddToGet >] ) - > lValid
Arguments:
< xGetValue > is the current value in the GET variable.
< aPickList > is an array of valid values for < getvar >.
If this is a single-dimensional array, then the array
items will be displayed in the pick-list. If it's a
multi-dimensional array, then the first element of each
item will be used for the validation, the second element
of each item will be displayed in the pick-list, and the
third (optional) element is a HELP CODE (character string)
which will be passed on to the DC_HelpF1() function to
display context-specific help if the F1 key is pressed on
a selected item in the picklist. < aPickList > may also be
passed as a code-block that returns an array when evaluated.
< aPickList > may be passed as an array of arrays with a
pointer to which sub-array to use as the pick-list via
< nSubList >. See below.
< nStRow >, < nStCol >, < nEnRow >, < nEnCol >
are the screen
coordinates to display the picklist. If no coordinates
are passed, then the pick-list will be displayed just
to the right of the current GET location.
< lAccept > if .TRUE. will exit the GET if the operator
selects an item from the pick-list. If .FALSE. (default),
then the value will be returned into the GET and the cursor
will remain in the GET.
< lScanExact > if .TRUE. (default) will scan the < aValues >
array for an "exact" match to the passed value. IF .FALSE.,
then the standard string-match method will be used.
< lStringList > if .TRUE. will assume that the value in the
GET is a list of characters, and the < aValues > array
contains a single character for each item. This method is
used to pick one or more items from the the list and add
the item to the value in the GET. If .FALSE. (default)
then the value of the GET will be replaced by the selected
item.
< nSubList > is used to choose a sub-array from < aValues > if
< aValues > is an array of arrays rather than a single-
dimensional array. If < nSubList > is a 0 or is not passed
then it is assumed that < aValues > is a single-dimensional
array.
< lAddToGet > if .TRUE. will append the selected value to the
current value(s) in the GET. If .FALSE. (default), then
the GET contents will be replaced by the selected value.
Returns:
A .TRUE. if the value entered for <þgetvarþ> is valid,
.FALSE. otherwise.
Description:
DC_READAPICK() is used to validate the value in a GET based
on a passed array and pop-up a pick-list if the input is
not valid. DC_READAPICK() should be used as a VALID
function in a GET statement. The pick-list will be displayed
whenever the input is not valid or when the mouse is double-
clicked.
Notes:
This function will work properly only when used with
DC_READMODAL().
If you want an array picklist with multiple columns
use DC_READDPICK().
Examples:
-- Example 1 --
// Let's say that the only valid entries in the field
// "nTimeIncr" are 5, 10, 15, 30, and 60. You would use
// DC_READAPICK() as follows:
GetList := {}
@ 10,10 SAY 'Enter Time Increment ' GET nTimeIncr VALID ;
DC_READAPICK( nTimeIncr, { 5,10,15,30,60 } ) PICKLIST
dc_ReadModal( GetList )
-- Example 2 --
// Let's say that the only valid entries in the field
// "nWeek" are 1,2 or 3. You would use DC_READAPICK() as
// follows:
GetList := {}
@ 10,10 SAY 'Enter Week ' GET nWeek VALID ;
DC_READAPICK( nWeek, ;
{ { 1,'First' },{ 2,'Second' },{ 3,'Third' } } ) ;
PICKLIST
dc_ReadModal( GetList )
-- Example 3 --
// You want to choose from a list of single-character
// options and add each selected option to the GET.
GetList := {}
@ 10,10 SAY 'Enter Option List ' GET cList VALID ;
DC_READAPICK( cList, ;
{ { 'P','Protect' }, {'L','Log'},{'S','Save'} }, ;
10,40,20,75,,,.t. )
Source/Library:
_DCACHOI.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readdpick()
dc_achoice()
dc_dbchoice()
dc_readbox()
Create a modal dialog box and Mouse Buttons for DC_ReadModal()
Syntax:
DC_ReadBox ( < nStRow >, ;
< nEnRow >, ;
< nStCol >, ;
< nEnCol >, ;
[< cTitle >], ;
@< aActiveArea >, ;
[< aHotKeys >] ) - > cSaveScreen
Arguments:
< nStRow >, < nStCol >, < nEnRow >, < nEnCol >
are the active
coordinates of the modal dialogue box.
< cTitle > is the title of the box.
@< aActiveArea > is the name of the variable to store the array
created by DC_READBOX() which will later be passed to
DC_ReadModal().
< aHotKeys > is a multi-dimensional array of hotkeys. The
information in this array will be used to paint mouse buttons
on the perimeter of the box to pass-on a portion of this
information to DC_ReadModal(). If no array is passed then the
following default array will be created:
< aHotKeys[1] > :
{ {'[Ý]',K_ESC,< nStCol >+2 } }
< aHotKeys[2] > :
{ {'[F10:Save]',K_F10,< nStCol >+2} ;
{'[ESC:Cancel]',K_ESC,< nStCol >+15},;
{'[F1:Help]',K_F1,< nStCol >+30} }
< aHotKeys[1] > is an array of buttons to place on the top of
the dialogue box.
< aHotKeys[2] > is an array of buttons to place on the bottom of
the dialogue box.
Returns:
A character string that is a "composite" of the coordinates,
colors, etc. to be used later to restore the screen with
DC_IMPL().
Description:
DC_READBOX() which is used to explode an area of the screen
and create an array of mouse buttons to draw on the perimeter
of the box and to pass on to DC_ReadModal(). This functions
works identical to DC_EXPL() except it also adds the following
mouse buttons of the perimeter of the box:
[þ] - Stuffs ESCape (27 )key
[F10:Save] - Stuffs F-10 (-9) key
[ESC:Cancel] - Stuffs ESCape (27) key
[F1:Help] - Stuffs F-1 (28) key
DC_READBOX() also stores the coordinates of the box interior
to a static array which is later monitored by DC_GETDEVOUT(),
DC_GETDISPLAY(), and DC_READMODAL() to prevent @SAY..GETS
from being displayed outside the window region. Such GETS
will be added to the Get List but will only be accessible
when the Get List is "scrolled" by bumping against the
scroll boundaries with a cursor key.
Examples:
LOCAL GetList := {}, aReadArea, cSaveScreen
cSaveScreen := DC_READBOX( 10, 10, 19, 70,, @aReadArea )
@ 12,15 say 'Customer Number ' GET cust_nmbr
@ 13,15 say ' Customer Name ' GET cust_name
@ 14,15 say ' Street ' GET street
@ 15,15 say ' City ' GET city
@ 16,15 say ' State ' GET state
@ 17,15 say ' Zip ' GET zip
DC_ReadModal( GetList, 2, aReadArea )
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readcapfirst()
Capitalize all first letters of all words in all GETs
Syntax:
DC_ReadCapFirst ( < lMode > ) - > lStatus
Arguments:
< lMode > if .TRUE. will set the "CapFirst" flag. From then
on all GETs read by DC_READMODAL() will automatically
capitalize the first letter of each new word when typed
into a GET. If .FALSE. will reset the "CapFirst" flag.
Returns:
A logical value whic is the last setting of the "CapFirst"
flag.
Description:
DC_READCAPFIRST() is used to automatically capitalize the
first letter of each new word when typed into all GETs.
If you wish to CapFirst only a "specified" GET, then use
the CAPFIRST command in the @SAY..GET command line and
the #include "dcget.ch" statement.
Examples:
-- Example 1 --
local cCustName, cAddress, GetList:={}
store cust_name to cCustName
store address to cAddress
DC_READCAPFIRST(.t.)
@ 10,10 say 'Customer Name ' get cCustName
@ 11,10 say 'Street Address ' get cAddress
dc_readmodal( GetList )
DC_READCAPFIRST(.f.)
-- Example 2 --
local cCustName, cAddress, GetList:={}
store cust_name to cCustName
store address to cAddress
@ 01,10 say 'Customer Name ' get cCustName CAPFIRST
@ 11,10 say 'Street Address ' get cAddress
dc_readmodal( GetList )
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readclick()
Evaluate code-block if mouse is double-clicked in a GET
Syntax:
DC_ReadClick ( [< xValue >], ;
< bEval >, ;
[< lEnter >], ;
[< lNoEmpty >] ) - > xValue
Arguments:
< xValue > is the value of the GET memory variable. If this
is passed as a NIL, then the oGET:VarGet() value will be
used.
< bEval > is the code block to evaluate if the mouse is
double-clicked.
< lEnter > if .TRUE. will evaluate the code-block if the
ENTER key is hit or the mouse is double-clicked. If
.FALSE. (default) then only a double-click will invoke
the evaluation.
< lNoEmpty > if .TRUE. will evaluate the code-block if
the < xValue > is empty even if the mouse in not double-
clicked. The default is .FALSE.
Returns:
If the mouse is double-clicked the returns the value
returned by the evaluated code-block, otherwise returns
.TRUE.
Description:
DC_READCLICK() is designed to be used in a the VALID clause
of a GET statement. This will evaluate a code block only if
the mouse left button is double-clicked or the right button
is clicked on the specified GET or if (optionally) the last
key hit is the <þENTERþ> key or if (optionally) the value of
the GET is empty.
Notes:
This function must be used with DC_READMODAL().
Examples:
// In this example, the calculator will pop-up and return
// the accumulator in the <nTax> variable if the mouse
// is double-clicked on the <nTax> get or the calendar
// will pop-up and return the selected date if the mouse
// is double-clicked on the <dDate> get.
@ 12,10 say 'Sales Tax' get nTax ;
VALID DC_READCLICK( nTax, { |n| dc_popcalc(n)} )
@ 13,10 say ' Date' get dDate ;
VALID DC_READCLICK( dDate, { |d| dc_popdate(d)} )
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readcolor()
A function for validating color strings in a GET
Syntax:
DC_ReadColor ( < cColor >, ;
< nDisplayRow >, ;
[< lEmptyOK >] ) - > lValid
Arguments:
< cColor > is the name of the GET variable.
< nDisplayRow > is the start display row to display the color
pick-list.
< lEmptyOK > if .TRUE. will allow < cColor > to be empty. If
.FALSE. (default) then if < cColor > is empty the color
pick-list will be automatically displayed.
Returns:
A logical .TRUE. if the color string entered is valid or
the operator picked a color from the pick-list.
Description:
DC_READCOLOR() is used to validate a color-string value in a
GET. DC_READCOLOR() should be used as a VALID function in a
GET statement. The pick-list will be displayed whenever
the input is not valid or when the mouse is double-clicked.
Notes:
This function will work properly only when used with
DC_READMODAL().
Examples:
@ 7,12 SAY 'Enter a color string' GET cColor ;
VALID DC_ReadColor( @cColor, 15 ) PICKLIST
Source/Library:
_DCCLRSL.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readcua()
Set CUA-Compliance for Navigating Gets
Syntax:
DC_ReadCUA ( [< lNewCUAMode >] ) - > lOldCUAMode
Arguments:
< lNewCUAMode > if .TRUE. will set the CUA-compliant mode ON,
if .FALSE. will set the CUA-compliant mode OFF, and if not
passed will not affect the current setting.
Returns:
A logical value equivalent to the previous setting.
Description:
DC_READCUA() is used to set the CUA-Compliant mode for
terminating a table of GETS. The normal termination method
is CTRL-W or CTRL-END, whereas the CUA-Compliant method of
terminating a table of GETS is the ENTER key. In both modes
the TAB key will move to the next get and the SHIFT-TAB key
will move to the previous get.
CUA-Compliant mode is consistent with IBM and Windows software
systems.
Examples:
/* -- Set CUA-compliance ON -- */
DC_READCUA(.t.)
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readalt()
dc_readnav()
dc_readcut()
Establish the keys to use for cutting and pasting Gets
Syntax:
DC_ReadCut ( [< aKeys >] ) - > aOldKeys
Arguments:
< aKeys > is an array of 2 elements.
Element Type Description Default
------- ---- ----------- -----------
1 N Cut key 290 (Alt-G)
2 N Paste key 275 (Alt-R)
Returns:
A 2-element array containing the current keys.
Description:
DC_READCUT() is used to establish the keyboard keys to use
for cutting and pasting between GETS when using DC_READMODAL()
function.
The default key for CUT is ALT-G (grab).
The default key for PASTE is ALT-R (replace).
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readdpick()
Pops up database or array pick-list in a GET
Syntax:
DC_ReadDPick( < xValue >, ;
[< cAlias >], ;
< aOptions >, ;
< aColumns >, ;
[< bFieldBlock >], ;
[< aData >], ;
[< bPreBlock >], ;
[< bPostBlock >], ;
[< lSeek >], ;
[< lEmptyOK >], ;
[< cFilter >], ;
[< nSeekIndex >], ;
[< xSeekValue >] ) - > lStatus
Arguments:
< xValue > is the name of the GET memory variable.
< cAlias > is the alias of the work area to select for the
pick list. This parameter is not needed if < aData > is passed.
< aOptions > is an array of options about the picklist box.
This array must conform to the same requirements as the
< aOptions > array for DC_DBCHCREATE().
< aColumns > is an array of columns to display in the picklist
box. This array must conform to the same requirements as the
< aColumns > array for DC_DBCHCREATE().
< bFieldBlock > is a code-block to evaluate after the user
chooses the record from the pick-list. The evaluated output
will be stored in < xValue >.
< aData > is the name of a multi-dimensional array containing
the pick-list data. If this parameter is not passed, then the
pick-list data will come from the database selected by < cAlias >.
< bPreBlock > is a code block to evaluate before popping up the
pick-list. < bPostBlock > is a code block to evaluate after the
pick-list box is closed. These are optional parameters and are
used for such functions as opening and closing the database,
setting filters and or indexes, etc. in the event that the
database is not already open or the database conditions are
unknown.
< lSeek > if .TRUE. (default) will seek to the value passed as
< xSeekValue > if not empty, otherwise will seek to the value
passed as < xValue >. A .TRUE. will be returned if found,
otherwise a database pick-list will be displayed.
< lEmptyOK > if .TRUE. will return a .TRUE. if < xValue > is
empty
and < lSeek > is .FALSE. The pick-list will not be displayed.
< cFilter > is a filter string to impose upon the database before
seeking or displaying records. Any old filter will be restored
before returning.
< nSeekIndex > is the number (numeric) or tag-name (character) of
the index to select before seeking the record when < lSeek > is
.TRUE. If this parameter is not passed, then the currently
selected index will be used. The currently selected index will
be restored upon return.
< xSeekValue > if not empty, will be used to perform the seek when
< lSeek > is .TRUE., otherwise < xValue > will be used.
Returns:
A logical .TRUE. if the operator clicks on a different GET
or if the operator chooses and item from the pick-list. A
logical .FALSE. if the operator presses the ESCAPE key.
Description:
DC_READDPICK() will pop-up a database pick-list or a multi-
dimensional array pick-list if the mouse is double-clicked
on a GET and return data from the selected record or array
element into the GET. DC_READDPICK() should be used as a
VALID function in a GET statement.
Notes:
This function will work properly only when used with
DC_READMODAL().
Examples:
-- Example 1 --
// In this example a GET table asks the operator for a Customer
// Number. If the operator double-clicks on the GET, the
// CUSTOMER database will be selected, a pick-list will pop-up
// displaying the CUSTOMER NUMBER and CUSTOMER NAME. The
// CUSTOMER NUMBER of the selected record will be returned into
// the GET variable.
local cCustomer := SPACE(10), GetList := {}
@ 10,10 say 'Enter Customer Number ' GET cCustNmbr ;
VALID DC_READDPICK( cCustNmbr, 'CUSTOMER', { 5,20,20,75 },;
{ {{||cust_nmbr},'Number' },;
{{||cust_name},'Customer Name' } },;
{||PAD(cust_nmbr,10)} )
dc_readmodal(GetList)
-- Example 2 --
// In this example a GET table asks the operator for a File
// Name. If the operator double-clicks on the GET, the
// Directory() function will be used to create an array of
// file names which will be displayed in the pick-list. The
// selected file will be returned into the GET variable.
local cFileName := space(50), GetList := {}
@ 10,10 say 'Enter File Name' get cFileName ;
VALID DC_READDPICK( cFileName,, { 5,20,20,75 },;
{ { 1,'File Name',15 }, { 2,'Size',8 }, { 3, 'Date',8 }},;
{|a,n|a:=Directory(),n:=dc_arrayrec(),PAD(a[n,1],50)},;
Directory() )
dc_readmodal(GetList)
Source/Library:
_DCDBCHO.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readapick()
dc_dbchoice()
dc_readempty()
Validate that a GET is not empty or display message
Syntax:
DC_ReadEmpty ( < xMemVar >, ;
{ < cLine1 >,...< cLineN > } ) - > lStatus
Arguments:
< xMemVar > is the memvar to validate.
< cLine1 > thru < cLineN > is an array of character strings.
This is
the message to display if the field is empty.
Returns:
Returns .TRUE. if <þxMemVarþ> is not empty, otherwise will
display message, wait for a key hit or mouse-click, then return
.FALSE.
Description:
DC_READEMPTY() is used as a VALID function in a GET statement to
validate that a field is not empty. If the field is empty, a
passed message will be displayed.
Examples:
#include 'dcdialog.ch'
PROCEDURE Xtest()
LOCAL GetList := {}, cCustName := Space(30)
@ 10,10 DCSAY 'Enter Customer Name ' GET cCustName ;
VALID DC_READEMPTY( cCustName , ;
{ "Must enter a Customer Name" } )
DCREAD GUI FIT ADDBUTTONS
RETURN
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_reader()
A Replacement for GetReader() that works with mouse
Syntax:
DC_Reader ( < oGet >, ;
< aGetList > ) - > nil
Arguments:
< oGet > is the Get object that is currently in focus.
< aGetList > is the Get List array.
Returns:
nil
Description:
DC_READER() is a direct replacement for the Clipper
GetReader() function and works identical except that it
recognizes mouse events and will automatically move the
cursor up and down through the gets if the mouse is clicked
within an active get.
DC_READER() is the default reader for DC_READMODAL(). This
function may be "inherited" by a custom reader posted as
the oGet:reader code block. A custom reader function can
perform special actions, such as displaying messages, and
then call DC_READER() to continue the "moused" key read
action.
Notes:
DC_READER() should be used only when using DC_READMODAL().
Examples:
LOCAL GetList := {}
@ 13,15 say ' Customer Name ' GET cust_name
@ 14,15 say ' Street ' GET street
@ 15,15 say ' City ' GET city
@ 16,15 say ' State ' GET state
@ 17,15 say ' Zip ' GET zip
oGet := GetList[5]
oGet:reader := {|oGet| MyReader( oGet, GetList )}
dc_readmodal( GetList )
Return nil
// ----------------- //
STATIC FUNCTION MyReader ( oGet, GetList )
@ 24,0 SAY 'Enter a Valid Zip Code'
DC_READER( oGet, GetList )
@ 24,0 clear
Return nil
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readgets()
Process the Getlist array with the Text or GUI reader
Syntax:
DC_ReadGets ( < aGetList >, ;
[< cTitle >], ;
[< aActiveArea >], ;
[< aGetOptions >], ;
[< bEventHandler >], ;
[< aRef >], ;
[< oDialog >], ;
[< oAppWindow >] ) - > lUpdated
Arguments:
< aGetList > is an array containing a list of Get objects to
edit.
< cTitle > is the title to display on the top of the GUI
dialogue box. This is ignored if painting text-based GETS.
< aActiveArea > is an array of 5 elements defining text-based
coordinates:
Element Type Description
------- ---- -----------------------------------------
[1] N Start Row
[2] N Start Column
[3] N End Row
[4] N End Column
[5] A Mouse buttons
(See DC_MOUSEKEY() for specification)
In text mode, if no array is passed, then if the mouse is
clicked outside any active GETs, it will do nothing. If an
array is passed, and the mouse is clicked outside the array
coordinates, the READ will be terminated exactly the same as
hitting the CTRL-W key.
In GUI mode, if this array is passed, then the size of the
dialogue box is calculated by converting the text-based
coordinates to GUI coordinates. If no array is passed, the
the size of the dialogue box is determined by < GetOptions >.
If no < GetOptions > array is passed, then the dialogue
defaults to 640 x 480.
< aGetOptions > is an array of options for the GUI dialogue
box. This is ignored if painting text-based GETS.
See DCDIALOG.CH for a description of this array.
< bEventHandler > is a code block which points to a custom
event handler. DC_ReadGui() uses it's own, default event
handler to manage the objects during the running of the
program. The default event handler makes a call to the
custom event handler before processing it's default events.
The custom event handler uses Appevent() to get information
on the current event and passes the following parameters:
1. nEvent - The event type.
2. mp1 - The first event parameter.
3. mp2 - The second event parameter.
4. oXbp - A pointer to the object creating the event.
5. oDlg - A pointer to the main dialogue object.
6. aGetlist - A pointer to the GetList array.
7. aRef - A pointer to an optional Reference array that
was passed to DC_ReadGets().
The code block should look like this:
bEventHandler := {|a,b,c,d,e,f,g,h|MyHandler(a,b,c,d,e,f,g,h)}
< aRef > is any array. Programming dialogue systems that must
manipulate many variables is much simpler if all the variables
are placed into a single array and then passed to the dialogue
system and its event custom event handler. See example 2.
@< oDialog > is a reference to a parent dialog or to a memory
variable to store a reference to the dialog that will be created.
If < oDialog > has already been created as an XbpDialog class
object, it will become the parent for all the objects in the
GetList. If < oDialog > is passed by reference as a NIL, the
dialog object created by the reader will be stored in this
memory variable.
The parent of the dialog that will be created is referenced by
< oAppWindow >. If no < oAppWindow > is passed then the parent
of the created dialog will be AppDeskTop().
Returns:
.TRUE. if any gets were updated, .FALSE. otherwise.
Description:
DC_READGETS() is used to process the Text/Gui Getlist array
and prepare a GetList that is compatible with DC_READMODAL()
and READMODAL() in Text mode or to pass it to DC_READGUI()
for a GUI dialogue.
DC_READGETS() tests the value returned by the DC_GUI()
function and if it is .TRUE. processes the GetList with
the GUI reader, otherwise it processes the Getlist with
the text-reader.
Examples:
In this example, DC_ReadBox() and DC_Impl() will only
display and restore the window in Text-Mode. They are
ignored in GUI mode.
#include "dcdialog.ch"
LOCAL GetList := {}, GetOptions, aReadArea
DC_Gui(.t.) // turn on GUI mode
GetList := {}
cScrn := DC_ReadBox(3,5,14,75,,@aReadArea)
@ 5,10 DCSAY ' Last Name' GET cLastName
@ 5,40 DCSAY 'First Name' GET cFirstName
@ 7,10 DCSAY ' Company' GET cCompany
@ 8,10 DCSAY ' Street' GET cStreet
@ 9,10 DCSAY ' City' GET cCity
@10,10 DCSAY ' State' GET cState
@10,40 DCSAY ' Country' GET cCountry
@12,40 DCSAY ' Phone' GET cPhone PICT '(999)-999-9999'
DCGETOPTIONS SAYWIDTH 15
lOk := DC_ReadGets( GetList,"Enter Data",aReadArea,;
GetOptions )
DC_Impl(cScrn)
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readgui()
DIALOG GETLIST
dc_readgui()
Process the Getlist array with the GUI reader
Syntax:
DC_ReadGUI ( < aGetList >, ;
[< cTitle >], ;
[< aGetOptions >], ;
[< lnButtons >], ;
[< bEventHandler >], ;
[< aRef >], ;
[@< oDialog >], ;
[< lFit >], ;
[< lDesignOn >], ;
[< lExit >], ;
[< oAppWindow >], ;
[< lModal >], ;
[< bEval >], ;
[< lEnterExit >],;
[< oOwner >], ;
[< xSetFocus >], ;
[< ancGroup >], ;
[< anTimeOut >] ) - > lUpdated
Arguments:
< aGetList > is an array containing a list of Get objects to edit.
< cTitle > is the title to display on the top of the GUI
dialogue box.
< aGetOptions > is an array of options for the GUI dialogue
box. This is ignored if painting text-based GETS.
See DCDIALOG.CH for a description of this array.
< lnButtons > will add extra buttons to the bottom area of the main
dialog window. < lnButtons > may be a numeric value designating the
buttons to add based on the below table. DCDIALOG.CH contains
DCGUI_BUTTON_* constant definitions for the available buttons.
These values are summed to enable multiple buttons.
Numeric Value Description
------------------ ---------------------------------------------
DCGUI_BUTTON_OK Will add a button with the caption OK.
Selecting this button will exit the GUI reader
and save all changes to their associated
memory variables.
DCGUI_BUTTON_CANCEL Will add a button with the caption CANCEL.
Selecting this button will exit the GUI reader
and restore all memory variables to their
original value.
DCGUI_BUTTON_EXIT Same as DCGUI_BUTTON_OK except the caption is
labeled as EXIT.
Optionally, < lnButtons > may be a logical .TRUE. This will paint
both the OK and CANCEL buttons.
< bEventHandler > is a code block which points to a custom
event handler. DC_ReadGui() uses it's own, default event
handler to manage the objects during the running of the
program. The default event handler makes a call to the
custom event handler before processing it's default events.
The custom event handler uses Appevent() to get information
on the current event and passes the following parameters:
1. nEvent - The event type.
2. mp1 - The first event parameter.
3. mp2 - The second event parameter.
4. oXbp - A pointer to the object creating the event.
5. oDlg - A pointer to the main dialogue object.
6. aGetlist - A pointer to the GetList array.
7. aRef - A pointer to an optional Reference array that
was passed to DC_ReadGui().
8. lOk - A logical value that is .TRUE. if the OK button
was clicked and .FALSE. if CANCEL was clicked.
The code block should look like this:
bEventHandler := {|a,b,c,d,e,f,g,h|MyHandler(a,b,c,d,e,f,g,h)}
The Function should look like this:
STATIC FUNCTION MyHandler ( nEvent, mp1, mp2, oXbp, oDlg,
aGetlist, aRef, lOk )
/* custom code */
RETURN DCGUI_NONE
The function must return a numeric value which controls the
behavior of the event loop as follows:
Return Value Behavior
------------ --------------------------------------------
DCGUI_NONE Continue processing the event
DCGUI_IGNORE Ignore event
DCGUI_CLEAR Ignore event and clear all events from queue
DCGUI_EXIT_OK Exit the DC_ReadGui() reader event loop
and return a logical .TRUE.
DCGUI_EXIT_ABORT Exit the DC_ReadGui() reader event loop,
restore all referenced memvar to their
original value and return a logical .FALSE.
DCGUI_MOVE_UP Set focus to previous object in Get List
DCGUI_MOVE_DOWN Set focus to next object in Get List
DCGUI_MOVE_TOP Set focus to first object in Get List
DCGUI_MOVE_BOTTOM Set focus to last object in Get List
DCGUI_MOVE_UP_PAR Set focus to previous object in Get List that
has the same parent as the current object.
DCGUI_MOVE_DOWN_PAR Set focus to next object in Get List that
has the same parent as the current object.
DCGUI_MOVE_TOP_PAR Set focus to first object in Get List that
has the same parent as the current object.
DCGUI_MOVE_BOTTOM_PAR Set focus to last object in Get List that
has the same parent as the current object.
DCGUI_NOHOTKEY Don't activate hot key associated with
the current object.
< aRef > is any array. Programming dialogue systems that must
manipulate many variables is much simpler if all the variables
are placed into a single array and then passed to the dialogue
system and its event handler. See example 2.
@< oDialog > is a reference to a parent dialog or to a memory
variable to store a reference to the dialog that will be created.
If < oDialog > has already been created as an XbpDialog class
object, it will become the parent for all the objects in the
GetList. If < oDialog > is passed by reference as a NIL, the
dialog object created by the reader will be stored in this
memory variable.
The parent of the dialog that will be created is referenced by
< oAppWindow >. If no < oAppWindow > is passed then the parent
of the created dialog will be AppDeskTop().
< lFit > if .TRUE. will automatically form the dialog screen to
fit comfortably around the objects within the dialog. This
option allows the programmer to use coordinates on dialog
objects for relative addressing only without worrying about how
the objects relate to the borders of the main dialog. After
all the objects are created, the main dialog borders will be
sized to fit the objects. The default is .FALSE.
< lDesignOn > will add a button to the bottom of the dialog to
click on for enabling DESIGN mode. In design mode, objects may
be resized or moved with the mouse and the new sizes and
coordinates are written back to the GetList array. This
feature is useful for writing data-driven dialog systems.
< lExit > if .TRUE. will exit the reader after the objects
are created and not enter the reader's event loop. It is the
responsibility of the programmer to insure that events are
managed and the dialog is destroyed. This feature is used to
add more objects to an existing dialog, or to create a dialog
that will be managed by an external event loop.
< oAppWindow > is the parent object for the main dialog. If this
argument is not passed, then the AppDeskTop() will be used.
< lModal > if .TRUE. will set this dialog modal state to MODAL -
APPLICATION WIDE. If .FALSE. the dialog will be NONMODAL. The
default is .FALSE.
< bEval > is an optional code block to evaluate after all the
objects are created and just before entering the event loop.
The main dialog object is passed to this code block as an
argument.
< lEnterExit > if .TRUE. will exit the dialog if the ENTER key is
pressed in the "last GET". If .FALSE. (default), then pressing
the ENTER key in the last GET will cause the first GET to receive
focus.
< oOwner > is the owner of the dialog window.
< lArrayTranslate > if .TRUE. will translate the HEIGHT, WIDTH,
START COLUMN and START ROW elements in the GETLIST array to
pixel coordinates and write these coordinates back to the
original GETLIST array. It will also write the translated
Dialog window coordinates to the GETOPTIONS array and set the
TRANSLATE flag in the GETOPTIONS array to .FALSE.
< xSetFocus > is the object that receives focus when entering
the event handler. < xSetFocus > may be a type "O" (object), a type
"N" (numeric) or a type "C" character. If < xSetFocus > is a type
"N" then the numeric value must be a number from 1 to the length
of < aGetList >. This is an ordinal pointer to the GetList item.
If < xSetFocus > is a type "C" then the character string value must
be a value equivalent to the ID of the item in the GetList which
is to receive focus.
< ancGroup > is the GetList group to create. Each item in the
GetList may be assigned a group name or number via the
GROUP < ancGroup > clause. If a numeric or character value is
passed then only the items in the GetList which match < ancGroup >
will be created. < ancGroup > may consist of an array of numeric
values or character values so that more than one group may be
created. If < ancGroup > is a nil then all items in the GetList
will be refreshed.
< anTimeOut > is used to exit the dialog after a specified
number of seconds. < anTimeOut > may be a numeric value equivalent
to the number of seconds or an array of two elements as defined
below:
ELEMENT TYPE DESCRIPTION
------- ---- ------------------------------------------------
1 N The timeout in seconds
2 B A code block to execute after the timeout. The
code block must return a logical value. If a .T.
is returned the exit will occur, otherwise the
timeout will be reset.
Returns:
.TRUE. if DC_ReadGui() was exited by one of the following
methods:
1. DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)
2. The user pressed ENTER when the ENTEREXIT clause of DCREAD GUI
command was used.
3. The user closed the main dialog window and the CLOSEQUERY
clause of DCREAD GUI was used.
.FALSE. if DC_ReadGui() was exited by one of the following
methods:
1. DC_ReadGuiEvent(DCGUI_EXIT_ABORT,GetList)
2. The user pressed ESCAPE.
3. The user closed the main dialog window and the CLOSEQUERY
clause of DCREAD GUI was not used.
Description:
DC_READGUI() is used to process the Getlist array using the
GUI Dialog reader.
This is the GUI equivalent to DC_ReadModal(). It uses the
GetList array of dialogue objects created by the DC*
commands in DCDIALOG.CH.
Exported Instance Variables:
Methods:
Notes:
Examples:
/*
This example will display a list of fields in the
"Available Fields" selection, allow the operator to
select a set of fields, then display a Browse of the
database for the fields selected. The example shows
how to use DC_READGUI() to create a master dialog and
a sub dialog.
*/
#include "dcpick.ch"
PROCEDURE XTest( )
LOCAL GetList := {}, GetOptions, cAlias, aListField, ;
aPickField, oBrowse, oDialog
USE COLLECT NEW SHARED
cAlias := 'COLLECT'
aListField := Array(FCount())
AFields(aListField)
@ 2,3 DCPICKLIST aPickField LIST aListField ;
CAPTION "Available Fields", "Selected Fields" ;
SIZE 35,12 ;
DATALINK {||BrowseCollect(cAlias,oDialog,@oBrowse,@aPickField)}
DCGETOPTIONS ;
WINDOW HEIGHT 360 ;
WINDOW WIDTH 600
DC_READGUI(GetList, "Picklist Demo", GetOptions, .t., nil, nil, @oDialog )
RETURN
/* --------------------- */
STATIC FUNCTION BrowseCollect ( cAlias, oDialog, oBrowse, aPickField )
LOCAL GetList := {}, i, aChildList
IF Valtype(oBrowse) = 'O'
aChildList := oBrowse:ChildList()
FOR i := 1 TO Len(aChildList)
aChildList[i]:Destroy()
NEXT
oBrowse:Destroy()
ENDIF
oBrowse := nil
IF Empty(aPickField)
RETURN nil
ENDIF
@ 2,40 DCBROWSE oBrowse DATA cAlias SIZE 39,12 PARENT oDialog:drawingArea
SELECT collect
FOR i := 1 TO Len(aPickField)
DCBROWSECOL DATA &('{||COLLECT->'+aPickField[i]+'}') ;
HEADER aPickField[i] PARENT oBrowse
NEXT
DC_READGUI( GetList, nil, nil, .f., nil, nil, oDialog )
oBrowse:hide()
oBrowse:show()
RETURN nil
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
DCREAD GUI
dc_readgets()
DIALOG GETLIST
dc_getrefresh()
dc_readguidebug()
Enable/Disable DEBUG mode in the GUI reader
Syntax:
DC_ReadGuiDebug ( [< nDebug >] ) - > nStatus
Arguments:
< nDebug >, is a numeric value which determines the level of
debugging required. DCDIALOG.CH contains a set of defines
starting with DCGUI_DEBUG_*. The numeric values from the below
table are summed together to enable desired debugging features.
Constant Description
------------------- -------------------------------------------
DCGUI_DEBUG_CREATE Display debugging information while creating
objects.
DCGUI_DEBUG_EVENTS Display debugging information about events
in the event loop.
DCGUI_DEBUG_VALIDATE Display debugging information during
Validation routine.
Description:
DC_READGUIDEBUG() is used to turn on debugging information for
DC_READGUI(). When debug mode is ON, information about the
type of Getlist object is echoed to a CRT window while the
objects are being created by DC_READGUI(). This is handy when
an error occurs in the DC_READGUI() due incorrect arguments in
the GetList array passed to the function. The last line of
information in the CRT window will contain information to help
determine which GET caused the error.
Debug mode may also echo the "define" name of all events that
occur while in the event loop to see the order in which events
occur when using the mouse or keyboard.
Examples:
#include "dcdialog.ch"
PROCEDURE Xtest()
LOCAL GetList := {}, GetOptions, cOption, oMyGroup
cOption := 'P'
@ 4,10 DCGROUP oMyGroup CAPTION "Select an Operation" ;
SIZE 40,8
@ 1,2 DCRADIO cOption PROMPT 'Save to Dictionary' VALUE 'D' ;
PARENT oMyGroup
@ 2,2 DCRADIO cOption PROMPT 'Save to Source Code' VALUE 'S' ;
PARENT oMyGroup
@ 3,2 DCRADIO cOption PROMPT 'Make a Backup file' VALUE 'B' ;
PARENT oMyGroup
@ 4,2 DCRADIO cOption PROMPT 'Pack the File' VALUE 'P' ;
PARENT oMyGroup
DC_READGUIDEBUG( DCGUI_DEBUG_CREATE + DCGUI_DEBUG_EVENTS )
DCREAD GUI ;
TITLE 'My Dialogue' ;
FIT ;
ADDBUTTONS
RETURN
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readgui()
dc_appeventdefine()
dc_getlisttype()
dc_qout()
dc_readguieval()
Post a code block for later evaluating in DC_ReadGui()
Syntax:
DC_ReadGuiEval ( [< bEval >] ) - > bOldEval
Arguments:
< bEval > is the code block to evaluate.
Returns:
The previously stored codeblock.
Description:
DC_ReadGuiEval() is a Get-Set function that is used to post a
code block to be evaluated just before starting up the event loop
in DC_ReadGui(). The dialog object created by DC_ReadGui() is
passed to this code block. Use this function when it is
necessary to call the same piece of code every time a DC_ReadGui()
is called.
Exported Instance Variables:
Methods:
Notes:
Examples:
/*
This will call DoSomething() every time the dialog window
receives input focus.
*/
DC_READGUIEVAL( {|o|o:setInputFocus := {||DoSomething()} } )
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readgui()
dc_readguievent()
Create an event to control the GUI reader
Syntax:
DC_ReadGuiEvent( < nEvent >, ;
< GetList > ) - > lStatus
Arguments:
< nEvent > is a numeric value equivalent to one of the defined
values in the below table. These definitions exist in
DCDIALOG.CH.
< nEvent > Behavior
------------ --------------------------------------------
DCGUI_CLEAR Clear all events from queue
DCGUI_EXIT_OK Exit the DC_ReadGui() reader event loop
and return a logical .TRUE.
DCGUI_EXIT_ABORT Exit the DC_ReadGui() reader event loop,
restore all referenced memvar to their
original value and return a logical .FALSE.
DCGUI_MOVE_UP Set focus to previous object in Get List
DCGUI_MOVE_DOWN Set focus to next object in Get List
DCGUI_MOVE_TOP Set focus to first object in Get List
DCGUI_MOVE_BOTTOM Set focus to last object in Get List
DCGUI_MOVE_UP_PAR Set focus to previous object in Get List that
has the same parent as the current object.
DCGUI_MOVE_DOWN_PAR Set focus to next object in Get List that
has the same parent as the current object.
DCGUI_MOVE_TOP_PAR Set focus to first object in Get List that
has the same parent as the current object.
DCGUI_MOVE_BOTTOM_PAR Set focus to last object in Get List that
has the same parent as the current object.
< GetList > is the array containing the Get List.
Returns:
A logical .TRUE. if a new object was placed into focus, otherwise
a logical .FALSE.
Description:
DC_ReadGuiEvent() is used to control behavior of the DC_ReadGui()
function. This function can be used to exit DC_ReadGui() or to
specify navigation methods.
The navigation modes take into consideration any WHEN clause
and HIDE clause that is attached to objects and skips past those
objects which are disabled or hidden.
Examples:
#include 'dcdialog.ch'
PROCEDURE Xtest()
LOCAL GetList := {}, cDesc, cType, cSubType, cLocation, cComments, ;
oToolBar, GetOptions
USE COLLECT NEW
cDesc := COLLECT->descrip
cType := COLLECT->type
cSubType := COLLECT->sub_type
cLocation := COLLECT->location
cComments := COLLECT->comments
@ 5,1 DCSAY 'Description' GET cDesc
@ 6,1 DCSAY ' Type' GET cType
@ 7,1 DCSAY ' Sub-Type' GET cSubType
@ 8,1 DCSAY ' Location' GET cLocation
@ 9,1 DCSAY ' Comments' GET cComments
DCTOOLBAR oToolBar
DCADDBUTTON CAPTION 'First Field' SIZE 10 PARENT oToolBar ;
ACTION {||DC_ReadGuiEvent(DCGUI_MOVE_TOP_PAR,GetList)}
DCADDBUTTON CAPTION 'Next Field' SIZE 10 PARENT oToolBar ;
ACTION {||DC_ReadGuiEvent(DCGUI_MOVE_DOWN_PAR,GetList)}
DCADDBUTTON CAPTION 'Previous Field' SIZE 10 PARENT oToolBar ;
ACTION {||DC_ReadGuiEvent(DCGUI_MOVE_UP_PAR,GetList)}
DCADDBUTTON CAPTION 'Last Field' SIZE 10 PARENT oToolBar ;
ACTION {||DC_ReadGuiEvent(DCGUI_MOVE_BOTTOM_PAR,GetList)}
DCADDBUTTON CAPTION 'Save' SIZE 10 PARENT oToolBar ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)}
DCADDBUTTON CAPTION 'Abort' SIZE 10 PARENT oToolBar ;
ACTION {||DC_ReadGuiEvent(DCGUI_EXIT_ABORT,GetList)}
DCGETOPTIONS ;
WINDOW HEIGHT 300 ;
WINDOW WIDTH 500
DCREAD GUI OPTIONS GetOptions
RETURN
Source/Library:
_DCGETBX.PRG, DCLIPX.LIB
See Also:
dc_readgui()
dc_readguieventloop()
dc_readguieventloop()
Start up an event loop that is compatible with GetList
Syntax:
DC_ReadGuiEventLoop( < aGetList >, ;
[< bEventHandler >], ;
[@< nEvent >], ;
< oParentDlg >, ;
[< aRef >], ;
[< anTimeOut >], ;
[< nWait >], ;
[< lMultiLists > ) - > lOkStatus
Arguments:
< aGetList > is a GetList that was previously used to create a
set of objects with DC_ReadGui().
< bEventHandler > is a code block which points to a custom
event handler. DC_ReadGuiEventLoop() makes a call to the
custom event handler before processing it's default events.
The main event handler uses Appevent() to get information
on the current event and passes the following parameters:
1. nEvent - The event type.
2. mp1 - The first event parameter.
3. mp2 - The second event parameter.
4. oXbp - A pointer to the object creating the event.
5. oDlg - A pointer to the main dialogue object.
6. aGetlist - A pointer to the GetList array.
7. aRef - A pointer to an optional Reference array that
was passed to DC_ReadGuiEventLoop().
8. lOk - A logical value that is .TRUE. if the OK button
was clicked and .FALSE. if CANCEL was clicked.
The code block should look like this:
bEventHandler := {|a,b,c,d,e,f,g,h|MyHandler(a,b,c,d,e,f,g,h)}
@< nEvent > is a variable, passed by reference, to store the
numerical value of the last event processed in the event loop
before exiting.
< oParentDlg > is the parent dialog window that was either created
by DC_ReadGui() or passed to DC_ReadGui().
< aRef > is an optional array to pass to the custom event handler.
< anTimeOut > is used to exit the dialog after a specified
number of seconds. < anTimeOut > may be a numeric value equivalent
to the number of seconds or an array of two elements as defined
below:
ELEMENT TYPE DESCRIPTION
------- ---- ------------------------------------------------
1 N The timeout in seconds
2 B A code block to execute after the timeout. The
code block must return a logical value. If a .T.
is returned the exit will occur, otherwise the
timeout will be reset.
< nWait > is an optional numerical value that is passed to the
function AppEvent() which pulls events from the event queue. The
default is 0, meaning that AppEvent() will wait forever for an
event, otherwise it will wait < nWait > seconds.
< lMultiLists > if .TRUE. causes the event handler to support multiple
GetLists. For example, if an event occurs that is associated
with an object that was created from a child or subsequent
GetList, then all other references to that GetList will be used
when the object is refreshed. This means that multiple MDI child
windows may now be created using DCREAD GUI and they no longer
need to be running in another thread to maintain multiple event
loops. Simply use the EXIT clause of DCREAD GUI when creating an
MDI child window to return control to the main event loop.
Running MDI child windows in separate threads is not always
desirable, especially when MDI child windows may need to share
the same workspace, as in the DC_Dbu() utility program.
Returns:
.TRUE. if DC_ReadGuiEventLoop() was exited by one of the following
methods:
1. DC_ReadGuiEvent(DCGUI_EXIT_OK,GetList)
2. The user pressed ENTER when the ENTEREXIT clause of DCREAD GUI
command was used.
3. The user closed the main dialog window and the CLOSEQUERY
clause of DCREAD GUI was used.
.FALSE. if DC_ReadGui() was exited by one of the following
methods:
1. DC_ReadGuiEvent(DCGUI_EXIT_ABORT,GetList)
2. The user pressed ESCAPE.
3. The user closed the main dialog window and the CLOSEQUERY
clause of DCREAD GUI was not used.
Description:
DC_ReadGuiEventLoop() is the main event loop called by DC_ReadGui().
After all the objects are created on the screen by passing a
GetList to DC_ReadGui(), a pointer to the GetList is passed to
DC_ReadGuiEventLoop() and the event loop remains running until
it is exited by a call to DC_ReadGuiEvent() or with the ESCAPE
key (if enabled).
This is a special event handler designed to handle all events
and also the following procedures:
1. WHEN and HIDE clauses associated with DC* commands are evaluated
by a call to DC_GetWhen() in the event loop whenever a
xbeP_KillInputFocus event is received. This insures that objects
are disabled, enabled, hidden or shown when conditions change that
affect their respective code blocks.
2. VALID clauses associated with DC* commands are evaluated when an
object loses focus and the focus is forced back to the object
if the VALID code block returns a .FALSE.
3. Keyboard events that are used for navigation through a table of
GETs are handled in the event loop. Keys such as ENTER, UP,
DOWN, TAB, etc will set focus to the next or previous object
while respecting whether or not the object is enabled, unprotected,
etc.
4. EDITPROTECT clauses associated with DC* commands are evaluated
when an object tries to receive focus. If the object is protected
by an EDITPROTECT code block (returns .TRUE.) then it will not
receive focus.
5. Messages are handled in the event loop. An xbeP_SetInputFocus event
will test for a MESSAGE clause associated with an object and
display the message in the message receptable object established
by the MESSAGE INTO clause of DCGETOPTIONS.
6. A ToolTip management thread is started in the event loop. This
thread displays tooltips associated with an object by the TOOLTIP
clause of DC* commands when the mouse is placed over the object.
7. Help requests are handled in the event loop. xbeP_HelpRequest
events are usually created by pressing F1, however they can be
also be created by special programming. Help request events cause
the associated help code established by the HELPCODE clause of
DC* commands to be passed on to the XbpHelp() object or to a special
code block, depending on the HELP options setup in the DCGETOPTIONS
command.
8. Hot Keys and Accelerator keys are handled in the event loop. When
a keyboard event is received it is tested to see if it exists in
the GetList and its associated code block is evaluated or it's
associated object receives focus and is activated.
9. An Event Spy is managed in the event loop. The DC_ReadGuiDebug()
function is used to enable Event Spy. This will load EVENTSPY.DLL
and pass on all events that are pulled from the event queue to the
Event Spy window to watch events that are occurring in the
application.
10. The Hot Key for the POPUP clause of @..DCSAY..GET objects is handled
in the event loop. The key established by the DC_SetPopKey()
function will activate any associated popup codeblock when the GET
has focus.
11. The Dot-Prompt Window is called in the event loop. DC_DotHotKey()
establishes the key to use to invoke a Dot Prompt. This will load
DCLIP1.DLL, which contains the DC_Dot() function, and run an
instance of DC_Dot() in a non-modal window and then return to the
event loop.
12. DESIGN MODE is handled in the event loop. When the DESIGN hotkey
(set by DCGETOPTIONS) event is received, a window will be displayed
that gives the user some design options. After selecting the
options, the application is placed into "DESIGN MODE". This
disables normal events and instead captures mouse events to by
used for dragging, moving and/or sizing objects, then saving the
new coordinates to the GetList and/or source code.
13. DATATOOLTIPS are handled in the event loop. Mouse motion events
associated with DCBROWSE commands will pass information to the
ToolTip thread to evaluate data-tooltip codeblocks. See the
DATATOOLTIP clause of the DCBROWSE comand.
14. A custom event handler is called in the event loop. The HANDLER
clause of DC_ReadGuiEventLoop() is used to set a code block for
calling a custom event handler. This allows any event to be
intercepted and acted upon by the programmer before it is acted
upon by the standard event loop.
Examples:
/* 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. */
PROCEDURE Xtest()
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)) } )
_ReadGets( @oCrt )
oDlg:Destroy()
SetKey(K_ALT_M,nil)
RETURN
* --------------
PROCEDURE _ReadGets( oCrt )
LOCAL GetList := {}, cName := Space(20), cCity := Space(20), ;
cState := Space(5), cStreet := Space(30), oAppWindow
oAppWindow := SetAppWindow()
oCrt := XbpCrt():new()
oCrt:create()
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
Source/Library:
_DCGETBX.PRG, DCLIPX.LIB
See Also:
dc_readgui()
dc_readguihandler()
Post a "default" event handler for DC_ReadGui()
Syntax:
DC_ReadGuiHandler( [< bHandler >] ) - > bOldHandler
Arguments:
< bHandler > is a code block to evaluate every time an event occurs
in DC_ReadGuiEventLoop().
The DC_ReadGuiEventLoop() event handler makes a call to the
custom event handler before processing it's default events.
The custom event handler uses Appevent() to get information
on the current event and passes the following parameters:
1. nEvent - The event type.
2. mp1 - The first event parameter.
3. mp2 - The second event parameter.
4. oXbp - A pointer to the object creating the event.
5. oDlg - A pointer to the main dialogue object.
6. aGetlist - A pointer to the GetList array.
7. aRef - A pointer to an optional Reference array that
was passed to DC_ReadGets().
8. lOk - A logical value that is .TRUE. if the OK button
was clicked and .FALSE. if CANCEL was clicked.
The Function should look like this:
STATIC FUNCTION MyHandler ( nEvent, mp1, mp2, oXbp, oDlg,
aGetlist, aRef, lOk )
/* custom code */
RETURN DCGUI_NONE
The function must return a numeric value which controls the
behavior of the event loop as follows:
Return Value Behavior
------------ --------------------------------------------
DCGUI_NONE Continue processing the event
DCGUI_IGNORE Ignore event
DCGUI_CLEAR Ignore event and clear all events from queue
DCGUI_EXIT Exit the DC_ReadGui() reader event loop
DCGUI_MOVE_UP Set focus to previous object in Get List
DCGUI_MOVE_DOWN Set focus to next object in Get List
DCGUI_MOVE_TOP Set focus to first object in Get List
DCGUI_MOVE_BOTTOM Set focus to last object in Get List
DCGUI_MOVE_UP_PAR Set focus to previous object in Get List that
has the same parent as the current object.
DCGUI_MOVE_DOWN_PAR Set focus to next object in Get List that
has the same parent as the current object.
DCGUI_MOVE_TOP_PAR Set focus to first object in Get List that
has the same parent as the current object.
DCGUI_MOVE_BOTTOM_PAR Set focus to last object in Get List that
has the same parent as the current object.
DCGUI_NOHOTKEY Don't activate hot key associated with
the current object.
Description:
DC_ReadGuiHandler() is a "Get-Set" function that is used to post
a "default" event handler to be used with all DC_ReadGui() dialogs.
This function is handy for:
a. Calling UDFs that write Event transactions to an event log.
For example, an EVENT.DBF could contain information about user
activity for helping with debugging of obscure problems.
b. Calling UDFs that display a HELP screen when a new object
receives focus or when an action occurs. For example, the
user could select "learn mode". xbeP_Activate events on
pushbuttons or xbeP_setInputFocus events could automatically
display information about this activity in a help window.
Examples:
DC_ReadGuiHandler( {|a,b,c,d|Transaction(a,b,c,d)} )
STATIC FUNCTION Transaction( nEvent, mp1, mp2, oXbp )
//Record all button activate transactions
IF nEvent == xbeP_Activate
RecordEvent( nEvent, mp1, mp2, oXbp:caption, ;
DC_GetCodeBlockText(oXbp:activate) )
ENDIF
RETURN DCGUI_NONE
* ------------
STATIC FUNCTION RecordEvent( nEvent, mp1, mp2, cDesc1, cDesc2 )
LOCAL nSaveArea := Select()
USE EVENTS new
APPEND BLANK
REPL EVENTS->event with nEvent,;
EVENTS->mp1 with DC_XtoC(mp1), ;
EVENTS->mp2 with DC_Xtoc(mp2), ;
EVENTS->desc1 with cDesc1, ;
EVENTS->desc2 with cDesc2
CLOSE
SELE (nSaveArea)
RETURN nil
Source/Library:
_dcgetbx.prg, DCLIPX.DLL
See Also:
dc_readgui()
dc_readguieventloop()
dc_readguilastkey()
Process the Getlist array with the GUI reader
Syntax:
DC_ReadGUILastKey ( < aGetList > ) - > nLastKey
Arguments:
< aGetList > is an array containing a list of Get objects that
was passed to DC_ReadGui() or DC_ReadGuiEventLoop().
Returns:
The numeric value of the last key that was pressed.
Description:
DC_ReadGuiLastKey() is used to retrieve the Last Key that was
pressed in a DC_ReadGuiEventLoop().
Examples:
FUNCTION Xtest()
LOCAL GetList := {}, cSomething := Space(20)
@ 1,1 DCSAY 'Enter something' GET cSomeThing ;
VALID {||Keytest(GetList)}
DCREAD GUI FIT
RETURN nil
* ------------
STATIC FUNCTION KeyTest( GetList )
DCQQDEBUG DC_ReadGuiLastKey( GetList )
RETURN .t.
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readgui()
DCREAD
dc_readguieventloop()
dc_readguimenuaccess()
Assign a set of keys to open menu or tree locks
Syntax:
DC_ReadGuiMenuAccess( [< cKeyList >] ) - > cKeyList
Arguments:
< cKeyList > is a comma delimited string containing substrings up
to 5 characters in length.
Example: "ABC,DEF,XY,B*,CX*'
In this example, the user would have access to the following
menu and tree items:
1. Any item that does not have a lock.
2. Any item that has lock ABC.
3. Any item that has lock DEF.
4. Any item that has lock XY.
5. Any item that has a lock starting with B.
6. Any item that has a lock starting with CX.
Programmers should be given the key '*****' to gain access to
all menu and tree items at all times.
Returns:
The currently stored, comma delimited key list.
Description:
DC_ReadGuiMenuAccess() is used to establish a set of user keys
which are used to access locks that have been placed on menu
items which were created by the DCSUBMENU and DCMENUITEM commands
or on tree items which were created by the DCTREEITEM command.
A user may own keys for individual locks or master keys for
a set of locks.
In a typical application, a user would log on and his/her user
record would contain a comma-delimited list of keys for this
user. This list would then be passed to DC_ReadGuiMenuAccess().
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
See Also:
DCSUBMENU
DCMENUITEM
DCTREEITEM
dc_readguitypeahead()
Enable Keyboard typeahead buffer in GUI dialogs
Syntax:
DC_ReadGuiTypeAhead( [< lTypeAhead >] ) - > lOldTypeAhead
Arguments:
< lTypeAhead > if .TRUE. will set "typeahead" mode ON, otherwise
if .FALSE. it will set "typeahead" mode OFF.
Returns:
The previous setting.
Description:
DC_ReadGuiTypeAhead() is a Get-Set function that is used to set
"typeahead" mode for GUI dialogs.
When "typeahead" mode is enabled, keys pressed before a dialog is
created will be forwarded to the GUI object that first receives
focus.
Source/Library:
_DCGETBX.PRG
dc_readhelp()
Post a code-block for F1 help when using DC_ReadGets()
Syntax:
DC_ReadHelp ( [< bHelp >] ) - > bHelp
Arguments:
< bHelp > is a code block that is used to call a HELP procedure
when F1 is pressed or the mouse is clicked on HELP.
Returns:
The last posted code block.
Description:
DC_READHELP() is used to establish the help procedure to
call when the F1 key is pressed or the mouse is clicked on
the HELP button that has been displayed when using
DC_ReadGets(). If no code block has been posted and the
function DC_HELPF1() has been linked into the application
then this will automatically default to calling DC_HELPF1().
Examples:
LOCAL bHelp, bSaveHelp, aReadArea, GetList := {}
LOCAL cFileName := SPACE(40), cText := SPACE(30)
bHelp := { |p,l,v| MyF1Help(p,l,v) }
bSaveHelp := DC_READHELP( bHelp )
DC_ReadBox( 11,10,17,70,,@aReadArea)
@ 13,12 SAY ' File Name' GET cFileName
@ 15,12 SAY 'Enter Text' GET cText
DC_ReadModal( GetList,,aReadArea )
DC_READHELP( bSaveHelp )
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readhtml()
Read the DIALOG GetList with the HTML reader
Syntax:
DC_ReadHtml( < aGetList >, ;
[< cTitle >], ;
[< oParent >], ;
[< cRootDir >], ;
[< oHtml >], ;
[< cMessageInto >], ;
[< cTarget >] ) - > cHtml
Arguments:
< aGetList > is the GetList array.
< cTitle > is the title to display on the top of the
browser window.
< oParent > is any parent DC_Html*() object previously
created by DCREAD HTML.
< cRootDir > is the root directory where other HTML
documents or images reference in the HTML code exist.
@< oHtml > is the name of a variable, passed by reference,
to store a pointer to the DC_HtmlMain() object created by the
HTML reader. This object can be stored to a static variable
or state management cargo system to maintain the state of the
application.
< cMessageInto > is the name of a variable that will be passed
in a < a href > tag with the message text of any object that uses
the message clause. This is activated when the user clicks on
the underlined screen prompt.
< cTarget > is the name of the Web Browser frame to invoke the
message call. If this argument is not used, then a new
browser window will be displayed.
variable.
Returns:
A character string containing the HTML source code.
Description:
DC_ReadHtml() is used to process the Getlist array using the GUI
HTML reader.
This is the equivalent to DCREAD HTML.
It uses the GetList array of dialogue definitions created by the
DC* commands in DCDIALOG.CH and DCHTML.CH.
An array of DIALOG definitions must exist when using this command
and it must have the variable name GETLIST.
Source/Library:
_DCHTML.PRG
See Also:
DCREAD HTML
dc_readincr()
A "VALID" function for incrementing a GET value with the mous
Syntax:
DC_ReadIncr ( @< getvar >, ;
< aValues > ) - > .t.
Arguments:
@< getvar > is the name of the GET variable.
< aValues > is an array of valid values for < getvar >.
Returns:
.TRUE.
Description:
DC_READINCR() is used to increment the value in a GET based
on a passed array. DC_READINCR() should be used in a VALID
statement to increment through an array of values when the
mouse is double-clicked or the right mouse button is pressed.
Notes:
This function will work properly only when used with
DC_READMODAL().
Examples:
// Let's say that the only valid entries in the field
// "nTimeIncr" are 5, 10, 15, 30, and 60. You would use
// DC_READINCR() as follows:
GetList := {}
@ 10,10 SAY 'Enter Time Increment ' GET nTimeIncr VALID ;
DC_READINCR( @nTimeIncr, { 5,10,15,30,60 } ) .AND. ;
' '+STR(nTimeIncr,2)+' ' $ ' 5 10 15 30 60 ' PICKLIST
dc_readmodal( Getlist )
// If the current value of nTimeIncr is 15, then double-
// clicking on the get will change it to 30.
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readkill()
Return, and/or set, whether current READ should be exited
Syntax:
DC_ReadKill ( < lReadKill > ) - > nil
Arguments:
< lReadKill > sets the DC_READKILL() flag. A value of true (.T.)
indicates that the current read should be terminated, and a value
of false (.F.) indicates that it should not.
Returns:
NIL
Description:
DC_READKILL() is a Get system function that lets you control
whether or not to terminate the current READ.
Unless directly manipulated, DC_READKILL() returns true (.T.)
after you issue a CLEAR GETS, the current READ and otherwise
returns false (.F.).
By accessing the function directly, however, you can control the
DC_READKILL() flag with its function argument and use it to create
new READ Layers.
Notes:
DC_READKILL() works with DC_READMODAL() in the same way that
Clipper's READKILL() works with READMODAL().
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readmodal()
A moused and robust replacement for ReadModal()
Syntax:
DC_ReadModal ( < aGetList >, ;
[< nPos >], ;
[< aActiveArea >], ;
[< lConfirm >], ;
[< nConfRow >], ;
[< lNoUpdateEsc >], ;
[< lProtect >], ;
[< aMsg >], ;
[< bCustomKey >], ;
[< aCustomKeys >], ;
[< lViewEdit >], ;
[< lMouXWrite >], ;
[< lMouRele >], ;
[< lNoHelp >] ) - > lUpdated
Arguments:
< aGetList > is an array containing a list of Get objects to
edit.
< nPos > is the number of the GET to place into focus.
If no parameter is passed then GET #1 will be in focus.
< aActiveArea > is an array of 4 elements:
Element Type Description
------- ---- -----------------------------------------
[1] N Start Row
[2] N Start Column
[3] N End Row
[4] N End Column
[5] A Mouse buttons
(See DC_MOUSEKEY() for specification)
If no array is passed, then if the mouse is clicked outside
any active GETs, it will do nothing. If an array is passed,
an the mouse is clicked outside the array coordinates, the
READ will be terminated exactly the same as hitting the
CTRL-W key.
< lConfirm > if .TRUE. will display a confirmation picklist, if
.FALSE. (default) will exit normally.
< nConfRow > - If a value is passed the confirmation box
will start at the row number of the passed value, otherwise
it will be centered on the screen.
< lNoUpdateEsc > - If .TRUE., the mouse is clicked outside the
active area, and no gets were updated, then Lastkey() will
return K_ESC. If .FALSE. (default), the confirmation box will
be displayed.
< lProtect > - If .TRUE. the user will be allowed to navigate
thru the GET table, but will not be allowed to change any
data in the active gets. If .FALSE. (default), then the Get
list will behave normally.
< aMsg > - This is an optional array of 6 parameters
defining the location of the screen to place messages defined
by the MESSAGE command line parameter in the @SAY..GET command.
Elements 1-4 are the screen coordinates ( nStRow, nStCol,
nEnRow, nEnCol respectively ). Element 5 is a string defining
the color of the message window. Element 6 is a logical value
defining whether or not each message line should be centered in
the message window.
< bCustomKey > - This is a code block which will be evaluated
in the "Apply Key" sub-function of DC_ReadModal(). This routine
checks which key has been pressed and sets the EXITSTATE based
on the key pressed. The default action for keys is the same as
the standard Clipper GET system. You can modify the action for
specified keys by adding your own CASE statements in a function
placed into the < bCustomKey > code block. Three parameters are
passed to your custom function:
1. The Inkey() value of the key pressed.
2. The Get Object that is in focus.
3. The GetList Object.
The < bCustomKey > code-block must return a LOGICAL .TRUE. if the
custom action was accomplished, .FALSE. otherwise.
< aCustomKeys > is an array of INKEY values and code blocks. If
any key is pressed that matches an INKEY value in the array,
the associated code-block will be evaluated.
Element Type Description
------- ---- ------------------------
[1] N INKEY value
[2] B Code block to evaluate when < INKEY > is pressed.
< lViewEdit > if .TRUE. will place DC_ReadModal() in the VIEW/EDIT
toggle mode. In this mode, the GETS start out in VIEW mode. In
VIEW mode the GETS may be navigated in the normal method, but
there will be no cursor displayed and pressing data entry keys
will not cause the GETS to be updated. When the < ENTER > key is
pressed the EDIT mode is enabled at the currently selected GET
and the cursor is displayed. Pressing < ESCAPE > will exit EDIT
mode and reestablish VIEW mode. If this parameter is not passed
or is passed as a .FALSE, then normal editing will be enabled.
< lMouXWrite > if .TRUE. is equivalent to pressing the
< CTRL-END >
or < F10 > key to save the GETS whenever the mouse is clicked
outside the area established by the < aActiveArea > array. If
this parameter is not passed or is passed as a .FALSE., then
clicking the mouse outside the < aActiveArea > region is
equivalent to pressing the < ESCAPE > key.
< lMouRele > if .TRUE. (default) will require that the mouse
button be released and pressed again before it will navigate
to the clicked-on GET. If .FALSE. and the mouse button is
pressed on a GET, the clicked-on GET will immediately be
placed into focus.
< lNoHelp > if .TRUE. will disable the code block that calls
DC_HELPF1() when the F1 key is pressed. The default is .FALSE.
Use this parameter if the F1 key has already been set to a
different procedure.
DC_READMODAL() also supports additional command line parameters
which may be added to the end of your @ SAY...GET command line.
(These options require #include 'DCGET.CH' in your source code):
FORCEVALID
This option will require that the VALID statement in the
GET be evaluated before the Get List can be exited, even if
the GET is never entered by the operator. For example, if you
have a GET that is not allowed to be empty, use this parameter
in conjuction with DC_READEMPTY().
PICKLIST
This option is used to paint a "down arrow" mouse button at
the end of the GET variable on the screen which informs the
operator that an additional picklist will pop-up if the
operator single-clicks on the arrow or double-clicks within
the GET area or if the operator presses the CTRL-J or
CTRL-ENTER key while in the GET area.
DOUBLEPICK
This option is used to paint a "down arrow" and "up arrow"
mouse button at the end of the GET variable on the screen
which informs the operator that clicking on the down arrow
will decrease the value in the GET by the increment value
and clicking on the up arrow will increase the value in the
GET by the increment value. This option was intended to be
used with the DC_ReadIncr() function in the VALID statement.
PREEVAL < block >
This option functions similar to the WHEN clause except it
doesn't return a value and the block is evaluated before the
WHEN block.
POSTEVAL < block >
This option functions similar to the VALID clause except
it doesn't return a value and the block is evaluated before
the VALID block.
MESSAGE < aMessage >
This option is used to display a message on the screen
while the get is in focus. < aMessage > may be a character
string or an array of character strings. The message will be
displayed in the coordinates defined by the DC_READMSG()
function, the SET READ MESSAGE TO < parameters > command, or
the < aMessage > parameter passed to DC_ReadModal().
PROTECT
This option will allow the user to enter the GET but not
make any changes. Any attempt to modify the data will cause
a beep.
HIDE
This option will hide all user input in the GET and display
only an empty GET with the exception of an asterisk * at the
cursor position.
CAPFIRST
This parameter will automatically capitalize the first letter
of each word typed into the GET.
APOINTER
Editing an array of GETS that are displayed in a FOR..NEXT or
DO..WHILE loop using an "incremented" or "decremented" pointer
to each array element is not possible unless the value of the
pointer is stored in CARGO. This can be accomplished very
easily by using the APOINTER < nVar > parameter at the end of
your GET statement. See Example 2.
CHECKBOX [MEMVAR] < xMemVar > [DELIMS < cDelims >]
This option is used to define a GET as a "CHECK BOX". A
check box GET is used to toggle a logical variable whenever
the mouse is clicked in the GET or when the cursor is moved
to the GET and the ENTER key is pressed. The < cDelims >
parameter is a character string of 3 characters defining
the delimeter characters to use to frame the check mark and
the character to use to display the check mark when the
check box is toggled to .TRUE. If the DELIMS suboptions is
not used then the default delimeters is "(*)". < xMemVar > is
the logical memory variable that will be toggled when the check
box is toggled.
RADIOGROUP < nGroup > MEMVAR < xMemVar > [DELIMS
< cDelims >] ;
VALUE < xValue >
This option is used to define a set of GETs as a "RADIO GROUP".
A Radio Group GET is used to set a variable to a specified
value whenever the mouse is clicked in the GET or when the
cursor is moved to the GET and the ENTER key is pressed.
< nGroup > is the number of the radio group that binds the
separate GET items to a group. The < cDelims > parameter is a
character string of 3 characters defining the delimeter
characters to use to frame the check mark and the character to
use to display the check mark when the radio group item is
selected. If the DELIMS suboptions is not used then the
default delimeters is "(*)". < xMemVar > is the memory variable
that will be updated when the radio group item is selected.
< xValue > is the value that will be stored into < xMemVar >
when
the radio group item is selected.
HELPCODE < helpcode >
This option is used to establish which help screen to display.
If F1 or Alt-F1 is pressed while in the GET, the Help Code will be
passed to the Help System. This will override the INPUT VAR,
PROC NAME, and any DC_HELPCODE() and force the dCLIP Help system to
use the code in the GetList.
Returns:
.TRUE. if any gets were updated, .FALSE. otherwise.
Description:
DC_READMODAL() is a direct replacement for the Clipper
ReadModal() function and works identical except that it
recognizes mouse events and will automatically move the
cursor up and down through the gets if the mouse is clicked
within an active get.
DC_READMODAL() also supports extra parameters for
handling mouse-buttons, determining the "active area"
of the screen, etc.
DC_READMODAL() will support scrollable GETS automatically.
GETS can be written anywhere outside the pre-established GET
scroll region yet they will be visible only within the scroll
region. When the cursor is bumped against the scroll
boundaries, the GETS will scroll up/down or left/right. This
technique allows you to design GET screens which are larger
than the physical display size or a designated display window.
DC_READMODAL() makes it possible to edit arrays of GETS that
are written to the screen in a FOR..NEXT loop.
DC_READMODAL() supports additional navigation features to make
it easier to move thru a table of keys via the keyboard.
Alt-UpArrow : Moves to first GET directly above cursor position.
If no GET exists directly above, then moves to
closes GET above cursor position.
Alt-DnArrow : Moves to first GET directly below cursor position.
If no GET exists directly below, then moves to
closest GET below cursor position.
Alt-RtArrow : Moves to first GET directly to the right of the
current GET.
Alt-LtArrow : Moves to first GET directly to the left of the
current GET.
DC_READMODAL() will terminate the GETs by the same method as
ReadModal() unless you have activated CUA-Compliant mode with
DC_READCUA() in which the GETs will be terminated with the
ENTER key.
DC_READMODAL() is "threadsafe". This means that it can be used
as a replacement for ReadModal() when converting Clipper
applications to Xbase++ applications that must maintain multiple
CRT Windows running in separate threads. The function
DC_ReadModalSize() is used to set the default size of the static
array used by DC_READMODAL() to store static GET information. The
default is 10. This means that the application is limited to 10
open threads. DC_ReadModalSize() should be set to the maximum
number of threads expected.
Notes:
See ReadModal() in the Clipper guides for more information.
Use the function DC_UPDATED() in place of UPDATED() if
you are using DC_READMODAL() in place of READMODAL().
Use the function DC_GETACTIVE() in place of GETACTIVE()
if you are using DC_READMODAL() in place of READMODAL().
Use the function DC_KILLREAD() in place of __KILLREAD()
if you are using DC_READMODAL() in place of READMODAL().
Use the function DC_READBOX() to create a modal dialogue
box and mouse-buttons for DC_READMODAL() and to
establish the SCROLL region for the gets.
Use the function DC_READWINDOW() to establish the SCROLL
region for the gets.
Examples:
-- Example 1 --
/* This example shows how DC_READMODAL() can be used
to support pick-lists a memos */
#include "dcget.ch"
LOCAL GetList := {}, aReadArea, cSaveScreen,;
cMemoGet := 'MEMO'
cSaveScreen := DC_ReadBox( 9, 10, 19, 70,, @aReadArea )
@ 11,15 say 'Enter Memo' GET cMemoGet ;
valid dc_readmemo( @cMemo ) PICKLIST PROTECT
@ 12,15 say 'Customer Number ' GET cust_nmbr ;
valid dc_readempty(cust_nmbr) FORCEVALID
@ 13,15 say ' Customer Name ' GET cust_name
@ 14,15 say ' Street ' GET street
@ 15,15 say ' City ' GET city
@ 16,15 say ' State ' GET state ;
valid dc_readclick( @state, {|d|d:=statelist()} ) ;
PICKLIST
@ 17,15 say ' Zip ' GET zip MESSAGE ;
"Must be at least 5 digits"
DC_READMODAL( GetList,, aReadArea,,,,,,;
{|a,b|CustomKey(a,b)} )
Return nil
/* ----------------- */
STATIC FUNCTION CustomKey ( nInkey, oGet )
DO CASE
/* Change PgDn key default action */
CASE nInkey = K_PGDN
oGet:ExitState := GE_BOTTOM
/* Change PgUp key default action */
CASE nInkey = K_PGUP
oGet:ExitState := GE_TOP
OTHERWISE
RETURN .f.
ENDCASE
RETURN .t.
-- Example 2 --
/* This example demonstrates how DC_READMODAL() can be
used to edit and scroll thru an Array of Field Data */
#include "dcget.ch"
LOCAL GetList := {}, aReadArea, cSaveScrn, aData, i
USE DCPRINT
aData := Array(Fcount())
FOR i := 1 TO LEN( aData )
aData[i] := FieldGet(i)
NEXT
cSaveScrn := DC_ReadBox( 10, 10, 20, 60,, @aReadArea )
FOR i := 1 TO LEN(aData)
@ i,12 SAY PADL(Field(i),10) GET aData[i] APOINTER i
NEXT
DC_READMODAL( GetList,,aReadArea )
DC_Impl( cSaveScrn )
RETURN nil
-- Example 3 --
/* This example demonstrates how DC_READMODAL() can be
used to create CHECK BOXES and RADIO GROUPS */
#include 'dcget.ch'
FUNCTION junk
LOCAL GetList := {}, aCheck := {' ','û',' '}, nLength,;
aRadio := {'*',' ',' ','*',' ',' '}, ;
lAscii := .f., lBackup := .t., lPrinter := .f., ;
aReadArea, cComPort, ;
cSaveScrn := DC_ReadBox( 3,5,21,70,,@aReadArea )
/* -- Paint Check Boxes -- */
@ 5,10 TO 11,35
@ 5,12 SAY ' Check options below '
@ 7,12 SAY 'Convert to ASCII ' GET aCheck[1] CHECKBOX ;
MEMVAR lAscii DELIMS '(û)'
@ 8,12 SAY 'Keep Backup File ' GET aCheck[2] CHECKBOX ;
MEMVAR lBackup DELIMS '(û)'
@ 9,12 SAY ' Copy to Printer ' GET aCheck[3] CHECKBOX ;
MEMVAR lPrinter DELIMS '(û)'
/* -- Paint Radio Group 1 -- */
@ 13,10 TO 19,35
@ 13,12 SAY ' Select Page Length '
@ 15,12 SAY ' 40 Lines ' GET aRadio[1] RADIOGROUP 1 ;
MEMVAR nLength DELIMS '(*)' VALUE 40
@ 16,12 SAY ' 55 Lines ' GET aRadio[2] RADIOGROUP 1 ;
MEMVAR nLength DELIMS '(*)' VALUE 55
@ 17,12 SAY ' 66 Lines ' GET aRadio[3] RADIOGROUP 1 ;
MEMVAR nLength DELIMS '(*)' VALUE 66
/* -- Paint Radio Group 2 -- */
@ 13,40 TO 19,65
@ 13,42 SAY ' Select Com Port '
@ 15,42 SAY ' Com 1 ' GET aRadio[4] RADIOGROUP 2 ;
MEMVAR cComPort DELIMS '(*)' VALUE 'COM1'
@ 16,42 SAY ' Com 2 ' GET aRadio[5] RADIOGROUP 2 ;
MEMVAR cComPort DELIMS '(*)' VALUE 'COM2'
@ 17,42 SAY ' Com 3 ' GET aRadio[6] RADIOGROUP 2 ;
MEMVAR cComPort DELIMS '(*)' VALUE 'COM3'
DC_READMODAL( GetList,,aReadArea )
DC_Impl( cSaveScrn )
RETURN { lAscii, lBackup, lPrinter, nLength, cComport }
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_reader()
dc_readbox()
dc_readmodalsize()
dc_readmodalsize()
Set the size of the static array for DC_ReadModal()
Syntax:
DC_ReadModalSize ( [< nSize >] ) - > nOldSize
Arguments:
< nSize > is the maximum number of threads in the application.
Returns:
A numeric value equal to the previous size.
Description:
DC_ReadModal() is "threadsafe". This means that it can be used
as a replacement for ReadModal() when converting Clipper
applications to Xbase++ applications that must maintain multiple
CRT Windows running in separate threads. The function
DC_READMODALSIZE() is used to set the default size of the static
array used by DC_ReadModal() to store static GET information. The
default is 10. This means that the application is limited to 10
open threads. DC_READMODALSIZE() should be set to the maximum
number of threads expected.
Examples:
DC_READMODALSIZE( 15 )
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readnav()
Enable an alternative navigation method for GETS
Syntax:
DC_ReadNav ( [< lMode >] ) - > lMode
Arguments:
< lMode > if .TRUE. will set the alternate navigation
method. The default is .FALSE.
Returns:
The current setting.
Description:
DC_READNAV( .t. ), is used to set the alternate navigation
method when using DC_ReadModal(). Normal navigation in
GETS has the DOWN, ENTER and TAB keys moving to the next
get in the Get List and the UP and SHIFT-TAB key moving to
the previous Get in the Get List. In the alternate method
the ENTER key still behaves the same, however the TAB key
will move to the next get to the right of the get in focus
in the same row, the SHIFT-TAB key will move to the next
get to the left of the get in focus in the same row, and
the UP and DOWN keys will move to the closest GET on the
screen that is above or below the get in focus. The
Alternate Navigation mode is also toggled by the ALT-N key.
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readalt()
dc_readcua()
dc_readvar()
Update a check box or Radio Button GET
Syntax:
DC_ReadVar ( [< xMemVar >], ;
[< nElement >], ;
[< xValue >], ;
[< lCheck >], ;
[< cMemVar >] ) - > nil
Arguments:
@< xMemVar > is the value of the memvar to update. If this
parameter is not passed then the name of a PRIVATE or
PUBLIC memvar must be passed as < cMemVar >.
< nElement > is used only if < xMemVar > is an array. The
value of this parameter determines which array element to
update.
< xValue > is used only if < xMemVar > or < cMemVar >
is a
Radio Button and not a Check Box. This is the value to
stuff into < xMemVar > or &< xMemVar >.
< lCheck > if .TRUE. establishes < xMemVar > as a logical
Check
box memvar, otherwise it is a Radio Button memvar of any
type.
Returns:
NIL
Description:
DC_READVAR() is a function designed to be used in a code
block that is passed to DC_ADDCARGO() and evaluated when
the mouse is clicked in a Radio Button or Check Box GET.
See the DCGET.CH file for examples of how to use DC_READVAR().
Notes:
This function must be used with DC_READMODAL().
Examples:
See DCGET.CH
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_addcargo()
dc_readwindow()
Establish scroll-region for DC_ReadModal() GETS
Syntax:
DC_ReadWindow ( [< aCoord >] ) - > aCoord
Arguments:
< aCoord > is an array containing the screen coordinates.
Element Type Description
------- ---- -----------------------------------------
[1] N Start Row
[2] N Start Column
[3] N End Row
[4] N End Column
Returns:
An array containing the previously established screen
coordinates.
Description:
DC_READWINDOW() is used to establish a window area of the
screen to be used by the next call to DC_READMODAL().
DC_READMODAL() will support scrollable GETS automatically.
GETS can be written anywhere outside the pre-established GET
scroll region yet they will be visible only within the scroll
region. When the cursor is bumped against the scroll
boundaries, the GETS will scroll up/down or left/right. This
technique allows you to design GET screens which are larger
than the physical display size or a designated display window.
DC_READWINDOW() stores the coordinates of the screen
to a static array which is later monitored by DC_GETDEVOUT(),
DC_GETDISPLAY(), and DC_READMODAL() to prevent @SAY..GETS
from being displayed outside the window region. Such GETS
will be added to the Get List but will only be accessible
when the Get List is "scrolled" by bumping against the
scroll boundaries with a cursor key.
Notes:
DC_READWINDOW() must be called before displaying any GETS
with the @SAY..GET command.
Examples:
#include "dcget.ch"
LOCAL GetList := {}, aData, i
USE DCPRINT
aData := Array(Fcount())
FOR i := 1 TO LEN( aData )
aData[i] := FieldGet(i)
NEXT
DC_READWINDOW( { 10, 10, 20, 60 } )
FOR i := 1 TO LEN(aData)
@ i,12 SAY PADL(Field(i),10) GET aData[i] APOINTER i
NEXT
DC_ReadModal( GetList,,aReadArea )
RETURN nil
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_readbox()
dc_recall()
Recall record(s) that were previously marked for deletion
Syntax:
DC_Recall() - > lStatus
Arguments:
None.
Returns:
A logical .TRUE. if records were recalled successfully, .FALSE.
otherwise.
Description:
DC_Recall() is used to recall records which were previously
marked for deletion based on a set of conditions. A GUI dialog
is displayed for the user to select the conditions.
Examples:
. USE EXPRESS INDEX EXPRESS.CDX SHARED
. DC_Recall()
Source/Library:
_DCDELE.PRG, DCLIP1.DLL
See Also:
dc_delete()
dc_reclock()
Lock the current record
Syntax:
DC_RecLock ( [< nWaitTime >], ;
[< lDisplayError >] ) - > lStatus
Arguments:
< nWaitTime > is the number of seconds to wait for the system to
return a lock before returning the status or the error message.
(0 = wait forever).
< lDisplayError > if .true. will display an operator error
message if the record cannot be locked. (default) or if .false.
will not display an error message to the operator.
Returns:
A logical .TRUE. if the record is successfully locked.
Description:
DC_RECLOCK() is used to lock the currently selected record
before attempting to replace field data.
Examples:
if DC_RECLOCK( 5 )
replace cust_nmbr with cCustNmbr
else
break
endif
Source/Library:
_DCLOCK.PRG, DCLIPX.DLL
See Also:
dc_addrec()
dc_filock()
dc_rectag()
Build or add to a Record Tag Array
Syntax:
DC_RecTag( [< lClear >], ;
[< aTags >], ;
[< bFor >], ;
[< bWhile >], ;
[< nNext >], ;
[< nRec >], ;
[< lRest >] ) - > aTags
Arguments:
< lClear > will remove record numbers from the tag array that
meet the specified conditions, otherwise records will be
added.
< aTags > is an existing array of record numbers which will
display the TAG marker in the browse display. If no
argument is given then the public DCTAGS array will be
used.
See the Xbase++ DBEVAL() function on how to use the < bFor >,
< bWhile >, < nNext >, < nRec >, < lRest >
parameters.
Returns:
A pointer to an array of tagged numbers.
Description:
DC_RECTAG() is used to add or remove record numbers from
an array of record numbers that can be used with all database
commands for performing database operations on records that
are "tagged".
DC_RECTAG() will first check for a logical field in the
database named "TAG" and will operate on this field. If this
field does not exist, it will operate on a PUBLIC array named
DCTAGS.
Notes:
CAUTION: The eXPress++ tagging system is designed for ad-hoc
tagging of records using simple menu selection and database
commands. You will notice a gradual speed detioration as you
add more records to the tag array when browsing. This is
because the DC_TAGGED() function must scan more records in the
array. It is recommend that you refrain from tagging more than
1000 records or you may experience unacceptable slowness
during browsing.
If you need a tagging system that will support a much larger
number of records, it is recommended that you add a TAG
(logical) field to your database.
Examples:
. use customer
. dc_rectagclear()
. aTags := {}
// tag all records with a balance greater than 0
. aTags := DC_RECTAG(.f., aTags, {||balanceɬ} )
// untag all records in Los Angeles
. aTags := DC_RECTAG(.t., aTags, {||zip='90'.or.zip='91'} )
. list cust_name for dc_tagged(aTags)
Source/Library:
_DCRTAG.PRG, DCLIP2.DLL
See Also:
dc_rectagclear()
dc_tagrecord()
dc_rectagarray()
dc_rectagtoggle()
TAG
dc_rectagarray()
Gets or Sets the array to be used for Record Tagging
Syntax:
DC_RecTagToggle ( [< aTags >] ) - > < aOldTags >
Arguments:
< aTags > is an array of tags. If no array is passed then
the currently selected work area portion of the public
DCTAGS array will used.
Returns:
A pointer to an array of tagged numbers.
Description:
DC_RecTagArray() is used to Get or Set a pointer to the array
that will be used for all record tagging operations.
Notes:
CAUTION: The eXPress++ tagging system is designed for ad-hoc
tagging of records using simple menu selection and database
commands. You will notice a gradual speed detioration as you
add more records to the tag array when browsing. This is
because the DC_TAGGED() function must scan more records in the
array. It is recommend that you refrain from tagging more than
1000 records or you may experience unacceptable slowness
during browsing.
If you need a tagging system that will support a much larger
number of records, it is recommended that you add a TAG
(logical) field to your database.
Examples:
use customer
dc_rectag(,,{||balanceɬ})
count to x for dc_tagged()
? x
123
DC_RECTAGCLEAR()
count to x for dc_tagged()
? x
0
Source/Library:
_DCRTAG.PRG, DCLIP2.DLL
See Also:
dc_rectag
dc_tagrecord()
dc_rectagclear()
Clear the Record Tag Array
Syntax:
DC_RecTagClear ( [< aTags >] ) - > nil
Arguments:
< aTags > is an array of tags. If no array is passed then
the currently selected work area portion of the public
DCTAGS array will be cleared.
Returns:
A pointer to an array of tagged numbers.
Description:
DC_RECTAGCLEAR() will clear out all tags in the public DCTAGS
array for the current work area.
Notes:
CAUTION: The eXPress++ tagging system is designed for ad-hoc
tagging of records using simple menu selection and database
commands. You will notice a gradual speed detioration as you
add more records to the tag array when browsing. This is
because the DC_TAGGED() function must scan more records in the
array. It is recommend that you refrain from tagging more than
1000 records or you may experience unacceptable slowness
during browsing.
If you need a tagging system that will support a much larger
number of records, it is recommended that you add a TAG
(logical) field to your database.
Examples:
use customer
dc_rectag(,,{||balanceɬ})
count to x for dc_tagged()
? x
123
DC_RECTAGCLEAR()
count to x for dc_tagged()
? x
0
Source/Library:
_DCRTAG.PRG, DCLIP2.DLL
See Also:
dc_rectag
dc_tagrecord()
dc_rectagarray()
TAG CLEAR
dc_rectagtoggle()
Toggle the Record Tag on the current record
Syntax:
DC_RecTagToggle ( [< aTags >] ) - > nil
Arguments:
< aTags > is an array of tags. If no array is passed then
the currently selected work area portion of the public
DCTAGS array will be cleared.
Returns:
A pointer to an array of tagged numbers.
Description:
DC_RecTagToggle() is used to toggle the value of the record tag
on the current record. If the record number exists in the tag
array, then it will be removed, otherwise it will be added.
Notes:
CAUTION: The eXPress++ tagging system is designed for ad-hoc
tagging of records using simple menu selection and database
commands. You will notice a gradual speed detioration as you
add more records to the tag array when browsing. This is
because the DC_TAGGED() function must scan more records in the
array. It is recommend that you refrain from tagging more than
1000 records or you may experience unacceptable slowness
during browsing.
If you need a tagging system that will support a much larger
number of records, it is recommended that you add a TAG
(logical) field to your database.
Examples:
use customer
dc_rectag(,,{||balanceɬ})
count to x for dc_tagged()
? x
123
DC_RECTAGCLEAR()
count to x for dc_tagged()
? x
0
Source/Library:
_DCRTAG.PRG, DCLIP2.DLL
See Also:
dc_rectag
dc_tagrecord()
dc_rectagarray()
TAG CLEAR
dc_regdelete()
Delete a key from the Windows Registry
Syntax:
DC_RegQuery( [< nHKey >], ;
< cRegSubKey > ) - > lSuccess
Arguments:
< nHKey > is the key value of the registry item to query. The
default is HKEY_LOCAL_MACHINE. The available options are defined
in DCREG.CH.
HKEY_NO_KEY
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
< cRegSubKey > is the sub key in the registry.
Returns:
The value stored in the registry. This may be a value of any
type.
Description:
DC_REGDELETE() is used to delete a key from the Windows Registry.
Examples:
DC_RegDelete( HKEY_LOCAL_MACHINE, '\Donnay Software\eXpress++' )
Source/Library:
_DCREG.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_regwrite()
dc_regquery()
dc_regdeletevalue()
Delete a value from the Windows Registry
Syntax:
DC_RegQuery( [< nHKey >], ;
< cRegSubKey >, ;
< cEntryName > ) - > lSuccess
Arguments:
< nHKey > is the key value of the registry item to query. The
default is HKEY_LOCAL_MACHINE. The available options are defined
in DCREG.CH.
HKEY_NO_KEY
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
< cRegSubKey > is the sub key in the registry.
< cEntryName > is the name of the value in the registry.
Returns:
A numeric 0 if the delete was successful, otherwise a Windows error code.
Description:
DC_RegDeleteValue() is used to delete a value from the Windows Registry.
Examples:
DC_RegDelete( HKEY_LOCAL_MACHINE, '\Donnay
Software\eXpress++\windows','MainWindow' )
Source/Library:
_DCREG.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_regwrite()
dc_regquery()
dc_regdelete()
dc_regionarray()
Return an array of region coordinates for a dialog
Syntax:
DC_RegionArray( < nMode >, ;
< nWidth >, ;
< nHeight > ) - > aRegion
Arguments:
< nMode > is a numeric value defined in DCDIALOG.CH.
See the below table.
< nMode > Description
----------------------- ----------------------------------------
DCGUI_REGION_OCTAGON Octagon shape
DCGUI_REGION_DIAMOND Diamond shape
DCGUI_REGION_ELLIPSE Ellipse or circle
< nWidth > is the width in pixels of the region.
< nHeight > is the height in pixels of the region.
Returns:
A multidimensional array.
Description:
DC_RegionArray() returns a multi-dimensional array which can
be used by @ .. DCPUSHBUTTON or by any other dialog window to
crop the dialog to a specified shape. DC_RegionArray() will
return an array for creating Octagon, Diamond, or Ellipse
pushbuttons or dialogs.
Examples:
* ---- Example 1 ---- *
// Circular region of 100 pixels width and height
@ 0,330 DCPUSHBUTTON ;
STATIC ;
ACTION {||msgbox('Ugh')} ;
SIZE 100,100 ;
REGION DC_RegionArray( DCGUI_REGION_ELLIPSE, 100 ) ;
PIXEL ;
FANCY ;
BITMAP 'smileyup.jpg','smileydown.jpg','smileyneutral.jpg'
* ---- Example 2 ----- *
oDlg := XbpDialog():new(AppDeskTop(),,{0,0},{100,100})
oDlg:create()
aRegion := DC_RegionArray( DCGUI_REGION_OCTAGON, 100 )
DC_SetRegion( oDlg, aRegion )
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_setregion()
dc_setregionellipse()
@ DCPUSHBUTTON
dc_regquery()
Read a parameter from the Windows Registry
Syntax:
DC_RegQuery( [< nHKey >], ;
< cRegSubKey >, ;
< cEntryName > ) - > xValue
Arguments:
< nHKey > is the key value of the registry item to query. The
default is HKEY_LOCAL_MACHINE. The available options are defined
in DCREG.CH.
HKEY_NO_KEY
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
< cRegSubKey > is the sub key in the registry.
< cEntryName > is the entry name of the item.
Returns:
The value stored in the registry. This may be a value of any
type.
Description:
DC_REGQUERY() is used to read a specified value from the Windows
registry.
Examples:
Examples:
? DC_RegQuery( nil, 'SYSTEM\Setup', 'SystemPartition' )
\Device\Harddis0\Partition1
? DC_RegQuery( nil, 'Software\Clients\Contacts', '' )
Address Book
? DC_RegQuery( nil, 'Software\Clients\Mail', '' )
Outlook Express
? DC_RegQuery( nil, 'Software\Clients\Mail', 'Outlook Express' )
Outlook Express
? DC_RegQuery( nil, 'Software\Clients\Mail\Outlook Express', ;
DLLName )
C:\Program Files\Outlook Express\msimnui.dll
Source/Library:
_DCREG.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_regwrite()
dc_iniread()
dc_regqueryautorestore()
displays a dialog that lists all item in the registry defined by DC_Au
Syntax:
DC_RegQueryAutoRestore() - > NIL
Description:
DC_RegQueryAutoRestore() displays a dialog with 2 browses.
(1) lists all items in the Windows section of the registry that is
defined by DC_AutoRestoreWindow().
(2) lists all items in the Browse section of the registry that is
defined by DC_AutoRestoreBrowse().
Items can be tagged for deletion.
Source/Library:
_DCREG.PRG, DCLIPX.DLL
See Also:
dc_autorestorewindow()
dc_regquerybranch()
Returns all the values of a registry branch into an array.
Syntax:
DC_RegQueryBranch( < nHKey >, ;
< cSubKey >, ;
< nKey > ) - > < aBranch >
Arguments:
< nHKey > is the key value of the registry item to query. The
default is HKEY_LOCAL_MACHINE. The available options are defined
in DCREG.CH.
HKEY_NO_KEY
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
< cRegSubKey > is the sub key in the registry.
Description:
DC_ReqQueryBranch() returns all the values of a registry branch
into an array. The array will contain the value name plus the data.
Source/Library:
_DCREG.PRG, DCLIPX.DLL
See Also:
dc_regquery()
dc_regquerybranch()
Returns all the values of a registry branch into an array.
Syntax:
DC_RegQueryBranch( < nHKey >, ;
< cRegSubKey >, ;
< nKey > ) - > < aBranch >
Arguments:
< nHKey > is the key value of the registry item to query. The
default is HKEY_LOCAL_MACHINE. The available options are defined
in DCREG.CH.
HKEY_NO_KEY
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
< cRegSubKey > is the sub key in the registry.
< cEntryName > is the entry name of the item.
Description:
DC_ReqQueryBranch() returns all the values of a registry branch
into an array. The array will contain the value name plus the data.
Source/Library:
_DCREG.PRG, DCLIPX.DLL
See Also:
dc_regquery()
dc_regwrite()
Write a parameter to the Windows Registry
Syntax:
DC_RegWrite( [< nHKey >], ;
< cRegSubKey >, ;
< cEntryName >, ;
< xValue >, ;
[< nType >] ) - > lStatus
Arguments:
< nHKey > is the key value of the registry item to write. The
default is HKEY_LOCAL_MACHINE. The available options are defined
in DCREG.CH.
HKEY_NO_KEY
HKEY_CLASSES_ROOT
HKEY_CURRENT_USER
HKEY_LOCAL_MACHINE
HKEY_USERS
< cRegSubKey > is the sub key in the registry.
< cEntryName > is the entry name of the item.
< xValue > is the value to write. This may be any data type that
can be converted to a binary value with a maximum length of 32k.
< nType > is the type of value to store to the registry.
If this parameter is not used, then the type is calculated from the
valtype of < xValue >.
Returns:
A logical value.
Description:
DC_REGWRITE() is used to write a specified value to the Windows
registry.
Examples:
DC_RegWrite( nil, 'Software\eXPress++', 'UserID', 'BEAR' )
DC_RegWrite( nil, 'Software\eXPress++', 'UserPassword', ;
DC_Encrypt(cPassWord) )
Source/Library:
_DCREG.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_regquery()
dc_iniwrite()
dc_replace()
Assign new values to field variables using GUI dialog
Syntax:
DC_Replace() - > lStatus
Arguments:
None.
Returns:
A logical .TRUE. if the replacement was successful.
Description:
DC_Replace() is used to assign new values to field variables
in the current database, based on conditions selected in a
GUI dialog.
Replacement values may be literal or expressions.
A progress bar is constantly updated during the replacement and
records are automatically locked and unlocked thus allowing
replacements on shared databases.
Examples:
. USE COLLECT
. DC_Replace()
Source/Library:
_DCREPL.PRG, DCLIP2.DLL
dc_restoreevents()
Restore all events in the event queue from an array
Syntax:
DC_RestoreEvents( < aEvents > ) - > NIL
Arguments:
< aEvents > is a two-dimensional array that was created with
DC_SaveEvents().
Returns:
Nil.
Description:
DC_SaveEvents() will save all events in the event queue of the
current thread to an array and clear all pending events from the
event Queue. The event queue can then be later restored by
DC_RESTOREEVENTS(). This is sometimes necessary to affect correct
behavior of dialog windows when a series of events must be
interrupted to display a new window.
Source/Library:
_DCFUNCT.PRG/.OBJ, DCLIPX.DLL
See Also:
dc_completeevents()
dc_clearevents()
dc_saveevents()
dc_restset()
Restore all SETs from an array
Syntax:
DC_RestSet ( < aSets > ) - > nil
Arguments:
< aSets > is an array created by DC_SAVESET().
Returns:
nil
Description:
DC_RESTSET() will restore the Clipper SET environment from an
array created by DC_SAVESET(). The Clipper SET environment
consists of 38 variables which are modified with the SET()
function. DC_SAVESET() provides a method of saving an
environment to be restored by DC_RESTSET().
Examples:
aSaveSet := dc_saveset()
set default to \customer\data
set path to \myreport
set printfile to print.txt
use customer
report form custlist
DC_RESTSET( aSetSave )
Source/Library:
_DCSETK.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_saveset()
dc_reuseexclusive()
Re-Use a database Exclusive
Syntax:
DC_ReUseExclusive() - > lStatus
Arguments:
None.
Returns:
A logical .TRUE. if the file is already opened exclusive or
if the file could be reopened exclusive, .FALSE. otherwise.
Description:
DC_ReUseExclusive() is a handy function for testing if a file
is already opened exclusive. If not, it prompts the operator
with the choice to reopen it exclusive to complete the
operation.
Examples:
USE COLLECT SHARED
lOk := DC_ReUseExclusive()
IF lOk
dbZap()
ELSE
DC_WinAlert( 'Sorry, try again later' )
ENDIF
Source/Library:
_DCUSE.PRG
See Also:
dc_usearea()
dc_saveevents()
Clear all events out of the Event Queue
Syntax:
DC_SaveEvents() - > aEvents
Arguments:
None.
Returns:
A two-dimensional array.
Description:
DC_SAVEEVENTS() will save all events in the event queue of the
current thread to an array and clear all pending events from the
event Queue. The event queue can then be later restore by
DC_RestoreEvents(). This is sometimes necessary to affect correct
behavior of dialog windows when a series of events must be
interrupted to display a new window.
Source/Library:
_DCFUNCT.PRG/.OBJ, DCLIPX.DLL
See Also:
dc_completeevents()
dc_clearevents()
dc_restoreevents()
dc_saveset()
Save all SETs to an array
Syntax:
DC_SaveSet () - > aSets
Arguments:
None
Returns:
An array that contains the contents of the SET environment.
Description:
DC_SAVESET() will save the Clipper SET environment to an array.
The Clipper SET environment consists of 38 variables which are
modified with the SET() function. DC_SAVESET() provides a
method of saving an environment to be restored by DC_RESTSET().
Examples:
aSaveSet := DC_SAVESET()
set default to \customer\data
set path to \myreport
set printfile to print.txt
use customer
report form custlist
dc_restset( aSetSave )
Source/Library:
_DCSETK.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_restset()
dc_say()
Perform @..SAYs relative to coordinates in dc_expl() window
Syntax:
DC_Say ( [< aSaveScreen >], ;
< nRow >, ;
< nCol >, ;
< cText >, ;
[< lOk >], ;
[< cFont >], ;
[< cColor >] ) - > nil
Arguments:
< aSaveScreen > is an array of screen information that was
originally returned by DC_EXPL(). If no parameter is
passed, then the static array posted by the last usage of
DC_EXPL() or the DCEXPLODE command will be used for the
screen information. If no call to DC_EXPL() or DCEXPLODE
is made since the last call to DC_IMPL() or DCIMPLODE,
then the text is written to the CRT window and treated as
a normal @..SAY.
< nRow > is the row position within the window. If the
RELATIVE parameter was passed to DC_EXPL() when the window
was created, then this must be a coordinate which is
relative to 0,0 of the window, otherwise it must be relative
to 0,0 of the screen.
< nCol > is the column position within the window. If the
RELATIVE parameter was passed to DC_EXPL() when the window
was created, then this must be a coordinate which is
relative to 0,0 of the window, otherwise it must be relative
to 0,0 of the screen.
< cText > is the text to display.
< lOk > if .TRUE. will display an "OK" button on the bottom
of the Window and pause program execution until the user
hits ENTER or clicks the mouse on the OK button.
< cFont > if passed, will override the font that was passed
to DC_EXPL() for this Say object only, otherwise the
default font will be used. This parameter is used in GUI
mode only.
< cColor > is a valid Clipper color string. If this parameter
is not passed, then the background color of the window will
be used.
Returns:
NIL
Description:
DC_SAY() is a Dual-Mode function which is used to write text
to a window that was created by DC_EXPL(). This function uses
either "relative" addressing so the text written in the window
is relative to the starting coordinates of the window or
"fixed" addressing so the text written in the window is
relative to the starting screen coordinates. Fixed addressing
is provided for compatibility with existing Clipper applications
that are being migrated to Xbase++.
Examples:
PROCEDURE XTest()
LOCAL aText
aText := { "Enter a name to search.",;
"The name must start with",;
"an alphabet character" }
_disp_msg( 10,10,16,40,aText )
RETURN
/* --------- */
STATIC PROCEDURE _disp_msg ( nSrow, nScol, nErow, nEcol, aText )
LOCAL cScreen, i
DC_Gui(.t.) // display a gui dialogue
cScreen := dc_expl( nSrow, nScol, nErow, nEcol )
for i := 1 to len(aText)
DC_SAY( cScreen, i+1, 2, aText[i] )
next
DC_Pause(3)
DC_Impl(cScreen)
RETURN
Source/Library:
_DCEXPL.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_expl()
dc_saycenter()
Write a string in the center of an area of the screen
Syntax:
DC_SayCenter ( < nRow >, ;
< nStCol >, ;
< nEnCol >, ;
< cString > ) - > nil
Arguments:
< nRow > is the row position of the screen.
< nStCol > is the start column.
< nEnCol > is the end column.
< cString > is the string to say.
Returns:
NIL
Description:
DC_SAYCENTER() is a handy way to write a string exactly in
the center of a defined area of the screen.
Examples:
dc_expl( 12, 20, 14, 50 )
DC_SAYCENTER( 13, 20, 50, 'Center this' )
Source/Library:
_DCSAY.PRG/.OBJ, DCLIPX.LIB
dc_scopeexpress
Use eXPress++ scoping system in lieu of Xbase++
Syntax:
DC_ScopeExpress( [< lScopeExpress >] ) - > lOldSetting
Arguments:
< lScopeExpress > if .TRUE. will enable the eXPress++ scoping
system. If .FALSE. and the version of Xbase++ is 1.7 or later,
the Xbase++ scoping system will be used.
Description:
DC_ScopeExpress(.T.) is used to override the Xbase++ scoping
system (Xbase++ 1.7 and later) and use the eXPress++ scoping
system when using the following functions:
DC_SetScope()
DC_ClrScope()
DC_DbGoTop()
DC_DbGoBottom()
DC_DbSkip()
DC_DbSeek()
DC_DbLocate()
Normally, calls to the above functions will simply be routed to
the associated Xbase++ function. For example, DC_SetScope() will
call dbSetScope(). Due to reports that the Xbase++ 1.7 scoping
system does not behave correctly in existing eXPress++ applications
DC_ScopeExpress(.T.) will correct the problem.
It has since been reported that scoping in Xbase++ 1.8
behaves correctly, therefore DC_ScopeExpress(.t.) is not
needed with Xbase++ 1.8.
Source/Library:
_dcscope.prg
See Also:
dc_setscope()
dc_scrldata()
Display a database vertical scroll bar
Syntax:
DC_ScrlData( < nStartRow >, ;
< nEndRow >, ;
< nColumn >, ;
< lDispBar >, ;
< xScopeTop >, ;
< xScopeBottom > ) - > nRowPointer
Arguments:
< nStartRow > is the start display row.
< nEndRow > is the end display row.
< nColumn > is the display column.
< lDispBar > if .TRUE. (default) will display the bar,
otherwise only the row pointer will be returned.
< xScopeTop > and < xScopeBottom > are optional values to
determine the number of active records for calculating the
position of the scroll bar. This will work only if an index
is selected and the scope values match the current index.
Returns:
The row position of the scroll-bar.
Description:
DC_SCRLDATA() is used to display a vertical scroll bar on
the screen to show the relative position of the current
record pointer within the database.
This function will worked with indexed or non-indexed
databases but not with "filtered" databases. A thumb 'þ'
character is displayed in the scroll bar in the row
position representative of the relative position of the
current record within the database. If the relative
position cannot be calculated then only the background
characters of the scroll bar will be displayed and a '?'
will be displayed at the first row position of the
scroll-bar.
Notes:
If the scroll-bar slows down your system on large
indexed databases, then it can be enabled or disabled
on the fly with DC_SCRLDENABLE().
Examples:
use customers index custname
// display relative position of current record pointer
// for all customers starting with "H" and ending with "R"
DC_SCRLDATA( 0, 24, 79, .t., "H", "R" )
Source/Library:
_DCSCRLD.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_scrldmou()
dc_scrldmou()
Return a record pointer from database scroll-bar mouse-click
Syntax:
DC_ScrlDMou( < nStartRow >, ;
< nEndRow >, ;
< nMouseRow >, ;
< xScopeTop >, ;
< xScopeBottom >, ;
[< lPageMode >] ) - > nRecNo
Arguments:
< nStartRow > is the start display row.
< nEndRow > is the end display row.
< nMouseRow > is clicked row of the mouse.
< xScopeTop > and < xScopeBottom > are optional values to
determine the number of active records for calculating the
position of the scroll bar. This will work only if an index
is selected and the scope values match the index key.
< lPageMode > if .TRUE. (default ) will return a value that
is one page higher than < nCurrVal > if the mouse is clicked
below the current pointer or a value that is one page
lower than the < nCurrVal > if the mouse is clicked above
the current pointer. If < lPageMode > is .FALSE. then the
value returned is a number proportional to the mouse-click
position within the scroll-bar region.
Returns:
A record number to GO TO.
Description:
DC_SCRLDATA() is used to display a vertical scroll bar on
the screen to show the relative position of the current
record pointer within the database.
This function will worked with indexed or non-indexed
databases but not with "filtered" databases. A 'þ'
character is displayed in the scroll bar in the row
position representative of the relative position of the
current record within the database. If the relative
position cannot be calculated then only the background
characters of the scroll bar will be displayed.
Examples:
use customers index custname
// return record pointer based on scroll-bar mouse-click
// for all customers starting with "H" and ending with "R"
dc_mougetpos( @nMouseRow, @nMouseCol )
nRecNo := DC_SCRLDMOU( 0, 24, nMouseRow, "H", "R" )
Source/Library:
_DCSCRLD.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_scrldata()
dc_scrlvmou()
dc_scrldthumb()
Enable display of database vertical scroll bar thumb
Syntax:
DC_ScrlDThumb( < lEnable > ) - > lStatus
Arguments:
< lEnable > if .TRUE. will enable the thumb, otherwise it will
be disabled.
Returns:
A logical value equal to the current setting.
Description:
DC_SCRLDTHUMB() is used to enable or disable the display
of the thumb "þ" within the scroll-bar region of the
vertical scroll-bars on database browse windows. This is
a relative position indicator that is calculated on
indexed databases by a special algorithm that can consume
time on large databases and thereby cause "pauses" in the
browse window updates. If these pauses start becoming
noticable or cause unacceptable performance, then it is
recommended that you disable the scroll-bar thumb with
DC_SCRLDTHUMB(.f.) in your source code, SET THUMB OFF
at the dot-prompt or THUMB=OFF in your DCLIP.SYS file.
Examples:
use customers index custname
DC_SCRLDTHUMB( .f. ) // speed up browsing
dc_browsedb()
use testdata index testdata
DC_SCRLDTHUMB( .t. ) // show relative position
dc_browsedb()
Source/Library:
_DCSCRLD.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_scrldata()
dc_scrlhbar()
Display a horizontal scroll bar
Syntax:
DC_ScrlHBar( < nStartCol >, ;
< nEndCol >, ;
< nRow >, ;
< nCurVal >, ;
< nMinVal >, ;
< nMaxVal > ) - > nColPointer
Arguments:
< nStartCol > is the start display column.
< nEndCol > is the end display column.
< nRow > is the display row.
< nCurVal > is the current value. This could be an array
element.
< nMinVal > is the minimum value. If an array, then this
should be 1 or the minimum selectable value.
< nMaxVal > is the maximum value. If an array, then this
should be the number of items in the array or the maximum
selectable value.
Returns:
The column position of the scroll bar.
Description:
DC_SCRLHBAR() is used to display a horizontal scroll bar
on the screen to show the relative position of an array
pointer within the array or the relative position of a
numeric pointer between minimum and maximum selectable
values.
Examples:
aFields := array(fcount())
aFields( aFields ) // create an array of field names
nPointer := 10
// display scroll bar showing relative position
DC_SCRLHBAR( 0, 79, 24, nPointer, 1, LEN(aFields )
Source/Library:
_DCSCRL.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_scrlhmou()
dc_scrlvbar()
dc_scrlhmou()
Return an array pointer from horizontal scroll-bar mouse-click
Syntax:
DC_ScrlHMou( < nStartCol >, ;
< nEndCol >, ;
< nMouseCol >, ;
< nMinVal >, ;
< nMaxVal >, ;
< nCurrVal >, ;
[< lIncrMode >] ) - > nPointer
Arguments:
< nStartCol > is the start display column.
< nEndCol > is the end display column.
< nMouseCol > is the clicked mouse column.
< nMinVal > is the minimum value. If an array, then this
should be 1 or the minimum selectable value.
< nMaxVal > is the maximum value. If an array, then this
should be the number of items in the array or the maximum
selectable value.
< nCurrVal > is the current value. This is needed to
determine the relative position of the mouse with respect
to the current position.
< lIncrMode > if .TRUE. (default )will return a value that is
one number higher than < nCurrVal > if the mouse is clicked
to the right of the current pointer or a value that is one
number lower than the < nCurrVal > if the mouse is clicked
to the left of the current pointer. If < lIncrMode > is
.FALSE. then the value returned is a number proportional
to the mouse-click position within the scroll-bar region.
Returns:
A pointer to an array element.
Description:
DC_SCRLHMOU() is used with a horizontal scroll bar on
the screen to return an array pointer based on the
relative mouse-click position within the scroll bar.
Examples:
aFields := array(fcount())
aFields( aFields ) // create an array of field names
// get an array element based on mouse position
dc_mougetpos( @nMouseRow, @nMouseCol )
nPointer := ;
DC_SCRLHMOU( 0, 79, 24, nMouseCol, 1, LEN(aFields )
? aFields[nPointer]
Source/Library:
_DCSCRL.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_scrlhbar()
dc_scrlvbar()
dc_scrlvbar()
Display a vertical scroll bar
Syntax:
DC_ScrlVBar( < nStartRow >, ;
< nEndRow >, ;
< nColumn >, ;
< nCurVal >, ;
< nMinVal >, ;
< nMaxVal > ) - > nRowPointer
Arguments:
< nStartRow > is the start display row.
< nEndRow > is the end display row.
< nColumn > is the display column.
< nCurVal > is the current value. This could be an array
element.
< nMinVal > is the minimum value. If an array, then this
should be 1 or the minimum selectable value.
< nMaxVal > is the maximum value. If an array, then this
should be the number of items in the array or the maximum
selectable value.
Returns:
The row position of the scroll-bar.
Description:
DC_SCRLVBAR() is used to display a vertical scroll bar on
the screen to show the relative position of an array
pointer within the array or the relative position of a
numeric pointer between minimum and maximum selectable
values.
Examples:
aFields := array(fcount())
aFields( aFields ) // create an array of field names
nPointer := 10
// display scroll bar showing relative position
DC_SCRLVBAR( 0, 24, 79, nPointer, 1, LEN(aFields )
Source/Library:
_DCSCRL.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_scrlvmou()
dc_scrldmou()
dc_scrlvmou()
Return an array pointer from vertical scroll-bar mouse-click
Syntax:
DC_ScrlVMou( < nStartRow >, ;
< nEndRow >, ;
< nMouseRow >, ;
< nMinVal >, ;
< nMaxVal >, ;
< nCurrVal >, ;
[< lPageMode >] ) - > nPointer
Arguments:
< nStartRow > is the start display row.
< nEndRow > is the end display row.
< nMouseRow > is the clicked mouse row.
< nMinVal > is the minimum value. If an array, then this
should be 1 or the minimum selectable value.
< nMaxVal > is the maximum value. If an array, then this
should be the number of items in the array or the maximum
selectable value.
< nCurrVal > is the current value. This is needed to
determine the relative position of the mouse with respect
to the current position.
< lPageMode > if .TRUE. (default) will return a value that
is one page higher than < nCurrVal > if the mouse is clicked
below the current pointer or a value that is one page
lower than the < nCurrVal > if the mouse is clicked above
the current pointer. If < lPageMode > is .FALSE. then the
value returned is a number proportional to the mouse-click
position within the scroll-bar region.
Returns:
A pointer to an array element.
Description:
DC_SCRLVMOU() is used with a vertical scroll bar on
the screen to return an array pointer based on the
relative mouse-click position within the scroll bar.
Examples:
aFields := array(fcount())
aFields( aFields ) // create an array of field names
// get an array element based on mouse position
dc_mougetpos( @nMouseRow, @nMouseCol )
nPointer := ;
DC_SCRLVMOU( 0, 24, 79, nMouseRow, 1, LEN(aFields )
? aFields[nPointer]
Source/Library:
_DCSCRL.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_scrlvbar()
dc_scrldmou()
dc_scrn2clipboard()
Capture current dialog screen to the ClipBoard
Syntax:
DC_Scrn2ClipBoard( [< oXbp >] ) - > nil
Arguments:
< oXbp >, is passed is the object who's image is to be transferred
to the clipboard. If < oXbp > is not passed, then the entire
screen is transferred to the clipboard.
Returns:
NIL.
Description:
DC_Scrn2ClipBoard() will create a bitmap of the current dialog
window that is in focus and copy the bitmap to the ClipBoard.
Examples:
SetAppFocus(AppDeskTop())
DC_Scrn2ClipBoard()
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_printclipboard()
dc_search()
Search all fields in a set of databases for a value
Syntax:
dc_search ( [< cFileName >], ;
[< cText >], ;
[< cOutput >] ) - > nil
Arguments:
< cFileName > is the name of the database to search. If no path
is given then the current SET DEFAULT directory is assumed. If
< cFileName > is "ALL", then all databases that match the
currently selected RDD will be searched. If no argument is
passed then a GUI dialog will be displayed prompting for a
file name, text and output.
< cText > is the text to search for. This is a case
non-sensitive search and the first occurrence of the text in
each field will be listed. If no argument is passed then a
GUI dialog will be displayed prompting for a file name, text
and output.
< cOutput > is the name of the output device. If no argument is
given or < cOutPut > is a null "" string then the output will go
to the screen. If < cOutPut > = 'PRN' then the output will go to
the printer, otherwise the output will go to a file named
< cOutPut >. If no extension is included then .PRN is assumed.
The file will be created in the SET DEFAULT directory.
Returns:
Nil.
Description:
DC_SEARCH() is used to search all fields of specified work
areas for matching text and list all occurences of found text.
The output can be sent to the screen, printer or a file and all
occurrences where the text is found will be listed as follows:
File Record Field Text
----------- ------ ------------ ---------------------------
CUSTOMER 123 PHONE 714-555-1212
MAILLIST 23567 PHONE_NUM (619)555-1212
Examples:
// search CUSTOMER.DBF for occurrences of "O'BRIEN"
// and display results on screen
set rdd to 'DBFNTX'
DC_SEARCH( 'CUSTOMER', "O'BRIEN" )
// search CUSTOMER.DBF for occurrences of "O'BRIEN"
// and copy results to file OBRIEN.TXT
set rdd to 'DBFNTX'
DC_SEARCH( 'CUSTOMER', "O'BRIEN", "OBRIEN" )
// search all .DBF's for occurences of "CLIPPER"
set rdd to 'DBFNTX'
DC_SEARCH( 'ALL', 'CLIPPER' )
Source/Library:
_DCSRCH.PRG, DCLIP2.DLL
dc_seeklast()
Seek the last occurence of a key in the current index
Syntax:
DC_SeekLast( < cKey > ) - > lFound
Arguments:
< cKey > is the key to seek.
Returns:
A logical .TRUE. if the index key was found, .FALSE. otherwise.
Description:
DC_SeekLast() will perform a seek for the last key in the
current index order that matches the passed in search key. If
the key is not in the index, the function will position the
table at EOF and set the found flag to False.
Source/Library:
_DCAREA.PRG, DCLIP1.DLL
See Also:
dc_dbseek()
dc_sendmailtodefault()
Send an email using the default Mail Client
Syntax:
DC_SendMailToDefault( < cTo >, ;
< cCC >, ;
< cSubject >, ;
< cBody > ) - > nil
Arguments:
< cTo > is the TO email address.
< cFrom > is the FROM email address.
< cSubject > is the SUBJECT of the email.
< cBody > is the BODY of the email.
Description:
DC_SendMailToDefault() is used to send an email using the
default email client.
Source/Library:
_DCFUNCT.PRG
dc_setappfocus()
Set Focus to a specified object
Syntax:
DC_SetAppFocus( < oXbp > ) - > oOldFocus
Arguments:
< oXbp > is the object that is to receive focus.
Returns:
A pointer to the previous object that had focus.
Description:
DC_SetAppFocus is a replacement for SetAppFocus() that
automatically walks up the parent tree and first maximizes all
parent tabpages as required to insure that the tab pages are
visible before the object receives focus.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_setcpu()
Sets the next CPU to use on a multi-processor computer
Syntax:
DC_SetCpu( < nCPUs >, < cFile > ) - > nil
Arguments:
< nCPUs > is a number representative of the number of CPUs on the
computer.
The default is 15 (4 CPUs).
Use 15 if 4 CPUs
Use 8 if 3 CPUs
Use 3 if 2 CPUs
Use 1 if 1 CPU
< cFileName > is the name of the text file that will contain the number
of
the last CPU used. The next CPU will automatically be assigned and this
number will be written into the file.
The default file name is GetEnv('WINDIR') + '\temp\setcpu.smp'
Returns:
Nil.
Description:
DC_SetCpu() is used to assign the next CPU to be used by the application.
Each time DC_SetCpu() is called (at the beginning of a program) it stores
that information to a file, so it can be read later and automatically
provide equal load balancing of the application.
This function is intended to be used on application servers such as Terminal
Server or Citrix where the application would be running multiple times.
Examples:
// put this at the beginning of your main program
DC_SetCpu()
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_setdaterange()
Set the valid date range for all Date GETS
Syntax:
DC_SetDateRange( [< aDates >] ) - > aOldDates
Arguments:
< aDates > is an array of 2 elements. Both elements must be a
date type variable. Element 1 must have a date that is less
than or equal to Element 2.
Returns:
An Array.
Description:
DC_SetDateRange() is used to establish the valid range of dates
for dates entered into GETS when using the @..DCSAY..GET or the
@..DCGET commands.
If the entered date does not fall within the specified range,
then an error message will be displayed.
Source/Library:
_dcgetbx.prg, dclipx.lib, dclipx.dll
See Also:
@ DCSAY GET
@ DCGET
dc_setdclip()
Set the directory to use for dCLIP data-dictionary files
Syntax:
DC_SetDclip ( [< cPathSpec >] ) - > cPathSpec
Arguments:
< cPathSpec > is any valid directory which may also include a
drive letter. If no parameter is passed, then the value will
not be changed.
Returns:
A character string.
Description:
DC_SETDCLIP() is used to establish the directory which will be
searched for creating dCLIP DC*.DBF databases and indexes.
If the files do not exist in this directory then they will be
created. dCLIP establishes the default for this value in the
following order:
1. Uses the value in any SET DCLIP=<þdirectoryþ> statement in
the DOS environment.
2. Uses the directory in which the .EXEcutable program
resides.
Exported Instance Variables:
Methods:
Notes:
Examples:
Source/Library:
_DCGETE.PRG/.OBJ, DCLIPX.LIB
dc_setdefault()
Set the DEFAULT directory the right way
Syntax:
DC_SetDefault ( < cPath > ) - > cPath
Arguments:
< cPath > is the name of the directory.
Returns:
The new DEFAULT setting.
Description:
DC_SETDEFAULT() is used to set the system DEFAULT directory
without the possibility of creating a runtime error. An
invalid directory cannot be set and the \ is automatically
appended to the end of the DEFAULT setting to insure that
Clipper properly finds the files.
Examples:
#include 'set.ch'
PROCEDURE Xtest()
DC_Gui(.t.)
DC_SETDEFAULT('C:\EXPRESS\SAMPLE')
DC_MsgBox({'Default directory is',;
'',;
SET(_SET_DEFAULT)})
DC_SETDEFAULT('C:\BOOGIE\MAN')
RETURN
Source/Library:
_DCPATH.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_setdclip()
dc_setedit()
Pop up an editing screen for all SET environment variables
Syntax:
DC_SetEdit( [< cSetName >] ) - > null string
Arguments:
< cSetName > is the name of the SET environment variable to
edit. If this parameter is not passed, then a picklist of all
environment variables will be displayed for editing.
Returns:
A null string.
Description:
DC_SetEdit() is used to invoke a GUI editor for observing or
modifying the value of any SET value in the environment.
The SET environment is the complete set of standard Xbase++
SETs such as SET EPOCH, SET DEFAULT, etc. and the additional
eXPress++ SETs such as SET ODIR, SET PROMPT, etc.
Examples:
. DC_SetEdit()
. DC_SetEdit('DEFAULT')
. DC_SetEdit('ODIR')
Source/Library:
_DCSET.PRG, DCLIP2.DLL
See Also:
SET
dc_setkeyactive()
Force DCREAD GUI dialogs to evaluate SET KEY code blocks
Syntax:
DC_SetKeyActive( [< lActivate >] ) - > lOldActivate
Arguments:
< lActivate > if .TRUE. will activate the Set Keys.
Returns:
A logical value.
Description:
DC_SetKeyActive() is used to set a system flag which forces
DC_ReadGui() dialogs which call DC_ReadGuiEventLoop() to react
to a key that has been pressed which has been been established
as a global "hot key" with the SET KEY command or SetKey()
function. By default, system hot keys are ignored by the event
handler. DC_SetKeyActive(.T.) will evaluate the associated
code block when a hot key is pressed in the event loop just as
it would if it were pressed in a standard text-mode READ.
Examples:
DC_SETKEYACTIVE(.t)
SET KEY K_ALT_D TO {||DC_Dot()}
SET KEY K_AlT_B TO {||WebBrowser()}
DCREAD GUI
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
See Also:
dc_readgui()
DCREAD
dc_setpointertree()
Set the mouse pointer on all objects in a tree
Syntax:
DC_SetPointerTree ( < oXbp >,;
< cDllName >,;
< nPointer >,;
< nType > ) - > nil
Arguments:
< oXbp > is the parent object. For example, to insure that the
mouse pointer will be changed for all child objects in the current
application window, < oXbp > would be SetAppWindow().
< cDllName > is the name of the DLL that contains the mouse pointer.
< nPointer > is the resource number of the mouse pointer. This
resource must exist in < cDllName > or be linked into the .EXE.
< nType > is the type of resource.
See the :setPointer() method of XbpWindow() in the Xbase++
documentation for more information.
Returns:
Nil.
Description:
DC_SETPOINTERTREE() is used to change the mouse pointer for all
objects in an object tree. This function walks down the
:ChildList() tree and sets the mouse pointer on all children of
the specified object.
Use this function to set an hourglass style pointer when
performing operations that create a busy state.
Examples:
#include "dcdialog.ch"
#include "dccursor.ch"
PROCEDURE Xtest()
LOCAL GetList := {}, oDlg, GetOptions
@ 1,1 DCSAY "Please wait while packing file..." SAYSIZE 40,2 ;
FONT 'Helv.24.Bold'
DCGETOPTIONS ;
NOMINBUTTON ;
NOMAXBUTTON
DCREAD GUI FIT EXIT OPTIONS GetOptions PARENT @oDlg
DC_SetPointerTree( oDlg, nil, POINTER_BUSY_1, 1 )
DC_Pause(5)
oDlg:Destroy()
RETURN
Source/Library:
_DCMOUSE.PRG/.OBJ, DCLIPX.LIB
dc_setpopkey()
Set or the return the value of the POPUP hot key
Syntax:
DC_SetPopKey( [< nHotKey >] ) - > nOldHotKey
Arguments:
< nHotKey > is the numeric xbeK_* value to assign.
Returns:
A numeric value.
Description:
DC_SetPopKey() is used to change the hot key that is used to
evaluate the POPUP code block when in a DCGET. The default key
is xbeK_CTRL_ENTER.
Examples:
DC_SetPopkey( xbeK_CTRL_P )
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
See Also:
@ DCGET
dc_setproperty()
Set the property of a Getlist item associated with an object
Syntax:
DC_SetProperty ( < oXbp >, ;
< nProperty >, ;
< xValue > ) - > nil
Arguments:
< oXbp > is a pointer to any object that was created by DC_ReadGui().
< nProperty > is a numeric value defined in DCDIALOG.CH. See
DIALOG GETLIST for a definition of these manifest constants.
< xValue > is the value to store in the GetList item that is
associated with the object.
Returns:
Nil.
Description:
DC_SETPROPERTY() is used to set a specified property in the
GetList that is associated with an object.
Methods:
Examples:
-- Example 1 --
#include 'dcdialog.ch'
PROCEDURE XTest()
@ 1,1 DCPUSHBUTTON CAPTION 'Testing' SIZE 10,1 ;
ACTION {|o|SetHelpCode(o,'BUTTON.TESTING')}
DCREAD GUI FIT ADDBUTTONS
RETURN nil
* -------------
STATIC FUNCTION SetHelpCode( oXbp, cHelpCode )
DC_SetProperty( oXbp, cGETLIST_HELPCODE, cHelpCode )
RETURN nil
Source/Library:
_DCGETBX.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_getproperty()
dc_getobject()
DIALOG GETLIST
dc_setregion()
Crop a Dialog window to a specified shape
Syntax:
DC_SetRegion( < oDlg >, ;
< aRegion > ) - > Nil
Arguments:
< oDlg > is an XbpDialog() object that has already been created.
It may also be any object which is derived from XbpDialog().
< aRegion > is an array of coordinates used to crop the perimeter
of the dialog window.
Returns:
Nil.
Description:
DC_SetRegion() is used to crop a dialog window to specified
irregular shape. DC_SetRegion() accepts an array of coordinates
that conforms to the specification for the "SetWindowRgn" API
function of Windows in USER32.DLL.
Examples:
oDlg := XbpDialog():new(AppDeskTop(),,{0,0},{100,100})
oDlg:create()
aRegion := DC_RegionArray( DCGUI_REGION_OCTAGON, 100 )
DC_SetRegion( oDlg, aRegion )
Source/Library:
_DCCLASS.PRG, DCLIPX.DLL
See Also:
dc_regionarray()
dc_setregionellipse()
@ DCPUSHBUTTON
dc_setregionellipse()
Crop a Dialog window to an ellipse/circle shape
Syntax:
DC_SetRegionEllipse( < oDlg >, ;
< aRegion > ) - > Nil
Arguments:
< oDlg > is an XbpDialog() object that has already been created.
It may also be any object which is derived from XbpDialog().
< aRegion > is an array of coordinates used to crop the perimeter
of the dialog window.
Returns:
Nil.
Description:
DC_SetRegionEllipse() is used to crop a dialog window to the
shape of an ellipse or circle. DC_SetRegionEllipse() accepts an
array of coordinates that conforms to the specification for the
"SetWindowRgn" API function of Windows in USER32.DLL.
Examples:
oDlg := XbpDialog():new(AppDeskTop(),,{0,0},{100,100})
oDlg:create()
aRegion := DC_RegionArray( DCGUI_REGION_ELLIPSE, 100 )
DC_SetRegion( oDlg, aRegion ) // crop to circle
oDlg := XbpDialog():new(AppDeskTop(),,{0,0},{100,100})
oDlg:create()
aRegion := DC_RegionArray( DCGUI_REGION_ELLIPSE, 100, 75 )
DC_SetRegion( oDlg, aRegion ) // crop to ellipse
Source/Library:
_DCCLASS.PRG, DCLIPX.DLL
See Also:
dc_regionarray()
dc_setregion()
@ DCPUSHBUTTON
dc_setrelation()
Set a relation with a child scope
Syntax:
dc_setscope ( < cAlias >, ;
< bRelation >, ;
[< cRelation >], ;
[< lSetScope >] ) - > xValue
Arguments:
< cAlias > is a character string containing the alias name for the
work area to which a link is defined.
< bRelation > is a code block containing an expression used to
position the record pointer in the child work area in order to
synchronize it with the record pointer in the parent work area.
The return value of < bRelation > is passed to DbSeek() to position
the record pointer in the child work area.
< cRelation > optionally specifies the link expression of
< bRelation >
as a character string. This argument is used for the return value
of the function DbRelation() to determine the link expression. If
< cRelation > is not specified, the function DbRelation() returns a
null string ("").
< lSetScope > if .TRUE. (default) will automatically set the scope
in the child work area to the value of the data in the parent work
area whenever the parent record pointer is changed.
Returns:
The current SCOPE value.
Description:
DC_SETRELATION() is a front-end to the Xbase++ function
dbSetRelation() whic defines a link between two work areas. The
dependent or child work area is specified by the argument <þcAliasþ>
The controlling or parent work area is determined by the alias
operator. If the alias operator is not used, the current work area
is the parent work area the child area is synchronized with.
Existing links in the parent work area are not deleted by
DC_SetRelation().
The synchronization of the record pointer in the child work area
occurs using the return value of <þbRelationþ> . The child work area
is automatically searched for this value using DbSeek() anytime the
record pointer in the parent work area changes. If no index is
active in the child work area, synchronization is done using the
function DbGoto(). This means that an attempt is made to set the
record pointer in the child work area using the value returned
from <þbRelationþ> as a record ID.
The range for navigating the record pointer in the child work area
can be restricted to a subset of records by specifying .T. (true)
for the optional parameter <þlSetScopeþ> . In this case, only those
records are accessible in the child work area where the link
expression <þbRelationþ> results in the same value for both work
areas. When attempting to move the record pointer in the child
work area outside this defined range, either Bof() or Eof() is set
to .T. (true). In this way, a time consuming filter expression can
be avoided.
Exported Instance Variables:
Methods:
Notes:
With the exception of COMIX and Advantage Server, DC_SETSCOPE()
does not establish the scoping range at the DBE-layer level, but
instead stores the scoping information in dbCargo() as an array.
The scoping information is retrieved by record navigation
functions such as DC_DBGOTOP(), DC_DBGOBOTTOM() and DC_DBSKIP().
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_setscope()
dc_setrest()
Restore the SET environment from a file
Syntax:
DC_SetRest( < cFileName > ) - > lStatus
Arguments:
< cFileName > is the name of the file previously created by
DC_SetSave() or SAVE SET. If no extension is given then the
extension .DCA will be added.
Returns:
A logical .TRUE. if the environment was successfully restored.
Description:
DC_SetRest() is used to restore the values of all Xbase++ and
eXPress++ environment variables from a file previously created
by DC_SetSave() or SAVE SET.
The SET environment is the complete set of standard Xbase++
SETs such as SET EPOCH, SET DEFAULT, etc. and the additional
eXPress++ SETs such as SET ODIR, SET PROMPT, etc.
Examples:
. SAVE SET TO MYFILE.SET
. DoSomethingThatChangesEnvironment()
. DC_SetRest('MYFILE.SET')
Source/Library:
_DCSET.PRG, DCLIP2.DLL
See Also:
dc_setsave()
dc_setroundrectregion()
Crop a Dialog window to round the corners to a specified radius
Syntax:
DC_SetRoundRectRegion( < oXbp >, ;
< nRadius > ) - > Nil
Arguments:
< oXbp > is any Xbp*() object that has already been created. The
object must be derived from XbpDialog() or XbpWindow().
< nRadius > is the amount of corner radius. Default is 10.
Returns:
Nil.
Description:
DC_SetRoundRectRegion() is used to crop a dialog window to round
the corners to a specified radius.
Examples:
oDlg := XbpDialog():new(AppDeskTop(),,{0,0},{100,100})
oDlg:create()
DC_SetRoundRectRegion( oDlg, 15 )
Source/Library:
_DCCLASS.PRG, DCLIPX.DLL
See Also:
dc_setregion()
dc_setsave()
Save the SET environment to a file
Syntax:
DC_SetSave( < cFileName > ) - > lStatus
Arguments:
< cFileName > is the name of the file to create. If no extension
is given then the extension .DCA will be added.
Returns:
A logical .TRUE. if the file was successfully created.
Description:
DC_SetSave() is used to save the values of all Xbase++ and
eXPress++ environment variables to a file to be later restored
by DC_SetRest() or RESTORE SET.
The SET environment is the complete set of standard Xbase++
SETs such as SET EPOCH, SET DEFAULT, etc. and the additional
eXPress++ SETs such as SET ODIR, SET PROMPT, etc.
Examples:
. DC_SetSave('MYFILE.SET')
Source/Library:
_DCSET.PRG, DCLIP2.DLL
See Also:
dc_setrest()
dc_setscope()
Set a scoping value for the current work area
Syntax:
dc_setscope ( < nWhich >, ;
[< xValue >] ) - > xValue
Arguments:
< nWhich > is a number 0 if setting the SCOPE TOP value or a
number 1 if setting the SCOPE BOTTOM value.
< xValue > is the value to set. This should be a value that
matches the current index key. If < xValue > is a NIL then
the current setting will be returned.
DC_SetScope() functions just like COMIX CMXSetScope() and
Advantage's AX_SetScope(). For example, to include everything
starting with DC_G to DC_K, set the scope as follows:
DC_SetScope(0,'DC_G')
DC_SetScope(1,'DC_K')
To include everything starting with DC_G to DC_J, set the
scope as follows:
DC_SetScope(0,'DC_G')
DC_SetScope(1,'DC_K ') < - note the space
Returns:
The current SCOPE value.
Description:
DC_SETSCOPE() is used to set a SCOPE TOP and SCOPE BOTTOM value
for establishing a "scoping range" for a work area. The eXPress++
browsing and editing systems use DC_SETSCOPE() to store the
scoping range when browsing and editing records. When a scoping
range is set, only the records that fall within the range will
appear in the browse or edit screens.
Notes:
With the exception of Advantage Server, DC_SETSCOPE() does not
establish the scoping range at the DBE-layer level, but instead
stores the scoping information in dbCargo() as an array.
The scoping information is retrieved by record navigation
functions such as DC_DBGOTOP(), DC_DBGOBOTTOM(), DC_DBSKIP(),
DC_BOF() and DC_EOF().
If the ADSDBE (Advantage Server) driver is being used, then
DC_SetScope() simply calls AX_SetScope().
Examples:
#include 'dcdialog.ch'
#include 'appevent.ch'
PROCEDURE XTest()
LOCAL GetList := {}, oBrowse, aPres, cScopeTop, cScopeBot
USE ..\XDOC\EXPRESS INDEX ..\XDOC\EXPRESS.CDX ;
VIA FOXCDX ALIAS XDOC
OrdSetFocus('COMMAND')
DC_KeyStat(.t.)
DC_SETSCOPE(0,'DC_G')
DC_SETSCOPE(1,'DC_K')
DC_DbGoTop()
aPres := ;
{ { XBP_PP_COL_HA_FGCLR, GRA_CLR_WHITE }, /* Header FG Color */ ;
{ XBP_PP_COL_HA_BGCLR, GRA_CLR_DARKGRAY }, /* Header BG Color */ ;
{ XBP_PP_COL_DA_ROWSEPARATOR, XBPCOL_SEP_DOTTED }, /* Row Sep */ ;
{ XBP_PP_COL_DA_COLSEPARATOR, XBPCOL_SEP_DOTTED } /* Col Sep */ ;
}
cScopeTop := Pad('DC_G',10)
cScopeBot := Pad('DC_K',10)
@ 1,1 DCSAY 'Scope Top' GET cScopeTop PICT '@!' SAYRIGHT ;
VALID {||DC_SETSCOPE(0,Alltrim(cScopeTop)),;
oBrowse:RefreshAll(),;
SetAppFocus(oBrowse),.t.}
@ 1,25 DCSAY 'Scope Bottom' GET cScopeBot PICT '@!' SAYRIGHT ;
VALID {||DC_SETSCOPE(1,Alltrim(cScopeBot)),;
oBrowse:RefreshAll(),;
SetAppFocus(oBrowse),.t.}
@ 1, 65 DCPUSHBUTTON CAPTION 'Clear ~Scope' SIZE 10,1.5 ;
ACCELKEY xbeK_ALT_S ;
ACTION {||DC_ClrScope(),oBrowse:RefreshAll(),;
SetAppFocus(oBrowse)}
@ 3,1 DCBROWSE oBrowse ALIAS 'XDOC' ;
SIZE 77,11.8 ;
FREEZELEFT {1} ;
PRESENTATION aPres ;
SCOPE
DCBROWSECOL FIELD XDOC->command ;
HEADER "Command" PARENT oBrowse
DCBROWSECOL FIELD XDOC->type ;
HEADER "Type" PARENT oBrowse
DCBROWSECOL FIELD XDOC->short ;
HEADER "Short Description" PARENT oBrowse
DCBROWSECOL FIELD XDOC->module ;
HEADER "Module" PARENT oBrowse ;
DCBROWSECOL FIELD XDOC->category ;
HEADER "Category" PARENT oBrowse
DCBROWSECOL FIELD XDOC->see_also ;
HEADER "See Also" PARENT oBrowse
DCREAD GUI ;
FIT ;
ADDBUTTONS ;
TITLE 'Scoping Demo: DC_G thru DC_K'
RETURN
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_clrscope()
dc_setscopearray()
Set a scoping value for the current work area using an array
Syntax:
dc_setscopearray ( < aRecords > | NIL ) - > aRecords
Arguments:
< aRecords > is an array of record numbers. If < aRecords > is
a
NIL, then the scope is cleared.
< aRecords > may be a single-dimensional array or an optional
multi-dimensional array. If it is a multi-dimensional array then
the first element must be the numeric record number.
Returns:
The current scope array or a NILþ>
Description:
DC_SETSCOPEARRAY() is used to create a "roll-your-own" style of
scope on a database. It is much better than filters or scopes
when needing to browse a subset of a large database. An "array"
of record numbers is used to establish the scope and all
DC_Db*() functions will respect the scope including @..DCBROWSE.
Notes:
With the exception of Advantage Server, DC_SETSCOPE() does not
establish the scoping range at the DBE-layer level, but instead
stores the scoping information in dbCargo() as an array.
The scoping information is retrieved by record navigation
functions such as DC_DBGOTOP(), DC_DBGOBOTTOM(), DC_DBSKIP(),
DC_BOF() and DC_EOF().
If the ADSDBE (Advantage Server) driver is being used, then
DC_SetScope() simply calls AX_SetScope().
Examples:
USE TICKETS INDEX TICKETS
OrdSetFocus('DATE')
dbSeek(Date())
aRecords := {}
DO WHILE TICKETS->date == Date()
IF TICKETS->time = '10:00' .OR. TICKETS->time = '11:00'
AAdd(aRecords,TICKETS->(RecNo())
ENDIF
SKIP
ENDDO
DC_SetScopeArray(aRecords)
DC_DbGoTop()
@ .. DCBROWSE ALIAS 'TICKET'
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_setscope()
dc_spawnurl()
Spawn the program associated with a file name or URL
Syntax:
DC_SpawnURL( < cURL >, ;
[< lBackground >], ;
[< lAsync >] ) - > nil
Arguments:
< cURL > is a URL or file name.
< lBackground > if .TRUE. will cause the spawned program to be
placed in the background, otherwise it will be placed in the
foreground. The default is .FALSE. (foreground).
< lAsync > if .TRUE. will cause the spawned program to be run
asynchronously. The default .FALSE.
Returns:
Nil.
Description:
DC_SpawnURL() is used to spawn the program associated with a
file name or URL.
Examples:
// Run Acrobat and view document.pdf
DC_SpawnURL( 'C:\DOCS\DOCUMENT.PDF' )
// Run Internet Explorer and navigate to website
DC_SpawnURL( 'http://donnay-software.com' )
Source/Library:
_DCFUNCT.PRG,DCLIPX.DLL
dc_sqlconnection()
Make a SQL connection via SQLexpress
Syntax:
DC_SQLConnection( [< nType >] ) - > oConnection
Arguments:
< nType > is a value defined in DCDIALOG.CH:
DCSQL_CONNECT_TYPE_READONLY
DCSQL_CONNECT_TYPE_READWRITE * (default)
Returns:
A connection object of type SQLConnection.
Description:
DC_SQLConnection() establishes a connection to an ODBC device
via SQLexpress. If the SQLXPP.DLL is not statically linked to
the application, it will be dynamically loaded.
DC_SQLConnection() tests for an already existing connection in
the current thread. If there was a previous connection made, then
a pointer to the connection object is returned, otherwise a new
connection is made and the new connection object is returned.
The connection string used to connect is derived from a call
to DC_ConnectString().
When a thread terminates, the SQL connection is automatically
destroyed.
Examples:
oConnection := DC_SQLConnection()
Source/Library:
_DCSQL.PRG, DCLIPX.DLL
See Also:
dc_sqlconnectstring()
dc_sqlcursor()
dc_sqlconnectstring()
Get or Set a SQL connection string
Syntax:
DC_SQLConnectString( [< cConnect >] ) - > cConnect
Arguments:
< cConnect > is a string containing either a connection string or
the name of an .INI file that contains the connection string.
If < cConnect > is empty and a previous call to DC_SQLConnectString()
was made, then the previously stored value will be returned.
If < cConnect > is a pointer to an .INI file, then the file will
be opened to obtain the connect string. The .INI file should
contain the following information:
[DATABASE]
ConnStr=< Connect String >
If < cConnect > is empty and a previous call to DC_SQLConnectString()
was not made, then a file named DCSQL.INI will be used to
establish the connection string.
Returns:
A connection string.
Description:
DC_SQLConnectString() is a Get/Set function that establishes a
SQL connect string to be used by DC_SQLConnection().
Examples:
DC_SQLConnectString( 'MYCONNECT.INI' )
oConnection := DC_SQLConnection()
Source/Library:
_DCSQL.PRG, DCLIPX.DLL
See Also:
dc_sqlconnection()
dc_sqlcursor()
Create a SQL cursor via SQLexpress
Syntax:
DC_SQLCursor( [< oConn >], ;
[< nType >], ;
[@< nSuccess >], ;
[< cStatement >], ;
[< bSQLParam >], ;
[< aPrimaryKeys >], ;
[< nMaxRows >], ;
[< abAddCol >], ;
[< bFilter >], ;
[< lTrim >], ;
[< lDateTimeAsDate >], ;
[< cTableName >] ) - > oCursor
Arguments:
< oConn > is an SQL connection object previously created with
SQLConnection or DC_SQLConnection. If this parameter is not
passed then the value returned by DC_SQLConnection() is the
default.
< nType > is the type of cursor to create. See the SQLexpress
documentation for more information.
< nType > Description
------- ------------------------------------------------------
0 SQLSelect() with a read/write dynamic cursor
1 SQLSelect() with a read-only dynamic cursor
2 SQLDataSet()
3 SQLListColumnPrivileges()
4 SQLListColumns()
5 SQLListForeignKeys()
6 SQLListPrimaryKeys()
7 SQLListProcedureColumns()
8 SQLListProcedures()
9 SQLListSpecialColumns()
10 SQLListStatistics()
11 SQLListTablePrivileges()
12 SQLListTables()
13 SQLListTypeInfo()
@< nSuccess > is a numeric variable, passed by reference, to store
the value returned by the oCursor:execute() method. See the
SQLexpress documention for more information.
< cStatement > is the SQL statement. This is required only for
< nTypes > 1 thru 3.
< bSQLParam >, < aPrimaryKeys >, < nMaxRows >,
< abAddCol >, < bFilter >,
< lTrim > and < lDateTimeAsDate > are used only with
< nType > of 3.
See SQLDataSet() in the SQLexpress documentation for more
information.
Returns:
An SQLexpress cursor object.
Description:
DC_SQLCursor() is a front-end to all the SQLexpress functions
that return a SQL cursor.
Examples:
DC_SQLConnectString('MYCONNECT.INI')
oConn := DC_SQLConnection()
IF Valtype(oConn) # 'O'
RETURN nil
ENDIF
cStatement := 'SELECT * FROM INVOICES'
oCursor := DC_SQLCursor(,,,cStatement)
@ 0,0 DCBROWSE oBrowse DATA oCursor SIZE 100,20
DCBROWSECOL DATA DC_SQLFieldBlock( oCursor, 'INV_NMBR' ) ;
PARENT oBrowse WIDTH 10 HEADER 'Invoice #'
DCBROWSECOL DATA DC_SQLFieldBlock( oCursor, 'INV_DATE' ) ;
PARENT oBrowse WIDTH 10 HEADER 'Date'
DCREAD GUI FIT
Source/Library:
_DCSQL, DCLIPX.DLL
See Also:
dc_sqlfieldblock()
dc_sqlgetsetblock()
dc_sqlsortblock()
dc_sqlconnection()
dc_sqldataset()
Create a data subset from an existing SQL cursor
Syntax:
DC_SQLDataSet( < oCursor >, ;
< bFilter > ) - > oDataSet
Arguments:
< oCursor > is an SQLexpress SQLSelect or SQLDataSet cursor.
< bFilter > is a code block that is evaluated to determined which
rows from the primary cursor are added to the new dataset. The
code block must return a .TRUE. value. A data array equal to
oDataSet:recordGet() (see SQLexpress documentation) is passed
to the code block for each row (record).
Returns:
A SQLexpress SQLDataSet() object.
Description:
DC_SQLDataSet() is used to create a SQLexpress DataSet cursor as
a subset of another cursor.
Examples:
DC_SQLConnection()
cStatement := 'SELECT * FROM INVOICES'
oCursor := DC_SQLCursor(,,,cStatement)
bFilter := {|a|a[4]==dTraderDate}
oDataSet := DC_SQLDataSet( oCursor, bFilter )
@ 0,0 DCBROWSE oBrowse DATA oDataSet
Source/Library:
_DCSQL, DCLIPX.DLL
See Also:
dc_sqlcursor()
dc_sqlfieldblock()
Create a code block for browsing an SQL field
Syntax:
DC_SQLFieldBlock( < oCursor >, ;
< ncField > ) - > bField
Arguments:
< oCursor > is a SQL cursor returned by DC_SQLCursor().
< ncField > if a numeric is the field number in the SQL cursor, or
if a character string is the field name in the SQL cursor.
Returns:
A code block.
Description:
DC_SQLFieldBlock() is used to create a code block for browsing
a field in an SQL cursor created by SQLExpress or DC_SQLCursor().
Examples:
DC_SQLConnectString('MYCONNECT.INI')
oConn := DC_SQLConnection()
IF Valtype(oConn) # 'O'
RETURN nil
ENDIF
cStatement := 'SELECT * FROM INVOICES'
oCursor := DC_SQLCursor(,,,cStatement)
@ 0,0 DCBROWSE oBrowse DATA oCursor SIZE 100,20
DCBROWSECOL DATA DC_SQLFieldBlock( oCursor, 'INV_NMBR' ) ;
PARENT oBrowse WIDTH 10 HEADER 'Invoice #'
DCBROWSECOL DATA DC_SQLFieldBlock( oCursor, 'INV_DATE' ) ;
PARENT oBrowse WIDTH 10 HEADER 'Date'
DCREAD GUI FIT
Source/Library:
_DCSQL.PRG, DCLIPX.DLL
See Also:
dc_sqlgetsetblock()
dc_sqlcursor()
dc_sqlgetsetblock()
Create a code block for editing an SQL field
Syntax:
DC_SQLGetSetBlock( < oCursor >, ;
< ncField > ) - > bGetSet
Arguments:
< oCursor > is a SQL cursor returned by DC_SQLCursor().
< ncField > if a numeric is the field number in the SQL cursor, or
if a character string is the field name in the SQL cursor.
Returns:
A code block.
Description:
DC_SQLFieldBlock() is used to create a code block for browsing
a field in an SQL cursor created by SQLExpress or DC_SQLCursor().
Examples:
DC_SQLConnectString('MYCONNECT.INI')
oConn := DC_SQLConnection()
IF Valtype(oConn) # 'O'
RETURN nil
ENDIF
cStatement := 'SELECT * FROM INVOICES'
oCursor := DC_SQLCursor(,,,cStatement)
@ 0,0 DCBROWSE oBrowse DATA oCursor SIZE 100,20
EDIT xbeBRW_ItemSelected
DCBROWSECOL DATA DC_SQLGetSetBlock( oCursor, 'INV_NMBR' ) ;
PARENT oBrowse WIDTH 10 HEADER 'Invoice #'
DCBROWSECOL DATA DC_SQLGetSetBlock( oCursor, 'INV_DATE' ) ;
PARENT oBrowse WIDTH 10 HEADER 'Date'
DCREAD GUI FIT
Source/Library:
_DCSQL.PRG, DCLIPX.DLL
See Also:
dc_sqlfieldblock()
dc_sqlcursor()
dc_sqlsortblock()
Create a code block for sorting an SQL column
Syntax:
DC_SQLFieldBlock( < oCursor >, ;
< ncField >, ;
[@< nColumn >] ) - > bSort
Arguments:
< oCursor > is a SQL cursor returned by DC_SQLCursor().
< ncField > if a numeric is the field number in the SQL cursor, or
if a character string is the field name in the SQL cursor.
@< nColumn > is a numeric value, passed by reference, to store
the numeric field position of field in the SQL cursor whenever
the codeblock is evaluated.
Returns:
A code block.
Description:
DC_SQLSortBlock() is used to create a code block for sorting
a column in an SQL cursor created by SQLExpress or DC_SQLCursor().
Examples:
DC_SQLConnectString('MYCONNECT.INI')
oConn := DC_SQLConnection()
IF Valtype(oConn) # 'O'
RETURN nil
ENDIF
cStatement := 'SELECT * FROM INVOICES'
oCursor := DC_SQLCursor(,,,cStatement)
@ 0,0 DCSAY {||'Sorted by: ' IIF(nColumn=1,'Invoice #','Date')} ;
SAYSIZE 10
@ 1,0 DCBROWSE oBrowse DATA oCursor SIZE 100,20
DCBROWSECOL DATA DC_SQLFieldBlock( oCursor, 'INV_NMBR' ) ;
PARENT oBrowse WIDTH 10 HEADER 'Invoice #'
SORT DC_SQLSortBlock( oCursor, 'INV_NMBR', @nColumn )
DCBROWSECOL DATA DC_SQLFieldBlock( oCursor, 'INV_DATE' ) ;
PARENT oBrowse WIDTH 10 HEADER 'Date'
SORT DC_SQLSortBlock( oCursor, 'INV_DATE', @nColumn )
DCREAD GUI FIT
Source/Library:
_DCSQL.PRG, DCLIPX.DLL
See Also:
dc_sqlfieldblock()
dc_sqlcursor()
dc_status()
Display System status window
Syntax:
DC_Status( [< cFileName >], ;
[< lAppend >], ;
[< lWindow >], ;
[< lWorkAreas >] ) - > NIL
Arguments:
< cFileName > is an optional name of a file to write the status.
< lAppend > if .TRUE. will append the status to end of
< cFileName > otherwise the file will be overwritten.
< lWindow > if .TRUE. (default) will display the status in a
window and the user can scroll up or down through the window to
observe any portion of the status. The display will be
restored upon exiting the windoe. If .FALSE. the status will
scroll up the display and the user will be prompted to press
a key for each new screen.
< lWorkAreas > if .TRUE. will display only the status of the work
areas. If .FALSE. (default) the status of the Xbase++ SET
environment variables and eXPress++ environment variables will
also be displayed.
Returns:
Nil.
Description:
DC_Status() is used to display a scrollable window of information
about the system application.
Examples:
. USE COLLECT INDEX COLLECT
. DC_Status()
Source/Library:
_DCSTAT.PRG, DCLIP2.DLL
See Also:
DISPLAY STATUS
dc_str2ar()
Convert a string to a multidimensional array
Syntax:
DC_Str2Ar ( < cString > ) - > aArray
Arguments:
< cString > is a string previously created by DC_Ar2Str().
Returns:
A multidimensional array.
Description:
DC_Str2Ar() will restore an array from a string that was
previously created with DC_Ar2Str(). This set of functions is
an alternative to using the Xbase++ functions Bin2Var() and
Var2Bin() because they will create a runtime error if the
array contains code blocks with non-persistent data.
If the array contains code blocks, the code blocks will be
saved and restored provide that they contain persistent data.
Any code block that contains non-persistent data will be
restored as a NIL.
If the array contains pointers to objects, they pointers will
be restored as a NIL.
Examples:
PROCEDURE XTest()
LOCAL aDir
aDir := Directory()
USE dirs
APPEND BLANK
REPL DIRS->array WITH DC_Ar2Str(aDir)
aDir := DC_Str2Ar(DIRS->array)
DC_ArrayView(aDir)
RETURN
Source/Library:
_DCASAVE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_arestore()
dc_struupdate()
Modify the structure of a database
Syntax:
DC_StruUpdate ( < aStructure >, ;
[< cNewFileName >], ;
[< lChangedType >], ;
[< lChangedName >], ;
[< lPrompt >] ) - > lStatus
Arguments:
< aStructure > is a multi-dimensional array with one sub-array
for each database field. This may be a standard Clipper
structure array or an enhanced array with information about
previous field type(s) and field name(s).
Element Type Description
------ ---- ------------------------
[1] C Field Name
[2] C Field Type
[3] N Field Length
[4] N Field Decimals
[5] C Old Field Type (optional)
[6] C Old Field Name (optional)
[7] X Default Value for new fields (optional)
Must be same value as new field.
< cNewFileName > is the name of the new file to create. If
parameter is not passed, then the new file will be given the
same name as the old file.
< lChangedType > if .TRUE. will use a "slower" method of update
to insure that data is properly restored. Pass this flag if
the type of one or more fields has changed and the array
does not contain the old information (element 5).
< lChangedName > if .TRUE. will use a "slower" method of update
to insure that data is properly restored. Pass this flag if
the name of one or more fields has changed and the array
does not contain the old information (element 6).
< lPrompt > if .TRUE. (default) will prompt the user with the
option of erasing the backup file(s) after the structure
update. If .FALSE. the backup files will not be erased and
the user will not be prompted.
Returns:
A logical .TRUE. if the file was successfully updated, .FALSE.
if the operation was aborted by the user or otherwise failed.
Description:
DC_STRUUPDATE() is used to update the structure of the current
work area in the event that the database structure required
by the program may be different from existing databases.
This function makes it easy to have your program automatically
update the structure of existing databases in the event that
fields have been added, deleted or re-sized. If you open your
databases with DC_DBFILE() and pass it a structure array, then
the databases will automatically be updated the first time the
new program is run.
Examples:
aStru := { ;
{ 'CUST_NAME','C',25,0 },;
{ 'CUST_NMBR','C',10,0 },;
{ 'LAST_DATE','D',8,0 } }
use customer
if .not. dc_isstru( aStru )
DC_STRUUPDATE( aStru )
endif
Source/Library:
_DCSTRU.PRG, DCLIP2.DLL
See Also:
dc_modstru()
dc_dbfile()
dc_isstru()
dc_strwrap()
Convert a string to a text array and specify line length
Syntax:
DC_StrWrap ( < cString >, ;
< nLength > ) - > aText
Arguments:
< cString > is a character string.
< nLength > is the length of each line in the output array.
Returns:
An array of strings that contains the original <þcStringþ>
information formatted to the length of <þnLengthþ>.
Description:
DC_STRWRAP() is used to convert a long text string to multiple
lines of a specified length per line. This function is handy
when text must fit within a specified width of a display or
printout.
Examples:
#include 'dcdialog.ch'
PROCEDURE Xtest()
LOCAL cString, aText, i
cString := 'The quick red fox jumped over the lazy dog.'
aText := DC_STRWRAP( cString, 10 )
for i := 1 to len(aText)
DCQOUT aText[i]
next
RETURN
/*
The quick
red fox
jumped
over the
lazy dog.
*/
Source/Library:
_DCSTR.PRG/.OBJ, DCLIPX.LIB
dc_sum()
Sum numeric fields in selected database
Syntax:
DC_Sum() - > lStatus
Arguments:
None.
Returns:
A logical .TRUE. if the sum was not aborted.
Description:
DC_Sum() is used to sum numeric fields from the currently selected
database based on a set of conditions. As GUI dialog window
is displayed for the user to select the conditions.
Examples:
. USE COLLECT
. DC_Sum()
Source/Library:
_DCSUM.PRG, DCLIP2.DLL
See Also:
SUM
dc_tabactivate()
Activate a Tab Page
Syntax:
DC_TabActivate( < oTabPage >, ;
[< lCompleteEvents >] ) - > nil
Arguments:
< oTabPage > is the tab page to activate.
< lCompleteEvents > will call DC_CompleteEvents() after activating
the tab.
Returns:
Nil.
Description:
DC_TabActivate() is used to select a TabPage by it's object
name.
Source/Library:
_DCFUNCT.PRG
See Also:
@ DCTABPAGE
dc_tabpagecolor()
Set the default tabpage minimized and maximized colors
Syntax:
DC_TabPageColor( [< aColors >] ) - > < aOldColors >
Arguments:
< aColors > is a two-element array containing the minimized and
maximized colors respectively. Each element is a sub-array containing
foreground and background colors. Each sub-array is 2 elements
that are numeric GRA* values or a 3-element sub-array of RGB values.
Returns:
An array containing the old colors.
Description:
DC_TabPageColor() is a Get-Set function that is used to
automatically set the color of Maximized and Minimized Tabpages
that have been created by the @ DCTABPAGE command, so that the
currently selected tab may be a different color than unselected
tabs.
Examples:
-- Example 1 (numeric values) ---
<aColors> := { { GRA_CLR_BLACK, GRA_CLR_WHITE }, ;
{ GRA_CLR_BLACK, GRA_CLR_YELLOW } }
DC_TabPageColor( aColors )
-- Example 2 (RGB values) ---
<aColors> := { { { 0,0,0 }, { 128, 128, 128 } }, ;
{ { 0,0,0 }, { 230, 127, 030 } } }
DC_TabPageColor( aColors )
See Also:
@ DCTABPAGE
dc_tagallcreate()
Create index tags for all fields in a database
Syntax:
DC_TagAllCreate( [< cCDXName >], ;
[< aFields >], ;
[< nLength >] ) - > lStatus
Arguments:
< cCDXName > is the name of the Combined Index file to create.
If no extension is given, then if the default extension for
combined indexes supported by the Data driver in use will be
appended.
If no < cCDXName > name is given, then the index will be created
using the same prefix as the open database and with the default
extension for combined indexes supported by the Data driver in
use.
< aFields > is a list of index tag names to create. The tag
name(s) must be the same as the name(s) of valid fields in the
current work area. If no argument is passed then tags for ALL
fields will be created.
< nLength > is an optional argument only to determine the maximum
length of character type indexes. For example, if you have a
character field of 100 bytes, you most likely will not want to
index on all 100 bytes, but instead on only the first 10
characters. If this argument is not passed, then a default length
of 10 will be used. If the length of any character field is less
than < nLength > then the index length for that specific tag will be
the field length.
Returns:
A logical .TRUE. if the index is successfully created, .FALSE.
otherwise.
Description:
DC_TAGALLCREATE() is used to create an index tag for all fields
(up to 99) in a database. This command is handy when you wish
to have an index for each field in the database and are using
the HUNT..RESUME .or DC_HUNT() "smart seeking" feature of
eXPress++.
Examples:
. USE MAILLIST VIA DBFCDX
. DC_TAGALLCREATE('MAILLIST.CDX',{"LAST", "COMPANY", "SOURCE"} )
. DC_Hunt( 'SCOTT' )
Source/Library:
_DCTAGS.PRG, DCLIP2.DLL
See Also:
INDEX FIELDS
dc_tagdelete()
Delete a tag from a combined index
Syntax:
DC_TagDelete() - > lStatus
Arguments:
None.
Returns:
A logical .TRUE. if the index tag was deleted successfully,
.FALSE. otherwise.
Description:
DC_TagDelete() is used to delete an index tag from a combined
index.
Examples:
. USE EXPRESS INDEX EXPRESS.CDX EXCL
. DC_TagDelete()
Source/Library:
_DCTAGS.PRG, DCLIP2.DLL
See Also:
DELETE TAG
dc_tagrecord()
Tag the current record or record group in a Browse
Syntax:
DC_TagRecord( < oBrowse >, ;
< @nLastRec >, ;
< @nLastPos > ) - > nil
Arguments:
< oBrowse > is a pointer to an XbpBrowse() or DC_XbpBrowse() object.
< nLastRec > and < nLastPos > are variables, passed by
reference, to
store record pointer information.
Returns:
Nil.
Description:
DC_RecTagToggle() is used to toggle the value of the record tag
on the current record. If the record number exists in the tag
array, then it will be removed, otherwise it will be added.
Notes:
CAUTION: The eXPress++ tagging system is designed for ad-hoc
tagging of records using simple menu selection and database
commands. You will notice a gradual speed detioration as you
add more records to the tag array when browsing. This is
because the DC_TAGGED() function must scan more records in the
array. It is recommend that you refrain from tagging more than
1000 records or you may experience unacceptable slowness
during browsing.
If you need a tagging system that will support a much larger
number of records, it is recommended that you add a TAG
(logical) field to your database.
Examples:
See the Record Tagging example in XDEMO.EXE - Sample Group 6.
Source/Library:
_DCRTAG.PRG, DCLIPX.DLL
See Also:
dc_rectag
dc_tagrecord()
dc_rectagarray()
dc_tbinkey()
A special version of INKEY() for adding mouse to Tbrowse system
Syntax:
DC_TBInkey ( < oObject >, ;
< nDelay >, ;
[< aButtons >], ;
[< aNavigate >], ;
[< nStartRow >], ;
[< nEndRow >] ) - > nInkeyVal
Arguments:
< oObject > is the name of the Tbrowse object to mouse.
< nDelay > is the amount of seconds to wait for a key click or
mouse click. If zero, then wait forever.
< aButtons > is an optional multi-dimensional array of mouse-
buttons that must meet the criteria specified for the
DC_MOUSEKEY() function. If the mouse is clicked within a
specified region the value returned by will be the key value
passed in the array.
< aNavigate > is an optional multi-dimensional array of mouse-
button coordinates to be used for navigation. There are a
total of 10 sub-arrays required, each with 4 numeric elements
designating the coordinates on the screen. If the mouse is
clicked within the specified coordinates, then the activity
will be performed.
Subarray Description Default
-------- ----------- ------------
1 Pan Left (same as K_CTRL_LEFT) o:nLeft-1
2 Pan Right (same as K_CTRL_RIGHT) o:nRight+1
3 Move up one Row (same as K_UP) o:nTop+1
4 Move down one Row (same as K_DOWN) o:nBottom-1
5 Page Up (same as K_PGUP) o:nTop
6 Page Down (same as K_PGDN) o:nBottom
7 Pan Home (same as K_CTRL_HOME) Col 0
8 Pan End (same as K_CTRL_END) Col 79
9 Top (same as K_CTRL_PGUP) Row 0
10 Bottom (same as K_CTRL_PGDN) MaxRow()
If no array is passed, then the coordinates for the above
functions will be equivalent to the default values.
Note: Due to Tbrowse limitations, DC_TBINKEY() calculates
the active area of the screen by scanning the columns in
the object to determine the number of heading and footing
rows. This can slow down operation, therefore, to regain
speed it is recommended that you pass two parameters:
< nStartRow > - Starting data row (screen row)
< nEndRow > - Ending data row (screen row)
Returns:
A numeric value equivalent to one of the following:
a. -101 if the mouse is clicked within the navigation region.
b. The INKEY value of any key pressed.
c. The value in <þaButtonsþ>, element #5 if the mouse is
clicked in an <þaButtonsþ> region.
Description:
DC_TBINKEY() is used to easily convert existing Tbrowse
systems to work with a mouse. In most case, simply replacing
the call to INKEY() in the Tbrowse key input handler to a call
DC_TBINKEY() is all that's required.
Examples:
// Start of Tbrowse Key Check routine
do while lastkey()#27
do while !b:stabilize()
enddo
k := DC_TBINKEY(b,0,,,5,22)
do case
case k=K_DOWN
b:down()
case k=K_UP
b:up()
case k=K_PGDN
b:pagedown()
case k=K_PGUP
b:pageup()
case k=K_CTRL_PGUP
b:gotop()
case k=K_CTRL_PGDN
b:gobottom()
case k=K_RIGHT
b:right()
case k=K_LEFT
b:left()
case k=K_HOME
b:home()
case k=K_END
b:end()
case k=K_CTRL_LEFT
b:panleft()
case k=K_CTRL_RIGHT
b:panright()
case k=K_CTRL_HOME
b:panhome()
case k=K_CTRL_END
b:panend()
endcase
enddo
Source/Library:
_DCTBINK.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_inkey()
dc_mousekey()
dc_testbof()
Test if record pointer is at top of file
Syntax:
DC_TestBof() - > lStatus
Arguments:
None.
Returns:
The actual number of records that were skipped. This number may
be less than the number of records requested in the event that
the first or last record in the scoped group was encountered.
DC_DBSKIP() will not skip past the bottom record or previous
the top record in a scoped group.
Description:
DC_TESTBOF() is used to test whether or not the record pointer
is at the first record in the file. This function works with
scoped databases.
Notes:
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_setscope()
dc_testeof()
Test if record pointer is at bottom of file
Syntax:
DC_TestEof() - > lStatus
Arguments:
None.
Returns:
The actual number of records that were skipped. This number may
be less than the number of records requested in the event that
the first or last record in the scoped group was encountered.
DC_DBSKIP() will not skip past the bottom record or previous
the top record in a scoped group.
Description:
DC_TESTEOF() is used to test whether or not the record pointer
is at the last record in the file. This function works with
scoped databases.
Notes:
Source/Library:
_DCSCOPE.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_setscope()
dc_testlockenable()
A Get-set function to enable testing a lock when using DC_RecLock()
Syntax:
DC_TestLockEnable( < lSetting > ) - > < lOldSetting >
Returns:
A logical value.
Description:
DC_TestLockEnable() is a Get-Set function that is used to enable
a feature in DC_RecLock() and DC_AddRec() that writes to the
record to insure that the lock was established. The write simply
echoes back the value of the first field in the record.
The default is FALSE.
Source/Library:
_DCLOCK.PRG, DCLIPX.DLL
See Also:
dc_reclock()
dc_addrec()
dc_timetosec()
Convert a time string to seconds
Syntax:
DC_TimeToSec( < cTimeString > ) - > < nSeconds >
Arguments:
< cTimeString > is a time string in the format hh:mm:ss.
Returns:
A numeric value.
Description:
DC_TimeToSec() is used to convert a time string in the format
hh:mm:ss to a numeric seconds since midnight.
Source/Library:
_DCCALEN.PRG, DCLIPX.DLL
dc_token()
Extract a token from a string
Syntax:
DC_Token ( < cString >, ;
[< cDelims >], ;
< nOccurence > ) - > cToken
Arguments:
< cString > is a character string containing tokens.
< cDelims > is a character string containing the delimeter(s)
to use between tokens. If no parameter is passed then the
following default set of delimeters will be used:
< SPACE >
Š,.;:!?/()#&%+-*
< CHR(0) >
< CHR(9) >
< CHR(10) >
< CHR(13) >
< CHR(26) >
< nOccurence > is the number of the token to extract.
Returns:
A character string.
Description:
DC_TOKEN() is used to extract a portion of a character
string based on it's "token" position within the string.
Tokens are sub-strings within a string that are separated
by common delimiters.
Examples:
cString := 'This is a test'
? DC_TOKEN( cString,,2 )
is
cString := 'AB|CD|EF|GHI|JKLM|NOP|QR|STUVW|XYZ'
? DC_TOKEN( cString,'|',5 )
JKLM
Source/Library:
_DCTOKEN.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_tokenarray()
dc_tokenarray()
Parse all tokens in a string to an Array
Syntax:
DC_TokenArray ( < cString >, ;
[< cDelims >], ;
[< lQuotes >] ) - > aTokens
Arguments:
< cString > is a character string containing tokens.
< cDelims > is a character string containing the delimeter(s)
to use between tokens. If no parameter is passed then the
following default set of delimeters will be used:
< SPACE >
Š,.;:!?/()#&%+-*
< CHR(0) >
< CHR(9) >
< CHR(10) >
< CHR(13) >
< CHR(26) >
If < lQuotes > is .TRUE. then delimiters that exist within quotes ""
are ignored and quotes are stripped. Default is .FALSE.
Example: cString := '"Donnay, Inc.",'"eXpress++"'
DC_TokenArray(cString,',',.f.) - >
returns {""Donnay", " Inc."", ""eXpress++""}
DC_TokenArray(cString,',',.t.) - >
returns {"Donnay, Inc.", "eXpress++"}
Returns:
A array of character strings.
Description:
DC_TOKENARRAY() is used to return an array of character
strings derived from a single character string. Tokens are
sub-strings within a string that are separated by common
delimiters. The array returned will contain one element for
each token in the string.
Examples:
cString := 'AB|CD|EF|GHI|JKLM|NOP|QR|STUVW|XYZ'
aTokens := DC_TOKENARRAY( cString,'|' )
display array aTokens
[1] C AB
[2] C CD
[3] C EF
[4] C GHI
[5] C JKLM
[6] C NOP
[7] C QR
[8] C STUVW
[9] C XYZ
Source/Library:
_DCTOKEN.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_token()
dc_tokenjustify()
Perform text-justfication of tokens in a string
Syntax:
DC_TokenJustify ( < cString >, ;
[< cDelims >], ;
< nWidth >, ;
< nType > ) - > cString
Arguments:
< cString > is a character string containing tokens.
< cDelims > is a character string containing the delimeter(s)
to use between tokens. If no parameter is passed then the
following default set of delimeters will be used:
< SPACE >
Š,.;:!?/()#&%+-*
< CHR(0) >
< CHR(9) >
< CHR(10) >
< CHR(13) >
< CHR(26) >
< nWidth > is the final width of the resultant character
string.
< nType > is used to denote the type of justification to
perform:
0 - Center Justify to fit < nWidth > characters
1 - Pad Right until < nWidth > characters
2 - Left Justify. Pad right to < nWidth > characters
3 - Pad Left until < nWidth > characters
4 - Right Justify. Pad left to < nWidth > characters
Returns:
A character string.
Description:
DC_TOKENJUSTIFY() is used to perform text justification of
all tokens in a character string.
Tokens are sub-strings within a string that are separated
by common delimiters.
Examples:
cString := 'This is a test'
? DC_TOKENJUSTIFY( cString,,50,0 )
This is a test
Source/Library:
_DCTOKEN.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_token()
dc_tokenarray()
dc_tokennum()
Determine the number of tokens in a string
Syntax:
DC_TokenNum ( < cString >, ;
[< cDelims >] ) - > nTokens
Arguments:
< cString > is a character string containing tokens.
< cDelims > is a character string containing the delimeter(s)
to use between tokens. If no parameter is passed then the
following default set of delimeters will be used:
< SPACE >
Š,.;:!?/()#&%+-*
< CHR(0) >
< CHR(9) >
< CHR(10) >
< CHR(13) >
< CHR(26) >
Returns:
A numeric value.
Description:
DC_TOKENNUM() is used to determine the number of tokens
that exist in a character string.
Tokens are sub-strings within a string that are separated
by common delimiters.
Examples:
cString := 'This is a test'
? DC_Token( cString,,2 )
is
? DC_NUMTOKEN( cString )
4
cString := 'AB|CD|EF|GHI|JKLM|NOP|QR|STUVW|XYZ'
? DC_Token( cString,'|',5 )
JKLM
? DC_NUMTOKEN( cString )
9
Source/Library:
_DCTOKEN.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_token()
dc_tokenarray()
dc_tooltipenable()
Enable or Disable Tooltip threads
Syntax:
DC_ToolTipEnable( [< lEnable >] ) - > lOldSetting
Arguments:
< lEnable > if .TRUE. will enable tooltips, otherwise tooltips will
be disabled.
Description:
DC_ToolTipEnable() is a Get-Set function that is used to enable or
disable tooltip threads.
Each time DCREAD GUI or DC_ReadGui() is called, a tooltip thread is
started to handle the displaying of tooltips. This thread is
started only if there is at least one TOOLTIP defined in the
GetList. DC_ToolTipEnable(.f.) will prevent the thread from
starting.
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
See Also:
dc_tooltiptimeout()
dc_tooltiptimeout()
Sets the timeout period for tooltips
Syntax:
DC_ToolTipTimeout( [< nSeconds >] ) - > nOldSetting
Arguments:
< nSeconds > is the amount of seconds to display the tooltip.
Description:
DC_ToolTipTimeout is a Get-Set function that is used to cause
tooltip messages to timeout after a specified amount of mouse
inactivity. The default is 5 seconds. This should fix the
problem of tooltips bleeding through other windows.
Examples:
DC_ToolTipTimeOut(10) // 10 seconds
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_tooltipenable()
dc_translate()
Translate a command line to an array of Functions
Syntax:
dc_translate ( < cCommandLine > ) - > aFunctions
Arguments:
< cCommandLine > is any command string that contains Xbase++
commands, eXPress++ commands or commands from pre-processor
include files which are part of < cCommandLine > or which are
defined in DCCUSTOM.CH.
Description:
DC_TRANSLATE() is a fully-recursive command translator that
translates commands into an array of functions to be executed
via the macro-compiler. DC_TRANSLATE() requires that the file
DCSTD.CH exist in the INCLUDE path of the workstation. The
DCSTD.CH file contains all the standard eXPress++ commands and
pointers to the Xbase++ include files for the standard Xbase++
commands and defines.
If the command syntax entered matches a command in any of the
loaded include files, then it will be converted to an array of
character expressions.
Examples:
accept "enter a command" to cCommand
aFunctions := DC_TRANSLATE( cCommand )
for i := 1 to len(aFunctions)
cMacro := aFunctions[i]
xDummy := &cMacro
next
Source/Library:
_DCTRAN1.PRG
See Also:
dc_dot()
dc_interpret()
dc_txtclose()
Close text file
Syntax:
DC_TxtClose ( < nHandle > ) - > lStatus
Arguments:
< nHandle > is the numeric file handle returned by DC_TXTOPEN().
Caution: This is NOT the dos file handle.
Returns:
A logical .TRUE. if the file was successfully closed.
Description:
DC_TXTCLOSE() is used to close a text file that was opened with
DC_TXTOPEN().
Examples:
nHandle := dc_txtopen( 'dclip.sys' )
do while !dc_txteof( nHandle )
? dc_txtline( nHandle )
dc_txtskip( nHandle, 1 )
enddo
DC_TXTCLOSE( nHandle )
Source/Library:
_DCTXT.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_txtopen()
dc_txtcount()
Return the number of lines in an open text file
Syntax:
DC_TxtCount ( < nHandle > ) - > nLines
Arguments:
< nHandle > is the numeric file handle returned by DC_TXTOPEN().
Caution: This is NOT the dos file handle.
Returns:
A number value equal to the number of lines in the text file.
Description:
DC_TXTCOUNT() is used to report the number of lines in a text
file that was opened with DC_TXTOPEN().
Examples:
nHandle := dc_txtopen( 'dclip.sys' )
if DC_TXTCOUNT( nHandle ) < 100
do while !dc_txteof( nHandle )
? dc_txtline( nHandle )
dc_txtskip( nHandle, 1 )
enddo
dc_txtclose( nHandle )
endif
Source/Library:
_DCTXT.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_txtopen()
dc_txteof()
Is file pointer at end of text file?
Syntax:
DC_TxtEof( < nHandle > ) - > lStatus
Arguments:
< nHandle > is the numeric file handle returned by DC_TXTOPEN().
Caution: This is NOT the dos file handle.
Returns:
A logical .TRUE. if the file pointer is at the end of the text
file, .FALSE. otherwise.
Description:
DC_TXTEOF() reports whether the file pointer is at the end of a
text file that was opened with DC_TXTOPEN().
Examples:
nHandle := dc_txtopen( 'dclip.sys' )
do while !DC_TXTEOF( nHandle )
? dc_txtline( nHandle )
dc_txtskip( nHandle, 1 )
enddo
dc_txtclose( nHandle )
Source/Library:
_DCTXT.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_txtopen()
dc_txtfind()
Fast text search for a string within a text file
Syntax:
DC_TxtFind( < nHandle >, ;
< cSearchString >, ;
[< lCaseSensitive >] ) - > nFilePointer
Arguments:
< nHandle > is the numeric file handle returned by DC_TXTOPEN().
< cSearchString > is the text to find.
< lCaseSensitive > if .TRUE. (default) will only find text that
exactly matches the case of < cSearchString >.
Returns:
The numeric position (byte pointer) where the text was found.
If the text was not found, the value -1 will be returned and
the pointer will be at the end of the file.
Description:
DC_TXTFIND() is used to find a string of text in a text file.
The search will be started at the current file pointer.
Examples:
. nHandle := dc_txtopen( 'customer.txt' )
. nFoundAt := DC_TXTFIND( nHandle, 'Jones' )
. ? nFoundAt
67345
Source/Library:
_DCTXT.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_txtopen()
dc_txtgoto()
Goto a specified line in a text file
Syntax:
DC_TxtGoTo ( < nHandle >, ;
< nLineNumber > ) - > nLinePointer
Arguments:
< nHandle > is the numeric file handle returned by DC_TXTOPEN().
Caution: This is NOT the dos file handle.
< nLineNumber > is the line in the text file to go to.
Returns:
A logical .TRUE. if the file pointer was successfully moved to
the specified line, .FALSE. otherwise.
Description:
DC_TXTGOTO() is used to go to a specified line of text in a
text file that was opened with DC_TXTOPEN().
Examples:
// This example will open the source code file and extract the
// line of code that caused a runtime error.
proc myerror
cPrgName := dc_objfind( procname(1) )
nLineNo := procline(1)
nHandle := dc_txtopen( cPrgName )
DC_TXTGOTO( nHandle, nLineNo )
? "This is the line of code that caused the error:"
? dc_txtline( nHandle )
dc_txtclose( nHandle )
Source/Library:
_DCTXT.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_txtopen()
dc_txtline()
Read the current line of a text file
Syntax:
DC_TxtLine ( < nHandle >, ;
< cEol > ) - > cString
Arguments:
< nHandle > is the numeric file handle returned by DC_TXTOPEN().
Caution: This is NOT the dos file handle.
< cEol > is the character string sequence that determines the
end of a line. The default is CHR(13)+CHR(10).
Returns:
A string containing the contents of the current text line.
Description:
DC_TXTLINE() will return the contents of the current line of
text in a text file opened with DC_TXTOPEN().
Examples:
nHandle := dc_txtopen( 'dclip.sys' )
do while !dc_txteof( nHandle )
? DC_TXTLINE( nHandle )
dc_txtskip( nHandle, 1 )
enddo
dc_txtclose( nHandle )
Source/Library:
_DCTXT.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_txtopen()
dc_txtlno()
Report the current line pointer of an open text file
Syntax:
DC_TxtLNo ( < nHandle > ) - > nLine
Arguments:
< nHandle > is the numeric file handle returned by DC_TXTOPEN().
Caution: This is NOT the dos file handle.
Returns:
The current line number pointer of the text file.
Description:
DC_TXTLNO() is used to report the current line pointer in a
text file that was opened with DC_TXTOPEN().
Examples:
nHandle := dc_txtopen( 'dclip.sys' )
? DC_TXTLNO( nHandle )
1
dc_txtskip( nHandle, 2 )
? DC_TXTLNO( nHandle )
3
Source/Library:
_DCTXT.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_txtopen()
dc_txtopen()
Open a text file for use with Text file functions
Syntax:
DC_TxtOpen ( < cFileName > ) - > nHandle
Arguments:
< cFileName > is the name of the text file to open.
Returns:
A numeric file handle to be used by the other DC_TXT*()
functions.
Description:
DC_TXTOPEN() is used to open a text file for processing. The
DC_TXT*() set of functions are used to access and read the
information from text files much faster than can be
accomplished via the standard Clipper low-level file functions.
Examples:
nHandle := DC_TXTOPEN( 'dclip.sys' )
do while !dc_txteof( nHandle )
? dc_txtline( nHandle )
dc_txtskip( nHandle, 1 )
enddo
dc_txtclose( nHandle )
Source/Library:
_DCTXT.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_txtclose()
dc_txtsize()
Return the size in bytes of an open text file
Syntax:
DC_TxtSize ( < nHandle > ) - > nBytes
Arguments:
< nHandle > is the numeric file handle returned by DC_TXTOPEN().
Caution: This is NOT the dos file handle.
Returns:
The size of the text file in bytes.
Description:
DC_TXTSIZE() returns the size of a currently opened text file
that was opened with DC_TXTOPEN().
Examples:
nHandle := dc_txtopen( 'DCLIP.SYS' )
? DC_TXTSIZE( nHandle )
672
Source/Library:
_DCTXT.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_txtopen()
dc_txtskip()
Skip a specified number of lines in a text file
Syntax:
DC_TxtSkip ( < nHandle >, ;
< nLines >, ;
[< cEol >] ) - > nLinePointer
Arguments:
< nHandle > is the numeric file handle returned by DC_TXTOPEN().
Caution: This is NOT the dos file handle.
< nLines > is the number of text lines to skip.
< cEol > is the character string sequence that determines the
end of a line. The default is CHR(13)+CHR(10).
Description:
DC_TXTSKIP() is used to move the line pointer a specified
number of lines in a text file opened with DC_TXTOPEN().
Examples:
nHandle := dc_txtopen( 'dclip.sys' )
do while !dc_txteof( nHandle )
? dc_txtline( nHandle )
DC_TXTSKIP( nHandle, 1 )
enddo
dc_txtclose( nHandle )
Source/Library:
_DCTXT.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_txtopen()
dc_txtword()
Return value of a word in a String by specifying position
Syntax:
DC_TxtWord ( < cString >, ;
< nPosition >, ;
[< cWhiteSpace >] ) - > cWord
Arguments:
< cString > is the string to search.
< nPosition > is the numerical position of the word.
< cWhiteSpace > is the character to be used as the "white
space" character. (The default is SPACE " ").
Returns:
The word corresponding to <þnPositionþ>. If <þnPositionþ> is
greater than the number of words in <þcStringþ> then a null
will be returned.
Description:
DC_TXTWORD() returns a specified word from the numerical
position in the sentence.
Examples:
? DC_TXTWORD( 'This is a test', 2)
is
Source/Library:
_DCTXT.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_token()
dc_unc2drive()
Converts a UNC path to a local mapped path
Syntax:
DC_UNC2Drive( < cUNC > ) - > cDrive
Arguments:
< cUNC > is a UNC path.
Description:
DC_UNC2Drive() converts a UNC to a mapped local drive letter.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_drive2unc()
dc_updated()
Determine whether a GET changed during a READ
Syntax:
DC_Updated ( < lUpdated > ) - > lUpdated
Arguments:
< lUpdated > if .TRUE. will set the "updated" flag. If no
parameter is passed, then only the current status will be
returned.
Returns:
.TRUE. if any GETS were updated during the read, .FALSE.
otherwise.
Description:
DC_UPDATED() determines whether characters were successfully
entered into a GET from the keyboard during the most current READ.
Each time READ executes, DC_UPDATED() is set to false (.F.). Then,
any change to a GET entered from the keyboard sets DC_UPDATED() to
true (.T.) after the user successfully exits the GET. If the user
presses Esc before exiting the first GET edited, DC_UPDATED()
remains false (.F.). Once DC_UPDATED() is set to true (.T.), it
retains this value until the next READ is executed.
Within a SET KEY or VALID procedure, you can change the current
GET variable using the KEYBOARD command or by assigning a new
value with one of the many assignment operators. Changing the
variable with KEYBOARD is the same as if the user had entered the
change directly from the keyboard, and DC_UPDATED() is set
accordingly. However, since DC_UPDATED() reflects only those
changes made from the keyboard, an assignment to the GET variable
does not affect DC_UPDATED(), therefore you should call
call DC_UPDATED(.t.) to set the updated flag.
Notes:
DC_UPDATED() works with DC_READMODAL() in the same way that
Clipper's UPDATED() works with READMODAL().
Examples:
local cCustName, cPhoneNmbr
store customer->cust_name to cCustName
store customer->phone_nmbr to cPhoneNmbr
@ 10,10 say 'Customer Name ' get cCustName
@ 11,10 say 'Phone Number ' get cPhoneNmbr
dc_readmodal( GetList )
IF DC_UPDATED() .and. dc_reclock()
replace cust_name with cCustName
replace phone_nmbr with cPhoneNmbr
unlock
ENDIF
Source/Library:
_DCGETSY.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_readmodal()
dc_usearea()
Open a database file in a work area
Syntax:
DC_UseArea( [< lNew >], ;
[< cDbe >], ;
< cDatabase >, ;
[< cAlias >], ;
[< lShared >], ;
[< lReadOnly >],
[< lDisplayError >], ;
[< lBreak >], ;
[< lError >], ;
[< lAutoOpen >], ;
[< lUseAIndex >], ;
[< cAltDbe >] ) - > nil
Arguments:
< lNew > if .TRUE. will open the database in a new work area. If
.FALSE. (default), the current work area will be used.
< cDbe > is the DBE to use. If no argument is passed, then the
< cAltDbe > will be used followed by the current DBE.
< cDatabase > is the name of the file to open. If no drive and
directory is included then the file must exist in the SET
DEFAULT directory or SET PATH directory.
< lShared > if .TRUE. will open the database in SHARED mode, if
.FALSE. will open the database in EXCLUSIVE mode. If no
argument is passed, then the system SET EXCLUSIVE value will be
used.
< lReadOnly > if .TRUE. will open the database for Read
operations only, if .FALSE. (default) will open the database
for Read/Write operations.
< cAlias > is the ALIAS to assign to the work area. If no
argument is passed then the prefix of the database name will
be used as the alias.
< lDisplayError > if .TRUE. (default) will display an error window
if the file could not be opened.
< lBreak > if .TRUE. will BREAK after an error rather than RETURN.
The default is .FALSE.
@< lError > is a logical parameter, passed by reference. If an
error occurs this variable will be set to .TRUE., otherwise it
will be set to .FALSE.
< lAutoOpen > is used to override the "auto-open" feature of the
some data drivers. Passing a .FALSE. (default is .TRUE) will
force the data driver to NOT open any associated *.CDX index
file.
< lUseAIndex > if .TRUE. will open all indexes that start with
the same name as the database alias.
< cAltDbe > is an alternate DBE to use if the database cannot be
opened by the primary < cDbe > driver.
Returns:
Nil.
Description:
DC_USEAREA() is a front-end to the Xbase++ dbusearea() function
that can be used as a replacement for opening databases. This
function tests the validity of a database and it's associated
memo file (if it exists) before attempting to open it to
prevent common errors. Working with different database drivers
can make it difficult to determine the cause of an open error.
This function is designed to test a database to make sure it is
a proper type. Parameters passed to DC_USEAREA() are identical
to dbusearea() so this function can be used as a replacement.
DC_USEAREA() tests the function DC_UseDBFProtect(). If this
function returns a logical .TRUE. then, DC_USEAREA() first
checks the header of the database to be opened to see if it
has first been modified by DC_CloseArea(). DC_CloseArea() is
used to modify the header of a .DBF style database before it is
close to prevent other utility programs from being able to
open the database. DC_USEAREA() will change the header first
to insure that the database can be opened without errors.
Examples:
. DC_USEAREA ( .t., 'FOXCDX', 'EXPRESS',, .t., .f. )
Source/Library:
_DCUSE.PRG, DCLIP2.DLL
See Also:
dc_dbfile()
USE
dc_usedbfprotect()
dc_closearea()
dc_usedbfprotect()
A Get/Set function for establishing data protection mode
Syntax:
DC_UseDBFProtect( [< lProtect >] ) - > lStatus
Arguments:
If < lProtect > is a logical .TRUE. then data protect mode is
set ON. If < lProtect > is a logical .FALSE. then data protect
mode is set OFF. If < lProtect > is not passed, then the
function is used only to return the current setting.
Returns:
A logical value.
Description:
DC_UseDBFProtect() is a Get/Set function used to set data
protect mode ON or OFF.
If this function returns a logical .TRUE. then DC_CLOSEAREA()
first modifies the header of the database before the database
is closed to prevent other utility programs from being able to
open the database. If a file header is modified by DC_CLOSEAREA(),
then it can only be restored again by DC_USEAREA() by first
calling DC_UseDBFProtect(.T.).
Examples:
. DC_UseDBFProtect(.t.)
// open TEST.DBF
. DC_UseArea( .t., 'DBFNTX', 'TEST' )
// close TEST.DBF but first modify header to protect the data
. DC_CloseArea()
Source/Library:
_DCUSE.PRG, DCLIP2.DLL
See Also:
dc_usearea()
dc_closearea()
dc_useraccess()
Determine if Logged-On user has access to a lock
Syntax:
dc_useraccess ( < cLockCode >, ;
[< cErrorMsg >] ) - > lStatus
Arguments:
< cLockCode > is a 5-character "Lock" code.
< cErrorMsg > is the message to display if the user does not
have posession of the key to the specified lock or a master
key. If this parameter is not passed, then a default message
will be displayed.
Returns:
A logical .TRUE. if the user possesses a key to the specified
lock, .FALSE. otherwise.
Description:
DC_USERACCESS() is used to established whether or not the
logged-on user has possession of a key to a specified lock.
If NO user has logged on with DC_USERLOGON() or the
logged-on user is a programmer or the logged-on user has
been assigned "no keys" then a logical .TRUE. will always be
returned.
Examples:
#include 'dcuser.ch'
DC_UserLogon( 'CURLY' )
-- Example 1 --
IF !DC_USERACCESS( '511', "Sorry. You can't use this menu!" )
RETURN
ENDIF
DC_MenuRun('MENU511')
Source/Library:
_DCUSER.PRG
See Also:
dc_usermaint()
dc_userlogin()
dc_userfree()
Free the lock on the the User file to allow user access
Syntax:
dc_userfree ( ) - > Nil
Arguments:
None.
Returns:
Nil.
Description:
DC_USERFREE() is used to remove the lock on the DCUSERS.DBF
database that was previously used to lock out all users.
Examples:
? DC_USERLOCK()
.f.
Source/Library:
_DCUSER.PRG
See Also:
dc_usermaint()
dc_userlock()
dc_userinfo()
Get or Set information about Logged-On User
Syntax:
dc_userinfo ( [< nElement >], ;
[< xValue >] ) - > aUserInfo | aUserInfo[nElement]
Arguments:
< nElement > is the array item to return. If the < nElement >
argument is not passed then the entire array will be returned.
< xValue > is the value to store in aUserInfo[< nElement >].
Returns:
An array if <þnElementþ> is not passed or a value dependent on
the value of <þnElementþ>.
The array consists of 15 elements (See DCUSER.CH) for
array definitions:
Element Type Description
------- ---- -------------------------------------------
[1] C USER_ID - User ID code
[2] C USER_NAME - User Name
[3] C USER_KEYS - User Keys (separated by commas)
[4] C USER_MASTERPASS - Master Password
[5] L USER_PROGRAMMER - "Programmer" flag
[6] C USER_PASSWORD - Logged On User Password
[7] C USER_MENU - User Start Menu Name
[8] C USER_WPNAME - User Word Processor
[9] C USER_WPPARAM - User Word Processor parameters
[10] C USER_WPPATH - User Word Processor directory
[11] C USER_GROUP - User Group
[12] L USER_MAILFLAG - Mail Flag
[13] L USER_PHONEFLAG - Phone message Flag
[14] L USER_COLOR - Set Color ON Flag
[15] C USER_PRINTER - User Printer Name
[16] C USER_DEPT - User Department
[17] B USER_WALL - Code Block for user wallpaper
[18] L USER_MULTI - User Multiple Login enabled
[19] C USER_JOB - User Job Name
[20] N USER_NUM_UDF_1 - User Numeric UDF #1
[21] N USER_NUM_UDF_2 - User Numeric UDF #2
[22] N USER_NUM_UDF_3 - User Numeric UDF #3
[23] N USER_CHAR_UDF_1 - User Numeric UDF #1
[24] N USER_CHAR_UDF_2 - User Numeric UDF #2
[25] N USER_CHAR_UDF_3 - User Numeric UDF #3
[26] N USER_CHAR_UDF_4 - User Numeric UDF #4
[27] N USER_CHAR_UDF_5 - User Numeric UDF #5
[28] N USER_CHAR_UDF_6 - User Numeric UDF #6
[29] N USER_LOGIC_UDF_1 - User Logical UDF #1
[30] N USER_LOGIC_UDF_2 - User Logical UDF #2
[31] N USER_DATE_UDF_1 - User Date UDF #1
[32] N USER_DATE_UDF_2 - User Date UDF #2
[33] C USER_SYSTEM - User System Name
[34] C USER_APPTYPE - User Application Type
[35] C USER_APPCODE - User Application Code
[36] C USER_LOCATION - User Location
[37] C USER_NUMBER - User Number
Description:
DC_USERINFO() is used to set or get information about the
logged-on user. This array is built when the user logs on
with DC_UserLogOn() or DC_UserSet().
Examples:
#include 'dcuser.ch'
DC_UserLogon( 'LARRY' )
-- Example 1 --
? DC_USERINFO( USER_ID )
LARRY
-- Example 2 --
/* -- Give user temporary access to all menus -- */
DC_USERINFO( USER_KEYS, '' )
-- Example 3 --
? DC_USERINFO()[ USER_KEYS ]
1****,2****,31***,32000,32100,4****
Source/Library:
_DCUSER.PRG
See Also:
dc_usermaint()
dc_userlogin()
dc_userlock()
Lock or attempt to lock all users out of the system
Syntax:
dc_userlock () - > lStatus
Arguments:
< aErrorMsg > is an array of character strings to display as
the message in the event that the DCUSERS.DBF database cannot
be locked. If this argument is not passed, then a default
message will be displayed.
Returns:
A logical .TRUE. if the file was locked successfully, .FALSE.
otherwise.
Description:
DC_USERLOCK() is used to lock or attempt to lock the DCUSERS.DBF
database to prevent users from logging onto the system for
maintenance purposes. This function will attempt to lock the
file first. If other users are on the system, then the file
cannot be locked and a list of logged on users will be
displayed in the error message window.
Examples:
? DC_USERLOCK()
.f.
Source/Library:
_DCUSER.PRG
See Also:
dc_usermaint()
dc_userfree()
dc_userlogin()
Login to application to establish user rights
Syntax:
dc_userlogin ( [< cUserID >], ;
[< cPassword >], ;
[< nStartRow >], ;
[< oParent >] ) - > lStatus
Arguments:
< cUserID > is the User ID of the logging on user. If this
parameter IS NOT passed and the < cPassword > parameter IS
passed, then the DCUSERS.DBF will be searched only for a
match to the < cPassword >. If < cUserID > is passed and
< cPassword > is not passed, then the user will be prompted to
enter a password. If neither < cUserID > or < cPassword > is
passed, then the user will be prompted for both a User ID
and a password.
< nStartRow > is the starting display row of the screen. This is
ignored if the DC_Gui() flag is on because the dialog is centered
withing its parent.
< oParent > is the parent window that will receive the user dialog
window. If this argument is a nil the parent will be the
AppDesktop().
Returns:
A logical .TRUE. if the user logs on successfully, .FALSE.
otherwise.
Description:
DC_USERLOGIN() is used to log a user onto the system in the
event that it is necessary to establish rights to menus, files,
or specified fields.
The eXPress++ menu system, data-entry (editing) system, browsing
system, and file system provide for establishing locks on menu
items, fields and/or files. If these systems are used without
first calling DC_USERLOGIN(), then the user will be given full
rights. If however, DC_USERLOGIN() is called first, then the
user will be given access to only those items in which the user
has the exact key or a master key for each specified lock.
If the user logs on with the MASTER PASSWORD, then he/she is
automatically established as a "programmer" and is given full
access. The MASTER PASSWORD is hard-coded by a definition in
DCUSER.CH. To change the MASTER PASSWORD you must redefine it
in DCUSER.CH and then recompile _DCUSER.DBF and include the
new _DCUSER.OBJ in your link-script.
User PASSWORDS are stored in the DCUSER.DBF database in
encrypted form. Passwords may be assigned or changed only
with the DC_USERMAINT() function or the USER EDIT command.
User KEYS are stored in the DCUSER.DBF database and may be
assigned or changed only with the DC_USERMAINT() function or
the USER EDIT command. Locks are placed on menu items or
fields by entering a 3-character "lock" sequence when using
the menu-designer and/or data-entry designer. A database of
standard locks and their definitions may be maintained by
DC_LOCKMAINT(). When assigning a user a set of "keys" they
may be specific keys or "master" keys. A Master key is
assigned by using wild-cards. For example, the Master Key
"5****" will allow access to any lock starting with the number
"5", whereas the Master Key "67***" will allow access to any
lock with the number "67". Keys are stored in the USR_KEYS
field and are separated by commas.
Example:
"1****,2****,3****,41***,42***,52231,6****"
Examples:
#include 'dcuser.ch'
DC_USERLOGIN( 'LARRY' )
Source/Library:
_DCUSER.PRG
See Also:
dc_usermaint()
dc_usermaint()
Maintain the DCUSERS.DBF User Database
Syntax:
DC_UserMaint ( [< cUserID >] ) - > lStatus
Arguments:
If the < cUserID > argument is passed, then the record that
contains the USR_ID matching < cUserID > will be edited,
otherwise all records will be available for browsing and
editing.
Returns:
A logical .TRUE. if the user database was opened and accessed,
.FALSE. otherwise.
Description:
DC_USERMAINT() is used to maintain the DCUSER.DBF database
for establishing User ID's, Names, Passwords, Access Keys,
etc.
Examples:
#include 'dcuser.ch'
-- Example 1 --
DC_USERMAINT( 'LARRY' )
-- Example 2 --
DC_USERMAINT()
Source/Library:
_DCUSER.PRG
See Also:
dc_userlogin()
USER EDIT
dc_userset()
stablish the Logged-On user from the User Database
Syntax:
dc_userset ( < cUserID > ) - > lStatus
Arguments:
< cUserID > is a valid user id that matches the value in the
USR_ID field of the DCUSER.DBF database.
Returns:
A logical .TRUE. if the User ID was found in the database,
.FALSE. otherwise.
Description:
DC_USERSET() is used to load the logged-on user array from
a specifed record in the DCUSERS.DBF database.
Examples:
DC_USERSET( 'MOE' )
Source/Library:
_DCUSER.PRG
See Also:
dc_usermaint()
dc_userinfo()
dc_util()
A menu of database utilities
Syntax:
DC_Util() - > nil
Returns:
Nil.
Description:
DC_UTIL() provides a set of general-purpose database utilities
to perform menu-driven, complex database operations on the
currently selected work area.
Menu Selections
---------------------
Create Database
Display Structure
Modify Structure
Copy Structure
Append Records
Copy Records
Import a Data File
Replace Data
Copy Fields
Delete Records
Recall Records
Sort Database
Join with Database
Count Records
Sum Data Fields
Average Data Fields
Disk Directory
Insert Blank Record(s)
Pack DataBase
Zap Database
Import/eXport Memos
Purge Duplicate Records
Examples:
. USE COLLECT
. DC_Util()
Source/Library:
_DCUTIL.PRG, DCLIP2.DLL
See Also:
UTIL
dc_validateblock()
Validate a code block string
Syntax:
DC_ValidateBlock( < cBlock >, ;
[< cValType >], ;
[@< bBlock >] ) - > lValid
Arguments:
< cBlock > is the string to be validated. If the string does
not start with a valid code block identifier: {| then this will
be added to the string to blockify it before testing it.
< cValType > is a string containing the valid types of values
that may be returned by the code block when it is evaluated.
Default is '(C)har), (D)ate, (N)umeric, (L)ogical, (U)ndefined'.
This string is used to validate the output and also to display
a user message if the code block returns an incorrect value.
@< bBlock > is the name of a variable (passed by reference) to
store the resultant compiled code block.
Returns:
A logical .TRUE. if a valid expression or codeblock was passed.
Description:
DC_ValidateBlock() is used to validate a string that must later
be macro-compiled into a code block. It attempts to compile
the string and traps and possible errors.
Examples:
@ 1,1 DCSAY 'Enter Expression or Code Block' ;
GET cBlock ;
VALID {||DC_ValidateBlock(cBlock)}
Source/Library:
_DCEVAL.PRG, DCLIPX.DLL
dc_valtype()
Validate input parameters and set default values
Syntax:
DC_ValType( @< cMemVar >, ;
< xDefaultVal > [,...] ) - > nil
Arguments:
< cMemVar > is the memory variable to validate.
< xDefaultVal > is the value to initialize < cMemVar > if the
< cMemVar > is not the same type as < xDefaultVal >.
Returns:
NIL
Description:
DC_VALTYPE() is a handy way of validating paramters that
are passed to functions and filling them with default
values if the parameter is not passed or if the wrong
type of parameter is passed.
Notes:
DC_VALTYPE() supports type-checking on up to 15 variables.
If you need to validate more than 15 variables, then call
DC_VALTYPE() a second time with the remaining variables.
Examples:
function window ( nStRow, nStCol, nEnRow, nEnCol, cTitle )
DC_VALTYPE( @nStRow, 0, @nStCol, 0, @nEnRow, MaxRow(), ;
@nEnCol, MaxCol(), @cTitle, "" )
return dc_expl( nStRow, nStCol, nEnRow, nEnCol, cTitle )
Source/Library:
_DCVAL.PRG/.OBJ, DCLIPX.LIB
dc_var2hexstring()
Convert a binary string to a Hex String
Syntax:
DC_Var2HexString( < cBinaryString > ) - > cHexString
Arguments:
< cBinaryString > is a binary string create by Var2Bin().
Returns:
A Character String.
Description:
DC_Var2HexString() is used to convert binary strings to hex
equivalent for storing in .TXT files or in memo fields that do not
accept binary data.
Examples:
// Save Directory to a memo field
aData := Directory()
cData := DC_Var2HexString(Var2Bin(aData))
REPLACE CUSTOMER->directory WITH cData
// Restore Directory from a memo field
cData := DC_HexString2Var(CUSTOMER->directory)
aData := Bin2Var(cData)
Source/Library:
_DCASAVE.PRG, DCLIPX.DLL
dc_var2sql()
Convert Xbase++ value to SQL value
Syntax:
DC_Var2SQL( < xValue > ) - > < cSQLvalue >
Arguments:
< xValue > is any Xbase++ value of type C, M, L, N or D.
Returns:
A character string.
Description:
DC_Var2SQL() is used to convert any Xbase++ value of type
C, L, M, N, or D to a character string which can be inserted into
a SQL statement.
Examples:
cSQL := 'SELECT * FROM invoices WHERE duedate >= ' + ;
DC_Var2SQL( Date() )
Source/Library:
_DCADS.PRG, DCLIPX.DLL
See Also:
dc_adsstatement()
dc_applysqlparams()
dc_varfromlistbox()
Store List box choices into memory variable array
Syntax:
DC_VarFromListBox( < oObject > ) - > nil
Arguments:
< oObject > is a ListBox object created with the @ DCLISTBOX
command, a ComboBox object createdwith the @ DCCOMBOBOX command,
or a PickList object created with the @ DCPICKLIST command.
Returns:
Nil.
Description:
DC_VARFROMLISTBOX() is used to transfer a set of marked items
in a DCCOMBOBOX, DCLISTBOX or DCPICKLIST object into the memory
variable previously assigned to the object.
Examples:
PROCEDURE XTest()
LOCAL GetList := {}, aFields:={}, aOutput:={}
LOCAL oListBox
AADD(aFields, 'Alice')
AADD(aFields, 'Bob')
AADD(aFields, 'Carol')
AADD(aFields, 'Dick')
AADD(aFields, 'Harry')
AADD(aFields, 'Ted')
AADD(aFields, 'Tom')
@ 0,0 DCLISTBOX aOutput LIST aFields ;
FONT "10.Courier" ;
SIZE 15,10 ;
OBJECT oListBox ;
SELECT {2,4,5,6,7}
@ 0, 17 DCPUSHBUTTON ;
CAPTION '~Mark All' ;
SIZE 10, 1.1 ;
FONT '8.MS Sans Serif' ;
ACTION {|| AEVAL(aFields, {|x,i| oListBox:setData(i, .T.)}), ;
DC_VarFromListBox(oListBox)} ;
RELATIVE oListBox
@ 1.5, 17 DCPUSHBUTTON ;
CAPTION 'C~lear All' ;
SIZE 10, 1.1 ;
FONT '8.MS Sans Serif' ;
ACTION {|| AEVAL(aFields, {|x,i| oListBox:setData(i, .F.)}), ;
DC_VarFromListBox(oListBox)} ;
RELATIVE oListBox
DCREAD GUI ;
TITLE 'List Box Demo' ;
FIT ;
ADDBUTTONS
DC_MsgBox(aOutput)
RETURN
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
See Also:
@ DCLISTBOX
@ DCCOMBOBOX
@ DCPICKLIST
dc_vartolistbox()
dc_vartolistbox()
Store memory variable array into ListBox
Syntax:
DC_VarToListBox( < oObject >, ;
[< aItems >], ;
[< aMarked >] ) - > nil
Arguments:
< oObject > is a ListBox object created with the @ DCLISTBOX
command, a ComboBox object createdwith the @ DCCOMBOBOX command,
or a PickList object created with the @ DCPICKLIST command.
< aItems > is an optional array of character strings to store into
the ListBox object. If no array is passed, then the array
anchored to the @ DCLISTBOX, @ DCCOMBOBOX, or @ DCPICKLIST
command will be stored to the ListBox object.
< aMarked > is an optional array of numeric values which is used
to pre-select a set of items.
Returns:
Nil.
Description:
DC_VARTOLISTBOX() is used to transfer an array of character
strings into the ListBox object of a DCCOMBOBOX, DCLISTBOX or
DCPICKLIST object.
Examples:
PROCEDURE XTest()
#include "dcdialog.ch"
#include "dcpick.ch"
LOCAL GetList := {}
LOCAL GetOptions
LOCAL aMen := {}
LOCAL aWomen := {}
LOCAL aListField := {}
LOCAL aPickField := {}
LOCAL oPickList
LOCAL cOption
AADD(aMen, 'Bob')
AADD(aMen, 'Dick')
AADD(aMen, 'Harry')
AADD(aMen, 'Ted')
AADD(aMen, 'Tom')
AADD(aWomen, 'Alice')
AADD(aWomen, 'Carol')
AADD(aListField, 'One')
AADD(aListField, 'Two')
AADD(aListField, 'Three')
@1,3 DCRADIO cOption PROMPT 'Women' VALUE 'W' ;
ACTION {|| aListField := aWomen, DC_VarToListBox(oPickList) }
@2,3 DCRADIO cOption PROMPT 'Men' VALUE 'M' ;
ACTION {|| aListField := aMen, DC_VarToListBox(oPickList) }
@4,3 DCPICKLIST aPickField LIST aListField ;
CAPTION "Available People", "Selected People" ;
SIZE 35,12 ;
OBJECT oPickList
DCREAD GUI ;
TITLE "Pick a Person" ;
ADDBUTTONS ;
FIT
DC_MsgBox(aPickField)
RETURN
Source/Library:
_DCGETBX.PRG, DCLIPX.DLL
See Also:
@ DCLISTBOX
@ DCCOMBOBOX
@ DCPICKLIST
dc_varfromlistbox()
dc_versionexpress()
Returns the current eXPress++ version
Syntax:
DC_VersionExpress( < nMode > ) - > cVersion
Arguments:
< nMode > is a numeric value designating the version information
being polled.
< nMode > Returns
------- -------------------------------------------------
0 Full version description
Example: eXPress++ (c) Version 1.3
1 Major Revision level
Example: 1
2 Minor Revision level
Example: 3
3 Build Number
Example: 104
Returns:
A character string.
Description:
DC_VERSIONEXPRESS() returns the current version of eXPress++.
Source/Library:
_DCFUNCT.PRG, DCLIPX.LIB
dc_virtcapt()
Capture the current record to a Virtual record array
Syntax:
dc_virtcapture ( [< lFieldNames >] ) - > aVirtualRecord
Arguments:
If < lFieldNames > is a logical .TRUE., then the field name data
will be saved in the array returned. DC_VIRTREPLACE() will
automatically know if the field data information is in the array
and will not cause an error if the structure of the target
database is not the same as the structure of the primary database.
IF < lFieldNames > is .FALSE., then the target database must
exactly match the structure of the primary database.
Returns:
If <þlFieldNamesþ> is .TRUE., returns single-dimensional array with
a number of elements equal to the number of fields in the
current database.
If <þlFieldNamesþ> is .FALSE., returns a multi-dimensional array
of two elements: The first is an array of field names, the
second is an array of data.
Description:
DC_VIRTCAPTURE() is used to capture the data in all fields of
the current database to a VIRTUAL record array to be used with
other DC_VIRT*() functions.
Examples:
. USE COLLECT
. GO 5
. aVirtual := DC_VirtCapt()
. DC_ArrayView( aVirtual )
Source/Library:
_dcvirt.prg, DCLIP2.DLL
See Also:
dc_virtrepl()
dc_virtrepl()
Replace the current record contents with Virtual record arra
Syntax:
dc_virtreplace ( < aVirtualRecord > ) - > lStatus
Arguments:
< aVirtualRecord > is a virtual record array saved by DC_VIRTSAVE().
Returns:
A logical .TRUE. if the data replacement is successful, .FALSE.
otherwise.
Description:
DC_VIRTREPLACE() will replace the contents of the current
record with the data in a virtual record array. This function
will automatically handle the record locking, so it is not
necessary to lock the record.
Examples:
. USE COLLECT
. GO 5
. aVirtual := DC_VirtCapt()
. GO 6
. DC_VirtRepl( aVirtual )
Source/Library:
_dcvirt.prg, DCLIP2.DLL
See Also:
dc_virtcapt()
dc_virtrest()
Restore the virtual record contents to an array
Syntax:
dc_virtrestore ( ) - > aVirtualRecord
Arguments:
None.
Returns:
An array with the contents of the .DCV file.
Description:
DC_VIRTRESTORE() will create a virtual record array from the
contents of a virtual record (.DCV) file which was created with
the DC_VIRTSAVE() function.
Examples:
// this routine will append 5 records to the current database
// that will be filled in with data from the virtual record.
aVirtual := DC_VIRTRESTORE()
if valtype(aVirtual) = 'A'
for i := 1 to 5
dc_addrec()
dc_virtreplace( aVirtual )
next
endif
Source/Library:
_dcvirt.prg, DCLIP2.DLL
See Also:
dc_virtcapt()
dc_virtrepl()
dc_virtsave()
dc_virtsave()
Save the current record to the virtual record file
Syntax:
dc_virtsave ( < aVirtualRecord > ) - > lStatus
Arguments:
< aVirtualRecord > is a virtual record array saved by
DC_VIRTSAVE(). If no argument is passed, then the contents of
the current record in the current work area will be used as the
virtual record.
Returns:
A logical .TRUE. if the save was successful, .FALSE. otherwise.
Description:
DC_VIRTSAVE() will save the contents of a virtual record array
or the current database record to a virtual record (.DCV) file.
The file will have the same name as the current database file
name except it will have the .DCV extension, and will be
located in the same directory as the database file.
A virtual record can be used as a "data template" for multiple
purposes:
1. To fill in default data when appending a new record.
2. To be used to cut and paste data from one record to
another.
Examples:
. USE COLLECT
. GO 5
. DC_VirtSave() // Create COLLECT.DCV
Source/Library:
_dcvirt.prg, DCLIP2.DLL
See Also:
dc_virtcapt()
dc_virtrepl()
dc_virtrest()
dc_wait()
3 Dual-Mode replacement for the WAIT command
Syntax:
DC_Wait ( [< cMessage >] ) - > nil
Arguments:
< cMessage > is the message to display.
Description:
DC_WAIT() is a Dual-mode replacement for the WAIT command.
When the GUI flag is ON, DC_WAIT() functions similiar to
WAIT except that it is displayed in GUI mode. When the
GUI flag is OFF, DC_WAIT() functions identical to WAIT
except it is also activated by a mouse.
Examples:
nHandle := dc_txtopen( '\clipper5\include\std.ch' )
nLine := 0
do while !dc_feof( nHandle ) .and. lastkey()#27
? dc_txtline( nHandle )
dc_txtskip( nHandle, 1 )
nLine++
if nLine > maxrow()-3
DC_WAIT( "Press any key to continue, Escape to Abort")
nLine := 0
endif
enddo
dc_txtclose( nHandle )
Source/Library:
_DCWAIT.PRG/.OBJ, DCLIPX.LIB
dc_waiton()
A Dual-Mode dialog for "Work in Progress"
Syntax:
DC_WaitOn ( [< abcMessage >], ;
[< lSound >], ;
[< cColor1 >], ;
[< cColor2 >], ;
[< nTop >], ;
[< nLeft >], ;
[< lWorking >], ;
[< oParent >] ;
[< oOwner >], ;
[< lModal >] ) - > aDialog
Arguments:
< abcMessage > is the message to place in the window. If this
is passed as an array, then each element must be a character
string representing each line of text in the window. If it
is passed as a code block then the code block must return
either a character string or an array of character strings. If
no argument is passed then the following default message will
be displayed: "Please wait..."
< lSound > if .TRUE. will create a warning tone. .FALSE. is
default. This argument is ignored in GUI mode.
< cColor1 > is the color of the window frame. If no argument
is passed then the system color for "exploding box frame" will
be used. This argument is ignored in GUI mode.
< cColor2 > is the color of the window contents. If no
argument is passed then the system color for "exploding box
contents" will be used. This argument is ignored in GUI mode.
< nTop > is the top display row of the message box. If no
argument is passed, then the box will be vertically positioned
in the center of the screen. This argument is ignored in GUI
mode.
< nLeft > is the left display column of the message box. If no
argument is passed, then the box will be horizontally
positioned in the center of the screen. This argument is ignored
in GUI mode.
< lWorking > if .TRUE. (default) will display a "Work in Progress"
progress bar (running in another thread) which is constantly
moving until the dialog is destroyed. This argument is ignored
in TEXT mode.
< oParent > is the parent object. If this parameter is NIL or is
passed then the parent will be the AppDeskTop().
< oOwner > is the owner. If this parameter is NIL or is not passed
then the owner will be < oParent >.
< lModal > if .FALSE. will make the window modeless. The default is
.TRUE.
Returns:
An array of information which is used by DC_IMPL() to restore
the screen (in TEXT mode) or to destroy the dialog (in GUI mode).
.
Description:
DC_WAITON() is a Dual-mode dialog function that displays a
"Waiting" message to the user. In GUI mode, it will optionally
display a "Work-in-Progress" progress bar to notify the user
that the program is running and is busy.
The function will operate in TEXT mode by invoking DC_GUI(.F.)
to set the system mode or in GUI mode by invoking DC_GUI(.T.).
Examples:
FUNCTION Xtest()
LOCAL cDialog
USE ..\XDOC\EXPRESS VIA FOXCDX ALIAS XDOC EXCLUSIVE
cDialog := DC_WaitOn('Please wait while copying file')
COPY TO JUNK
Ferase('JUNK.*')
DC_Impl(cDialog)
RETURN nil
Source/Library:
_DCEXPL.PRG/.OBJ, DCLIPX.DLL
dc_webserverdomainname()
Set the Web Server domain name for web applications
Syntax:
DC_WebServerDomainName( [< cDomain >] ) - > cOldDomain
Arguments:
< cDomain > is the domain name of the server (as used in URLs).
Returns:
A character string.
Description:
DC_WebServerDomainName() is used to set the domain name
of the server that is serving up the application code.
Examples:
DC_WebServerDomainName('Donnay-Software.Com')
Source/Library:
_DCHTML.PRG
See Also:
dc_readhtml()
dc_wildcardmatch()
Test if a string matches a wildcard
Syntax:
DC_WildCardMatch( < cString >, ;
< cWildCard > ) - > lStatus
Arguments:
< cString > is a string of characters.
< cWildCard > is a string of characters containing asterisks.
Description:
DC_WildCardMatch() is used to test if a string matches a
wildcard string that contains asterisk (*) characters.
Examples:
? DC_WildCardMatch( 'testing', 'Test*' )
.F.
? DC_WildCardMatch( 'testing', 'test*' )
.T.
? DC_WildCardMatch( 'App.Text.1', 'App.*.*' )
.T.
Source/Library:
_DCHTML.PRG, DCLIPX.DLL
See Also:
dc_htmlvars()
dc_winalert()
Popup a GUI alert box
Syntax:
DC_WinAlert( < cMessage >, ;
[< cTitle >], ;
[< nButtons >], ;
[< nStyle >], ;
[< nDefButton >], ;
[< oOwner >] ) - > nResult
Arguments:
< cMessage > is a character string containing the text to display
in the confirmation box. Carriage return (Chr(13)) and line feed
(Chr(10)) act as new line characters. Carriage return causes the
text to be displayed on the next line and line feed on the line
after that. In other words, Chr(10) first inserts a blank line.
< cTitle > is a character string that is displayed in the title
bar of the confirmation box. The default value is AppName().
< nButtons > is a numeric constants for determining pushbuttons
under Windows
Constant Text for pushbuttons
XBPMB_OK Ok
XBPMB_OKCANCEL *) Ok and Cancel
XBPMB_ABORTRETRYIGNORE Cancel, Retry and Ignore
XBPMB_YESNO Yes and No
XBPMB_YESNOCANCEL Yes, No and Cancel
*) Default value
< nStyle > is used to specify an optional system icon that can be
selected for display to the left of the text in the confirmation
box. The following constants can be used:
Constants for defining icons
Constant Icon
XBPMB_NOICON *) No icon
XBPMB_QUESTION Question mark
XBPMB_WARNING Warning
XBPMB_INFORMATION Information
XBPMB_CRITICAL Critical situation
*) default value
In addition, the following constants for < nStyle > can be used
to control the modality of the confirmation box. If a constant
for an icon is used, the constants must be added to those in
the following table:
Additional constants for < nStyle >
Constant Description
XBPMB_APPMODAL Confirm box is modal in relation to the
Xbase++ application
XBPMB_SYSMODAL Confirm box is modal system wide
XBPMB_MOVEABLE Confirm box can be moved
< nDefButton > optionally specifies the pushbutton that is to have
input focus immediately after the confirmation box is displayed.
The following constants are valid:
Constants for the definition of focus
Constant Pushbutton
XBPMB_DEFBUTTON1 *) First pushbutton has input focus
XBPMB_DEFBUTTON2 Second pushbutton has input focus
XBPMB_DEFBUTTON3 Third pushbutton has input focus
*) Default value
< oOwner > specifies the owner of the confirmation box. By default
< oOwner > is the return value of SetAppWindow().
Returns:
Constants for the return value
Constant Description
XBPMB_RET_OK "Ok" pushbutton pressed
XBPMB_RET_CANCEL "Cancel" pushbutton pressed
XBPMB_RET_ABORT "Cancel" pushbutton pressed
XBPMB_RET_RETRY "Retry" pushbutton pressed
XBPMB_RET_IGNORE "Ignore" pushbutton pressed
XBPMB_RET_YES "Yes" pushbutton pressed
XBPMB_RET_NO "No" pushbutton pressed
XBPMB_RET_ENTER "Enter" pushbutton pressed
XBPMB_RET_ERROR Confirm box could not be displayed
Description:
DC_WinAlert() is a simple front-end to the Xbase++ ConfirmBox()
function that requires only a single parameter to popup a GUI
confirmation box with a default as an alert box.
Examples:
. DC_WinAlert('The disk is full')
Source/Library:
_DCMSG.PRG
See Also:
dc_msgbox()
dc_windowlist()
Pop up a list of open windows
Syntax:
DC_WindowList( < oParent >, ;
< oButton > ) - > nil
Arguments:
< oParent > is a pointer to the parent object that has a childlist
of windows.
< oButton > is a pointer to the pushbutton object that is used
to invoke the function.
Description:
DC_WindowList() will popup a list of open windows and allow the
user to bring that window to the front.
This function is handy when there are so many open windows that
some get hidden behind others. This only works for child
windows of the application.
Examples:
DCSTATUSBAR oStatBot TYPE XBPSTATIC_TYPE_RECESSEDBOX HEIGHT 20 ALIGN
DCGUI_ALIGN_BOTTOM
@ 0,0 DCSAY '' PARENT oStatBot SIZE 300,20 PIXEL ;
OBJECT oMessage COLOR GRA_CLR_BLUE FONT '10.Lucida Console' SAYLEFT
@ 0,0 DCSTATIC TYPE XBPSTATIC_TYPE_RAISEDBOX PARENT oStatBot SIZE 5,20 PIXEL
@ 0,0 DCPUSHBUTTON CAPTION 'Windows' SIZE 80,20 PIXEL ;
ACTION {|a,b,o|DC_WindowList(oDlg:drawingArea,o)} PARENT oStatBot
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
dc_winmenudestroymode()
A Get-Set function for setting AUTOWINMENU destroy mode
Syntax:
DC_WinMenuDestroyMode( [< nMode >] ) - > nOldMode
Arguments:
< nMode > is a numeric value defined in DCDIALOG.CH:
DCGUI_WINMENU_DESTROYMODE_EXIT (default) - destroy menu item
when exiting DC_ReadGui().
DCGUI_WINMENU_DESTROYMODE_CLOSE - destroy menu item when
xbeP_Close event is received.
Returns:
A numeric value
Description:
DC_WinMenuDestroyMode() is used to establish the method in which
the menu item under the "Windows" menubar item is removed when
the window is closed. MDI applications are typically written
either single-threaded or multi-threaded. When an MDI
application uses the AUTOWINMENU feature of DCGETOPTIONS a menu
item is added to the "Windows" menu when the dialog is created
and it is removed when the dialog is destroyed. If the dialog
is automatically destroyed when exiting DC_ReadGui(), i.e. windows
are in separate threads, then the destroying of the menu item is
also automatic. If the dialog is destroyed by the xbeP_Close
event, i.e. windows are all in the same thread, then the menu
item must also be destroyed by the same event.
Source/Library:
_DCCLASS.PRG, DCLIPX.DLL
dc_word2num()
Convert a 2-byte word to an integer number
Syntax:
DC_Word2Num ( < cByteString > ) - > nNumber
Arguments:
< cByteString > is a 2-byte character string.
Returns:
An integer number.
Description:
DC_WORD2NUM() is used to convert a 2-byte word to an integer.
Examples:
The following example shows how to use DC_NUM2WORD() and
DC_WORD2NUM() to save numeric values to a file and restore
them.
FUNCTION savenumbers ( aNumbers )
// aNumbers := { 10, 45, 134, 678, 3, 200 }
nHandle := fcreate( 'numbers.bin' )
for i := 1 to len(aNumbers)
fwrite( nHandle, DC_NUM2WORD( aNumbers[i] )
next
fclose( nHandle )
return
FUNCTION restnumbers
local nHandle := fopen( 'numbers.bin' )
local aNumbers := {}
aadd( aNumbers, DC_WORD2NUM( freadstr( nHandle, 2 ) ) )
fclose( nHandle )
return aNumbers
Source/Library:
_DCNUM.PRG, DCLIP2.DLL
See Also:
dc_num2word()
dc_workarea2csv()
Exports the data in the current work area to a CSV file
Syntax:
DC_WorkArea2CSV( < cFileName >, ;
[< aFields >], ;
[< cDateFormat >] ;
[< aFieldEvals >] ) - > lSuccess
Arguments:
< cFileName > is the name of the CSV file to create.
< aFields > is a single-dimension array of field names to export.
The default is all fields.
< cDateFormat > is the format of date fields to export. The default is
mm/dd/yyyy.
< aFieldEvals > is a 2-dimensional array of fieldnames and codeblcoks
to evaluate to return a value for a specified field. This is used
for custom formatting of data. Each code block must return a
character string.
Ex. {{FIELDNAME,CodeBlock},....}
Returns:
A logical value.
Description:
DC_WorkArea2Csv() will create a comma-delimted CSV file from the
contents of the current work area. All scopes and filters will be
respected.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_csv2workarea()
dc_workarea2excel()
Create an Excel Spreadsheet from data in a Work Area
Syntax:
DC_WorkArea2Excel( [< cExcelFile >], ;
[< nOrientation >], ;
[< lDisplayAlerts >], ;
[< lVisible >], ;
[< aFields >], ;
[< lAutoFit >], ;
[< cDateFormat >], ;
[< aFieldEvals >], ;
[< cPassword >], ;
[< lFreezeRow1 >, ;
[< lCsvFallBack >], ;
[< aColumnNames >] ) - > lStatus
Arguments:
< cExcelFile > is the name of the excel file (*.XLS) to be created.
If this parameter is not passed, the file will be created in the
same directory as the application .exe and will be named WORKSHEET.XLS.
< nOrientation > is the orientation of the spreadsheet. A value of
1 creates a "portrait" orientation. A value of 2 creates a
"landscape" orientation (default).
< lDisplayAlerts > will prompt the user if the file being created
will be overwritten. The default is .f.
< lVisible > will display the spreadsheet while the cells are being
filled. Default is .f.
< aFields > is a single-dimensional array of field names to include
in the spreadsheet. The columns will be created in the same
order as the fields in the array. If < aFields > is not passed
or is empty, then all fields in the database will be exported.
< lAutoFit > will optimize the columns of the spreadsheet to fit
the data to it's optimum width, otherwise the columns will be
the width of the database field. Default is .t.
< cDateFormat > is used to format date fields based on excel specs.
This can be:
'US' = 03/16/2011
'USSHORT' = 3/16/2011
'EURO' = 16/03/2011
'EUROSHORT' = 16/3/2011
an actual date mask ie.: 'dd-mmm-yyyy' = 16-Mar-2011
< aFieldEvals > is an array of code blocks that is used to
custom-format
the data.
Example:
aFieldEvals := { {'INDEX_NO',{|x|DispIndxNo(x)}}, ;
{'CUST_NO',{|x|LastFromCustNo(x)}} }
Replaces all data from 'INDEX_NO' fields with DispIndxNo(field- >Index_no)
Replaces all data from 'CUST_NO' fields with Customer last name
< cPassword > is a password to apply to the file to allow viewing by
Excel.
< lFreezeRow1 > if .TRUE. causes the first row of the Excel sheet to
be
bold font and locked from scrolling. The default is .FALSE.
< lCsvFallBack > if .TRUE. will cause the output to be a .CSV file in
the event that the Excel ActiveX control is not installed.
< aColumnNames > is a 1-dimensional array with the names of the
columns. The default is the field name.
Returns:
A logical .true. if the spreadsheet could be created, .false.
otherwise.
Description:
DC_WorkArea2Excel() is use to create an Excel spreadsheet (*.XLS)
file from the data in a workarea.
Examples:
USE CUSTOMER
aFields := { 'CUST_NMBR','CUST_NAME','BALANCE' }
DC_WorkArea2Excel('CUSTOMER.XLS',,,,aFields)
DC_SpawnUrl('CUSTOMER.XLS')
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL, DCLIPX.LIB
See Also:
dc_excel2workarea()
dc_array2excel()
dc_workarea2xml()
Export a workarea to an XML file
Syntax:
DC_WorkArea2Xml( [< cXmlFile >], ;
[< aStructure >] ) - > lStatus
Arguments:
< cXmlFile > is the name of the XML file to create.
If this argument is not passed, then the file will be named
Alias() + '.XML'.
< aStructure > is a structure array that conforms to the array
returned by the function dbStruct(). If this array is not passed,
then all fields will be exported. If the array is passed, then
only the fields in the array will be exported.
Returns:
A logical .TRUE. if the file could be created, .FALSE. otherwise.
Description:
DC_WorkArea2Xml() will export a the records in a workarea to
a file that conforms to XML format.
The XML file will contain both structure and data.
Only records that meet the current scope and/or filter will be
exported.
Examples:
See eXpress++ samples: .\SAMPLES\XML\WORKAREA.PRG.
Source/Library:
dcxml.dll, _dcxml.prg
See Also:
dc_xmlnode()
dc_working()
Display a "Working in Progress" bar
Syntax:
dc_working ( < nMode >, ;
< cTitle >,;
< nStRow >,;
< nStCol >,;
< nEnCol >,;
< lBox >,;
< cColors >,;
< nUpdate >,;
< lCenter >,;
< aPointer >,;
@< lCancel > ) - > nil
Arguments:
< nMode > is a number 0,1, or 2 depending on the function
desired:
0 - Initialize Static values and display bullet
1 - Paint new bullet if timer exceeded
2 - Terminate and restore screen
< cTitle > is the message to display in the box. If no
parameter is passed then "Working" will be displayed.
< nStRow > is the start display row. This parameter is used
only if < nMode > is 0.
< nStCol > is the start display column. This parameter is used
only if < nMode > is 0.
< nEnCol > is the end display column. This parameter is used
only if < nMode > is 0.
< lBox > if .TRUE. (default) will paint a box around the progress
bar starting at the passed coordinates, otherwise the progress
bar only will be painted starting at the passed coordinates.
< cColors > is a character string containing 2 color specfications
separated by a comma. The first color is the color of the box,
the second is the color of the progress bullets. If no parameter
is passed, then the current system color will be used for both
colors.
< nUpdate > is the amount of time (in seconds) to wait before
painting the next bullet. Default value is .3 seconds.
< lCenter > if .TRUE. will center the dialog will center the dialog
within the application window. This parameter is used only in GUI
mode.
< aPointer > is an optional array of 3 elements defining the mouse
pointer to use for the dialog and the application window. The
mouse pointer will be changed to the passed value until DC_Working()
is called again with an < nMode > value of 2. < aPointer > is
used
only in GUI mode.
ELEMENT DESCRIPTION
------- ------------------------------------------------
[1] DllName. If this element is a NIL, then the
pointer must be linked into the application .EXE.
[2] Pointer resource number. This is a resource number
in the .DLL or the .EXE.
[3] Pointer type. See the :setPointer() method of
XbpWindow() for more information.
@< lCancel > is used in GUI mode only. If this argument is passed
as a logical value, a "Cancel" button will be displayed on the
Working dialog box. If the operator clicks on the Cancel button
the value of < lCancel > will be set to .FALSE.
Returns:
Nil
Description:
DC_WORKING() is used to display "Working" progress bullets
for displaying the progress of any operation. This is a
dual-mode function. If DC_GUI(.t.) is called before calling
DC_WORKING(), then the working dialog will be GUI. If DC_GUI(.f.)
is called before calling DC_WORKING(), then the working dialog
will be text-based.
Examples:
-- Example 1 --
/*
This example displays a working dialog in text mode.
*/
PROCEDURE XTest1()
LOCAL lCancel := .f.
USE COLLECT NEW EXCLUSIVE
DC_Gui(.f.)
DC_WORKING( 0,'Deleting records ',,,,,,,,,@lCancel )
dbSetOrder(0)
go top
do while !Eof() .AND. !lCancel
DC_WORKING( 1 )
dbDelete()
SKIP
enddo
DC_Pause(5)
DC_WORKING( 2 )
RETURN
-- Example 2 --
#include "dccursor.ch"
/*
This example displays a working dialog in GUI mode. The mouse
pointer is changed to an hour-glass until the dialog is destroyed.
*/
PROCEDURE Xtest2()
USE COLLECT NEW EXCLUSIVE
DC_Gui(.T.)
DC_WORKING( 0,'Deleting records ',,,,,,,,{nil,POINTER_BUSY_1,1})
dbSetOrder(0)
go top
do while !Eof()
DC_WORKING( 1 )
dbDelete()
SKIP
enddo
DC_Pause(5)
DC_WORKING( 2 )
RETURN
Source/Library:
_DCODD2.PRG/.OBJ,DCLIPX.LIB
See Also:
dc_progress()
dc_odometer()
dc_odblock()
DC_WtfEnable()
Get-Set to enable or disable WTF output
Syntax:
DC_WtfEnable( < abEnable > ) - > abOldEnable
Arguments:
< abEnable > may be a 2 element array of character strings or a code
block.
If abEnable is an array the 2 elements are as follows:
[1] The name of the system environment variable.
[2] The value of the environment variable.
If abEnable is a code block then the code block must return a
logical value.
Returns:
An array, a code block or a NIL.
Description:
DC_WtfEnable() is a Get-Set that is used to enable or disable
WTF commands in source code. Too often, WTF commands are
inadvertently left in source code and debugging info appears on
the screen after deploying an application.
Example 1: DC_WtfEnable({'DONNAY_TEST','Y'}) will cause WTF output to be
displayed only if there is a system environment variable named
DONNAY_TEST with a value of Y. The default is to always display WTF
output.
Example 2: DC_WtfEnable( {||UserId()=='RDONNAY'} ) will only
allow WTF output if user RDONNAY is logged on.
Source/Library:
_DCQOUT.PRG, DCLIPX.DLL
See Also:
WTF
dc_xbpgetlbclick()
Post code block to evaluate when mouse in clicked in any DCGET
Syntax:
DC_XbpGetLbClick( < bClick > ) - > bPrevClick
Arguments:
< bClick > is a code block to evaluate.
The code block is passed the standard values of mp1, mp2 and oXbp.
Returns:
The previous code block.
Description:
DC_XbpGetLbClick() is used to post a code block to evaluate when
the left mouse button is clicked in any DCGET in the application.
Examples:
/* This code block can be used to position the
mouse cursor to the end of the get. */
DC_XbpGetLbClick( {|x,y,o|GoToEnd(o)} )
STATIC FUNCTION GoToEnd( oGet )
LOCAL nPos := oGet:get:pos
IF nPos > Len(Trim(oGet:buffer))
PostAppEvent(xbeP_Keyboard,xbeK_END,,oGet)
PostAppEvent(xbeP_Keyboard,xbeK_END,,oGet)
ENDIF
RETURN nil
Source/Library:
_DCXBPGT.PRG, DCLIPX.DLL
dc_xbpgetpres()
Set the default presentation parameters for the DC_XbpGet() class
Syntax:
DC_XbpGetPres( [< aPres >] ) - > aPres
Arguments:
< aPres > is an array of presentation parameters that conforms to
the specification for the XbpSle() class.
Returns:
An array containing the current default setting.
Description:
DC_XPPGETPRES() is used to set the default presentation parameters
for the DC_XbpGet() class. This includes @ DCSAY..GET and @ DCGET
commands.
Examples:
// Set the color of disabled objects.
aPres :={ { XBP_PP_DISABLED_FGCLR,GRA_CLR_WHITE},;
{ XBP_PP_DISABLED_BGCLR,GRA_CLR_PALEGRAY}}
DC_XbpGetPres(aPres)
Source/Library:
_DCXBPGT.PRG, DCLIPX.DLL
See Also:
@ DCGET
dc_xbpmenuconfig()
A Get-Set function for configuring OwnerDraw menus
Syntax:
DC_XbpMenuConfig( [< aConfig > ] ) - > aOldConfig
Arguments:
< aConfig > is an array of 12 elements:
Element Type Description
------- ---- ---------------------------------------------
[1] A/N Default Background color of pulldown sub menus
[2] A/N Default Foreground color of Vertical Bartext
area of sub menus.
[3] A/N Default Background color of Vertical Bartext area
[4] A/N Default Color of menu outline.
[5] C Default compound font name of the Vertical Bartext
are of sub menus.
[6] L/Nil A logical .TRUE. to enable the OwnerDraw feature
A logical .FALSE. to disable the OwnerDraw feature
[7] C Default compound font name of the check character
to use when a sub menu item is checked.
[8] C Default single character to use for the check when
a sub menu item is checked.
[9] A/N Default MenuBar Foreground Color.
[10] A/N Default MenuBar Background Color.
[11] A/N Default Foreground color of pulldown sub menus
[12] C Default compound font name of the Menubar.
Description:
DC_XbpMenuConfig() is used to configure the OwnerDraw options for
menus when using the OWNERDRAW clause of DCMENUBAR or DCSUBMENU.
Source/Library:
_dcclass.prg, dclipx.lib, dclipx.dll
See Also:
DCMENUBAR
DCSUBMENU
dc_xbpmenushift()
Get-Set to post a codeblock to call when shift key held down on a menu
Syntax:
DC_XbpMenuShift( [< bEval >,NIL] - > bOldEval
Arguments:
< bEval > is a code block to evaluate when a menu selection is made
with the SHIFT key.
Returns:
A code block or a NIL.
Description:
DC_XbpMenuShift() is a Get-Set function: DC_XbpMenuShift(). This is used to
post a codeblock to call when the shift key is held down while clicking a
menu item. This is a handy feature to make it easy to give users the
ability to create their own shortcuts from any existing menu system.
Examples:
See the example program in \exp19\samples\menu\menushortcuts.prg
Source/Library:
_DCCLASS.PRG
See Also:
DCMENUITEM
DCSUBMENU
dc_xbppushbuttonxpdefault()
Get or Set the default style for DC_XbpPushButtonXP() push buttons
Syntax:
DC_XbpPushButtonXPDefault( [< oConfig >] ) - > oOldConfig
Arguments:
< oConfig > is an object of the DC_XbpPushButtonXPConfig() class.
Description:
DC_XbpPushButtonXPDefault() is a Get-Set function that is used
to Set or Get the default configuration object for XP style
pushbuttons.
Examples:
oConfig := DC_XbpPushButtonXPConfig():new()
oConfig:radius := 20
oConfig:bgColor := GRA_CLR_CYAN
DC_XbpPushButtonXPDefault( oConfig )
Source/Library:
_dcxbutt.prg, dclipx.dll
See Also:
@ DCPUSHBUTTONXP
dc_xbppushbuttonxpconfig()
dc_xbptohtmlcolor()
Convert XBP colors to HTML colors
Syntax:
DC_XbpToHtmlColor( < naColor > ) - > cHtmlColor
Arguments:
< naColor > may be either a numeric color value as defined in
GRA.CH or an array of 3 numeric elements containing RGB
colors.
Returns:
A character string.
Description:
DC_XbpToHtmlColor() is used to convert Xbase++ GRA_CLR*
colors or RGB colors to #xxxxxx color strings that are
used in web applications.
Examples:
? DC_XbpToHtmlColor( GRA_CLR_GREEN )
#00FF00
? DC_XbpToHtmlColor( { 255, 255, 255 } )
#FFFFFF
Source/Library:
_DCHTML.PRG
See Also:
dc_readhtml()
dc_xcarray()
Return an Array Template for X2CLIP interface
Syntax:
DC_XCArray() - > aParams
Arguments:
< nHandle > is the handle previously returned by DC_XCOpen() when
opening the X2CLIP session.
< aParams > is an array of parameters that is passed to the X2CLIP
program. A template for this array is returned by DC_XCArray().
Individual elements are set to required values depending on the
operation required by the X2CLIP.EXE program. Defines for this
array are contained in DCXTOC.CH.
< bEval > is an optional code block to evaluate in a loop. The
loop runs continuously until a message is received from the
X2CLIP.EXE program that the requested task is complete. The
code block should be constructed as follows:
{| nCurr, nMax | ... }
< nCurr > is the current value returned by the X2CLIP.EXE
program. Usually this is a record pointer such as RecNo().
< nMax > is the maximum value returned by the X2CLIP.EXE
program. Usually this is the total number of records such
as RecCount(). These values are constantly updated by a
call to DC_XCUpdate() which is part of the Clipper program.
< nSleep > is the amount of time to Sleep in the loop between
calls to evaluate < bEval >. The default is 5, where the number
represents 1/100 of a second.
@< aReturn > is the name of a variable which will receive an array
of data returned by the X2CLIP.EXE program. This array is
returned by a call to DC_XCReturn() which is part of the Clipper
program.
Returns:
An array.
Description:
DC_XCARRAY() returns an array which is later passed to DC_XCCALL().
The array contains information which is passed to the X2CLIP.EXE
program needed to perform requested database operations. This
information includes file names, index keys, conditions, etc.
The definitions of the array elements are contained in DCXTOC.CH.
Element Purpose
-------------------- --------------------------------------------
XC_ARRAY_OPERATION Operation Type :
XC_OPENDATA - Open Database
XC_OPENINDEX - Open Index file
XC_CREATEINDEX - Create Index
XC_CLOSEDATA - Close Database
XC_COPYDATA - Copy a Database
XC_PROGRAM - Run Custom Program
XC_ARRAY_DEFAULT Value for SET DEFAULT (database directory)
XC_ARRAY_DATABASE Name of Database
XC_ARRAY_INDEX Name of Index File
XC_ARRAY_RDD Name of RDD to use
XC_ARRAY_SHARED Logical .TRUE. if file is opened Shared
XC_ARRAY_TAG Name of Index Tag to select or create
XC_ARRAY_KEY Name of Index Key (for creating indexes)
XC_ARRAY_RECORD Starting Record
XC_ARRAY_WHILE WHILE Clause
XC_ARRAY_FOR FOR Clause
XC_ARRAY_EVERY EVERY Value
XC_ARRAY_DATE Reserved
XC_ARRAY_TIME Reserved
XC_ARRAY_ERRORCODE Reserved
XC_ARRAY_UNIQUE Logical .TRUE. if index is Unique
XC_ARRAY_DESCEND Logical .TRUE. if index is Descending
XC_ARRAY_CURRCOUNT Reserved
XC_ARRAY_MESSAGE Reserved
XC_ARRAY_DATA An array of data to transfer (CARGO).
This array is passed as a parameter to the
program defined in XC_ARRAY_PROGRAM.
XC_ARRAY_PROGRAM Program to Run
XC_ARRAY_VERBOSE Logical .TRUE. if X2CLIP.EXE displays
status messages.
XC_ARRAY_INTERPRET Reserved
XC_ARRAY_ACTIVE Reserved
XC_ARRAY_DONE Reserved
XC_ARRAY_MAXCOUNT Reserved
XC_ARRAY_USER1 User Field 1 (up to 254 characters)
XC_ARRAY_USER2 User Field 2 (up to 254 characters)
XC_ARRAY_USER3 User Field 3 (up to 254 characters)
XC_ARRAY_USER4 User Field 4 (up to 254 characters)
XC_ARRAY_NEXT Numeric value (NEXT clause)
XC_ARRAY_REST Logical Value (REST clause)
Examples:
#include "dcxtoc.ch"
PROCEDURE XTest()
/*
This example demonstrates a re-indexing
progress bar which using the X2CLIP interface.
This interface spawns a Clipper
program to create the index.
*/
LOCAL aParams, nHandle, lStatus := .t., aIndex, oDlg, ;
oSay, oProgress, bEval, lOk := .t., GetList := {}, ;
i, nSeconds
nHandle := DC_XCOpen()
IF nHandle <= 0
RETURN .f.
ENDIF
@ 1,1 DCSAY 'Creating Indexes'
@ 2,1 DCSAY '' SAYOBJECT oSay SAYSIZE 40
@ 4,1 DCPROGRESS oProgress SIZE 40,1.2 ;
COLOR GRA_CLR_RED PERCENT ;
EVERY IIF( nMode=1,100,1 )
DCREAD GUI EXIT FIT PARENT @oDlg ;
TITLE "Indexing Example"
BEGIN SEQUENCE
aParams := DC_XCARRAY()
aParams[XC_ARRAY_DEFAULT] := 'C:\express\sample'
aParams[XC_ARRAY_DATABASE] := 'XTEST.DBF'
aParams[XC_ARRAY_RDD] := 'DBFCDX'
aParams[XC_ARRAY_OPERATION] := XC_OPENDATA
IF !DC_XCCALL( nHandle, aParams )
lOk := .f.
BREAK
ENDIF
aIndex := { ;
{ 'AREACODE','AREACODE',nil,.f.,.f.}, ;
{ 'EXCHANGE','EXCHANGE',nil,.f.,.f.}, ;
{ 'CITY', 'CITY',nil,.f.,.f.} ;
}
bEval := {|nCurr,nMax|DC_GetProgress(oProgress,nCurr,nMax)}
nSeconds := Seconds()
FOR i := 1 TO Len(aIndex)
oSay:setCaption('Creating Tag ' + aIndex[i,2])
aParams := DC_XCARRAY()
aParams[XC_ARRAY_DEFAULT] := 'C:\express\sample'
aParams[XC_ARRAY_INDEX] := 'XTEST.CDX'
aParams[XC_ARRAY_OPERATION] := XC_CREATEINDEX
aParams[XC_ARRAY_TAG] := aIndex[i,1]
aParams[XC_ARRAY_KEY] := aIndex[i,2]
aParams[XC_ARRAY_FOR] := aIndex[i,3]
aParams[XC_ARRAY_UNIQUE] := aIndex[i,4]
aParams[XC_ARRAY_DESCEND] := aIndex[i,5]
IF !DC_XCCALL( nHandle, aParams, bEval, 5 )
lOk := .f.
BREAK
ENDIF
NEXT
END SEQUENCE
oDlg:Destroy()
DC_XCClose( nHandle )
RETURN lOk
Source/Library:
_DCXTOC.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_xccall()
dc_xccall()
Send a message to X2CLIP to perform an operation
Syntax:
DC_XCCall( < nHandle >, ;
< aParams >, ;
[< bEval >], ;
[< nSleep >], ;
[@< aReturn >], ;
[< lErrorMsg >] ) - > lStatus
Arguments:
< nHandle > is the handle previously returned by DC_XCOpen() when
opening the X2CLIP session.
< aParams > is an array of parameters that is passed to the X2CLIP
program. A template for this array is returned by DC_XCArray().
Individual elements are set to required values depending on the
operation required by the X2CLIP.EXE program. Defines for this
array are contained in DCXTOC.CH.
< bEval > is an optional code block to evaluate in a loop. The
loop runs continuously until a message is received from the
X2CLIP.EXE program that the requested task is complete. The
code block should be constructed as follows:
{| nCurr, nMax, nEvery, aData | ... }
< nCurr > is the current value returned by the X2CLIP.EXE
program. Usually this is a record pointer such as RecNo().
< nMax > is the maximum value returned by the X2CLIP.EXE
program. Usually this is the total number of records such
as RecCount(). < nEvery > is how often the status bars or
messages should be updated. < aData > is an array of data.
These values are constantly updated by a call to DC_XCUpdate()
which is part of the Clipper program.
< nSleep > is the amount of time to Sleep in the loop between
calls to evaluate < bEval >. The default is 5, where the number
represents 1/100 of a second.
@< aReturn > is the name of a variable which will receive an array
of data returned by the X2CLIP.EXE program. This array is
returned by a call to DC_XCReturn() which is part of the Clipper
program. If an error occurred in the X2CLIP.EXE program, then
< aReturn > will contain an array of 4 elements:
Element Type Description
-------- ---- ---------------------------------------------
[1] N DOS Error Number
[2] C File Name
[3] C Error Description
[4] C More info (if available)
< lErrorMsg > if .TRUE. will display the error information in
< aReturn >. The default is .FALSE.
Returns:
A logical .TRUE. if the call was successful, .FALSE. otherwise.
Description:
DC_XCCALL() is used to send data to the X2CLIP.EXE program which
is running in the background with information about database or
custom operations to perform.
DC_XCCALL() stays in a loop until the XCLIP2.EXE program sends
a message that it is done with the requested task. While in
the loop, an optional code block is continuously evaluated to
update status in the Xbase++ program such as progress bars.
Examples:
#include "dcxtoc.ch"
PROCEDURE XTest()
/*
This example demonstrates a re-indexing
progress bar which uses the X2CLIP interface.
This interface spawns a Clipper
program to create the index.
*/
LOCAL aParams, nHandle, lStatus := .t., aIndex, oDlg, ;
oSay, oProgress, bEval, lOk := .t., GetList := {}, ;
i, nSeconds
nHandle := DC_XCOpen()
IF nHandle <= 0
RETURN .f.
ENDIF
@ 1,1 DCSAY 'Creating Indexes'
@ 2,1 DCSAY '' SAYOBJECT oSay SAYSIZE 40
@ 4,1 DCPROGRESS oProgress SIZE 40,1.2 ;
COLOR GRA_CLR_RED PERCENT ;
EVERY IIF( nMode=1,100,1 )
DCREAD GUI EXIT FIT PARENT @oDlg ;
TITLE "Indexing Example"
BEGIN SEQUENCE
aParams := DC_XCArray()
aParams[XC_ARRAY_DEFAULT] := 'C:\express\sample'
aParams[XC_ARRAY_DATABASE] := 'XTEST.DBF'
aParams[XC_ARRAY_RDD] := 'DBFCDX'
aParams[XC_ARRAY_OPERATION] := XC_OPENDATA
IF !DC_XCCALL( nHandle, aParams )
lOk := .f.
BREAK
ENDIF
aIndex := { ;
{ 'AREACODE','AREACODE',nil,.f.,.f.}, ;
{ 'EXCHANGE','EXCHANGE',nil,.f.,.f.}, ;
{ 'CITY', 'CITY',nil,.f.,.f.} ;
}
bEval := {|nCurr,nMax|DC_GetProgress(oProgress,nCurr,nMax)}
nSeconds := Seconds()
FOR i := 1 TO Len(aIndex)
oSay:setCaption('Creating Tag ' + aIndex[i,2])
aParams := DC_XCArray()
aParams[XC_ARRAY_DEFAULT] := 'C:\express\sample'
aParams[XC_ARRAY_INDEX] := 'XTEST.CDX'
aParams[XC_ARRAY_OPERATION] := XC_CREATEINDEX
aParams[XC_ARRAY_TAG] := aIndex[i,1]
aParams[XC_ARRAY_KEY] := aIndex[i,2]
aParams[XC_ARRAY_FOR] := aIndex[i,3]
aParams[XC_ARRAY_UNIQUE] := aIndex[i,4]
aParams[XC_ARRAY_DESCEND] := aIndex[i,5]
IF !DC_XCCALL( nHandle, aParams, bEval, 5 )
lOk := .f.
BREAK
ENDIF
NEXT
END SEQUENCE
oDlg:Destroy()
DC_XCClose( nHandle )
RETURN lOk
Source/Library:
_DCXTOC.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_xcopen()
dc_xcarray()
dc_xcclose()
Close an X2CLIP session
Syntax:
DC_XCClose ( < nHandle > ) - > lStatus
Arguments:
< nHandle > is the handle returned by DC_XCOpen().
Returns:
A numeric file handle to be used by the other DC_TXT*()
functions.
Description:
DC_XCCLOSE() is used to close an X2CLIP session previously opened
by DC_XCOPEN(). This will send a message to the X2CLIP.EXE
program to close all files and terminate.
Examples:
#include "dcxtoc.ch"
PROCEDURE XTest()
/*
This example demonstrates a re-indexing
progress bar which using the X2CLIP interface.
This interface spawns a Clipper
program to create the index.
*/
LOCAL aParams, nHandle, lStatus := .t., aIndex, oDlg, ;
oSay, oProgress, bEval, lOk := .t., GetList := {}, ;
i, nSeconds
nHandle := DC_XCOpen()
IF nHandle <= 0
RETURN .f.
ENDIF
@ 1,1 DCSAY 'Creating Indexes'
@ 2,1 DCSAY '' SAYOBJECT oSay SAYSIZE 40
@ 4,1 DCPROGRESS oProgress SIZE 40,1.2 ;
COLOR GRA_CLR_RED PERCENT ;
EVERY IIF( nMode=1,100,1 )
DCREAD GUI EXIT FIT PARENT @oDlg ;
TITLE "Indexing Example"
BEGIN SEQUENCE
aParams := DC_XCArray()
aParams[XC_ARRAY_DEFAULT] := 'C:\express\sample'
aParams[XC_ARRAY_DATABASE] := 'XTEST.DBF'
aParams[XC_ARRAY_RDD] := 'DBFCDX'
aParams[XC_ARRAY_OPERATION] := XC_OPENDATA
IF !DC_XCCall( nHandle, aParams )
lOk := .f.
BREAK
ENDIF
aIndex := { ;
{ 'AREACODE','AREACODE',nil,.f.,.f.}, ;
{ 'EXCHANGE','EXCHANGE',nil,.f.,.f.}, ;
{ 'CITY', 'CITY',nil,.f.,.f.} ;
}
bEval := {|nCurr,nMax|DC_GetProgress(oProgress,nCurr,nMax)}
nSeconds := Seconds()
FOR i := 1 TO Len(aIndex)
oSay:setCaption('Creating Tag ' + aIndex[i,2])
aParams := DC_XCArray()
aParams[XC_ARRAY_DEFAULT] := 'C:\express\sample'
aParams[XC_ARRAY_INDEX] := 'XTEST.CDX'
aParams[XC_ARRAY_OPERATION] := XC_CREATEINDEX
aParams[XC_ARRAY_TAG] := aIndex[i,1]
aParams[XC_ARRAY_KEY] := aIndex[i,2]
aParams[XC_ARRAY_FOR] := aIndex[i,3]
aParams[XC_ARRAY_UNIQUE] := aIndex[i,4]
aParams[XC_ARRAY_DESCEND] := aIndex[i,5]
IF !DC_XCCall( nHandle, aParams, bEval, 5 )
lOk := .f.
BREAK
ENDIF
NEXT
END SEQUENCE
oDlg:Destroy()
DC_XCCLOSE( nHandle )
RETURN lOk
Source/Library:
_DCXTOC.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_xcopen()
dc_xcopen()
Open an X2CLIP session for database operations
Syntax:
DC_XCOpen ( [< nTimeOut >], ;
[< lErrorMsg >], ;
[< cExeName >] ) - > nHandle
Arguments:
< nTimeOut > is the timeout (in seconds) to establish a
communcation with the X2CLIP.EXE program. The default is 5
seconds. If no communication is established within the timeout
period, DC_XCOPEN() will return a valid handle otherwise it will
return 0.
< lErrorMsg > if .TRUE. will display a message in the event that
communication could not be established. The default is .FALSE.
< cExeName > is the name of the Clipper EXEcutable program. The
default is X2CLIP.EXE.
Returns:
A numeric file handle to be used by the other DC_XC*() functions.
If communication could not be established with X2CLIP.EXE the
value 0 will be returned.
Description:
DC_XCOPEN() is used to open an X2CLIP session for database
operations. The X2CLIP interface is an API that uses a Clipper
program which is run in the background and synchronized with the
Xbase++ program to perform database operations faster than the
Xbase++ DBE system.
DC_XCOpen() opens X2CLIP.DBF in shared mode and searches for
an inactive record. This record becomes the "handle" of the
information workspace which is used to pass information between
the Xbase++ program and the Clipper program. The handle is
passed to X2CLIP.EXE which is launched in the background. The
X2CLIP.EXE program then runs a main loop which waits for
instructions based on calls to DC_XCCall(). Instructions can
include anything from opening databases and indexes or creating
indexes to running any custom program linked into X2CLIP.EXE.
The X2CLIP.EXE runs until it receives an instruction to terminate
by calling DC_XCClose().
X2CLIP.EXE sends information back to the Xbase++ program about
its current status such as pointers needed for updating progress
bars.
Notes:
If X2CLIP.DBF does not exist it will be created in the
DEFAULT directory of the Xbase++ program. The default directory
is passed to the X2CLIP.EXE program to insure that the same
X2CLIP.DBF is used by the Clipper program.
Examples:
#include "dcxtoc.ch"
PROCEDURE XTest()
/*
This example demonstrates a re-indexing
progress bar which using the X2CLIP interface.
This interface spawns a Clipper
program to create the index.
*/
LOCAL aParams, nHandle, lStatus := .t., aIndex, oDlg, ;
oSay, oProgress, bEval, lOk := .t., GetList := {}, ;
i, nSeconds
nHandle := DC_XCOPEN()
IF nHandle <= 0
RETURN .f.
ENDIF
@ 1,1 DCSAY 'Creating Indexes'
@ 2,1 DCSAY '' SAYOBJECT oSay SAYSIZE 40
@ 4,1 DCPROGRESS oProgress SIZE 40,1.2 ;
COLOR GRA_CLR_RED PERCENT ;
EVERY IIF( nMode=1,100,1 )
DCREAD GUI EXIT FIT PARENT @oDlg ;
TITLE "Indexing Example"
BEGIN SEQUENCE
aParams := DC_XCArray()
aParams[XC_ARRAY_DEFAULT] := 'C:\express\sample'
aParams[XC_ARRAY_DATABASE] := 'XTEST.DBF'
aParams[XC_ARRAY_RDD] := 'DBFCDX'
aParams[XC_ARRAY_OPERATION] := XC_OPENDATA
IF !DC_XCCall( nHandle, aParams )
lOk := .f.
BREAK
ENDIF
aIndex := { ;
{ 'AREACODE','AREACODE',nil,.f.,.f.}, ;
{ 'EXCHANGE','EXCHANGE',nil,.f.,.f.}, ;
{ 'CITY', 'CITY',nil,.f.,.f.} ;
}
bEval := {|nCurr,nMax|DC_GetProgress(oProgress,nCurr,nMax)}
nSeconds := Seconds()
FOR i := 1 TO Len(aIndex)
oSay:setCaption('Creating Tag ' + aIndex[i,2])
aParams := DC_XCArray()
aParams[XC_ARRAY_DEFAULT] := 'C:\express\sample'
aParams[XC_ARRAY_INDEX] := 'XTEST.CDX'
aParams[XC_ARRAY_OPERATION] := XC_CREATEINDEX
aParams[XC_ARRAY_TAG] := aIndex[i,1]
aParams[XC_ARRAY_KEY] := aIndex[i,2]
aParams[XC_ARRAY_FOR] := aIndex[i,3]
aParams[XC_ARRAY_UNIQUE] := aIndex[i,4]
aParams[XC_ARRAY_DESCEND] := aIndex[i,5]
IF !DC_XCCall( nHandle, aParams, bEval, 5 )
lOk := .f.
BREAK
ENDIF
NEXT
END SEQUENCE
oDlg:Destroy()
DC_XCClose( nHandle )
RETURN lOk
Source/Library:
_DCXTOC.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_xcclose()
dc_xcreturn()
Return data from the X2CLIP program
Syntax:
DC_XCReturn( < aArray > ) - > nil
Arguments:
< aArray > is an array of information to return. This array may
contain any values except objects and code blocks.
Returns:
Nil.
Description:
DC_XCRETURN() is used in the X2CLIP.EXE program to return an
array of information to the Xbase++ program via the DC_XCCall()
function.
Notes:
DC_XCRETURN() is only used if the operation requested by a
DC_XCCall() is an XC_PROGRAM.
Examples:
#include "dcxtoc.ch"
/*
This example demonstrates how to use the Xbase to
Clipper interface to improve performance of
database operations. The procedure XTEST() is
contained in the Xbase++ application. The
procedure XCLIP60() is contained in the X2CLIP.EXE
program.
*/
PROCEDURE XTest()
LOCAL oProgress, GetList := {}, ;
i, nSeconds, dDate := Date(), cAreaCode := '777', ;
lReplacing := .f., oButton
@ 2,1 DCSAY 'This routine will replace the date field with'
@ 3,1 DCSAY 'the entered value for the selected area code.'
@ 5,1 DCSAY ' New Date' GET dDate POPUP {|d|DC_PopDate(d)}
@ 6,1 DCSAY 'Area Code' GET cAreaCode PICT '999' WHEN {||.f.}
@ 8,1 DCPROGRESS oProgress SIZE 40,1.2 ;
COLOR GRA_CLR_RED PERCENT ;
EVERY IIF( lX2Clip,1,100 )
@ 8,45 DCPUSHBUTTON CAPTION 'Replace' OBJECT oButton ;
SIZE 9,1.2 ;
ACTION {||_XSample60( oProgress, oButton, ;
@lReplacing, dDate, cAreaCode, ;
GetList ) } ;
WHEN {||!lReplacing}
DCREAD GUI FIT ADDBUTTONS ;
TITLE "Database Operation Example"
RETURN nil
/* ----------------------- */
STATIC FUNCTION _XTest( oProgress, oButton, ;
lReplacing, dDate, cAreaCode, ;
GetList )
LOCAL nSeconds, nHandle, aData, bEval, aParams, aReturn, ;
nRecords := 0
BEGIN SEQUENCE
lReplacing := .t.
DC_GetRefresh(GetList)
CLOSE ALL
nSeconds := Seconds()
nHandle := DC_XCOpen()
IF nHandle <= 0
BREAK
ENDIF
aData := { '\express\sample', 'XTEST.DBF', 'XTEST.CDX', ;
'DBFCDX', dDate, cAreaCode }
bEval := {|nCurr,nMax|DC_GetProgress(oProgress,nCurr,nMax)}
aParams := DC_XCArray()
aParams[XC_ARRAY_OPERATION] := XC_PROGRAM
aParams[XC_ARRAY_PROGRAM] := 'XClip60'
aParams[XC_ARRAY_DATA] := aData
IF !DC_XCCall( nHandle, aParams, bEval, 5, @aReturn )
BREAK
ENDIF
DC_XCClose(nHandle)
nRecords := aReturn[1]
DC_GetProgress(oProgress,100,100)
DC_MsgBox({ Alltrim(Str(nRecords)) + ' records updated.', ;
'Update time: ' + ;
Alltrim(Str(Seconds()-nSeconds)) + ' seconds!' })
END SEQUENCE
lReplacing := .f.
RETURN nil
/* ------------------- */
* Part of X2CLIP.EXE
FUNCTION XClip60( aData )
LOCAL cDefault, cDatabase, cIndex, cRdd, dDate, cAreaCode, ;
nRecords := 0
cDefault := aData[1]
cDatabase := aData[2]
cIndex := aData[3]
cRdd := aData[4]
dDate := aData[5]
cAreaCode := aData[6]
SET DEFAULT TO (cDefault)
USE (cDatabase) SHARED VIA cRdd ALIAS XTEST
GO TOP
DO WHILE !Eof()
IF XTEST->areacode == cAreaCode
IF _RecLock(5)
REPL XTEST->date WITH DTOC(dDate)
nRecords++
COMMIT
UNLOCK
ENDIF
ENDIF
DC_XCUpdate( RecNo(), RecCount(), 100 )
SKIP
ENDDO
CLOSE
DC_XCRETURN( { nRecords } )
RETURN nil
Source/Library:
X2CLIP.PRG/.OBJ, X2CLIP.EXE
See Also:
dc_xcopen()
dc_xccall()
dc_xcupdate()
Update pointers in the X2CLIP program
Syntax:
DC_XCUpdate( [< nCurr >], ;
[< nMax >], ;
[< nEvery >], ;
[< aData >] ) - > nil
Arguments:
< nCurr > is the current pointer. The default is RecNo().
< nMax > is the maximum count. The default is RecCount().
< nEvery > is how often the count should be updated. The default
is 1. This number should be a rather high number to improve
performance because the current information can only be passed
back to the Xbase++ program by locking and updating the record
in X2CLIP.DBF associated with this session. For example, to
insure that a progress bar in the Xbase++ application gets updated
every 1% < nEvery > would be set to Int(RecCount()/100).
< aData > is an array of any information. The array may be multi-
dimensional but may not contain Code-Blocks or Objects.
Returns:
A numeric file handle to be used by the other DC_TXT*()
functions.
Description:
DC_XCUPDATE() is used in the X2CLIP.EXE program to update database
pointers and return data which is passed back to the Xbase++
program for eveluation by DC_XCCALL().
This function is called regularly during the required database
operation in the X2CLIP.EXE program to insure that status
indicators in the Xbase++ program are constantly updated or to
pass back an array of information.
Notes:
DC_XCUPDATE() is only used if the operation requested by a
DC_XCCall() is an XC_PROGRAM, otherwise the update is handled
automatically.
Examples:
#include "dcxtoc.ch"
/*
This example demonstrates how to use the Xbase to
Clipper interface to improve performance of
database operations. The procedure XTEST() is
contained in the Xbase++ application. The
procedure XCLIP60() is contained in the X2CLIP.EXE
program.
*/
PROCEDURE XTest()
LOCAL oProgress, GetList := {}, ;
i, nSeconds, dDate := Date(), cAreaCode := '777', ;
lReplacing := .f., oButton
@ 2,1 DCSAY 'This routine will replace the date field with'
@ 3,1 DCSAY 'the entered value for the selected area code.'
@ 5,1 DCSAY ' New Date' GET dDate POPUP {|d|DC_PopDate(d)}
@ 6,1 DCSAY 'Area Code' GET cAreaCode PICT '999' WHEN {||.f.}
@ 8,1 DCPROGRESS oProgress SIZE 40,1.2 ;
COLOR GRA_CLR_RED PERCENT ;
EVERY IIF( lX2Clip,1,100 )
@ 8,45 DCPUSHBUTTON CAPTION 'Replace' OBJECT oButton ;
SIZE 9,1.2 ;
ACTION {||_XSample60( oProgress, oButton, ;
@lReplacing, dDate, cAreaCode, ;
GetList ) } ;
WHEN {||!lReplacing}
DCREAD GUI FIT ADDBUTTONS ;
TITLE "Database Operation Example"
RETURN nil
/* ----------------------- */
STATIC FUNCTION _XTest( oProgress, oButton, ;
lReplacing, dDate, cAreaCode, ;
GetList )
LOCAL nSeconds, nHandle, aData, bEval, aParams, aReturn, ;
nRecords := 0
BEGIN SEQUENCE
lReplacing := .t.
DC_GetRefresh(GetList)
CLOSE ALL
nSeconds := Seconds()
nHandle := DC_XCOpen()
IF nHandle <= 0
BREAK
ENDIF
aData := { '\express\sample', 'XTEST.DBF', 'XTEST.CDX', ;
'DBFCDX', dDate, cAreaCode }
bEval := {|nCurr,nMax|DC_GetProgress(oProgress,nCurr,nMax)}
aParams := DC_XCArray()
aParams[XC_ARRAY_OPERATION] := XC_PROGRAM
aParams[XC_ARRAY_PROGRAM] := 'XClip60'
aParams[XC_ARRAY_DATA] := aData
IF !DC_XCCall( nHandle, aParams, bEval, 5, @aReturn )
BREAK
ENDIF
DC_XCClose(nHandle)
nRecords := aReturn[1]
DC_GetProgress(oProgress,100,100)
DC_MsgBox({ Alltrim(Str(nRecords)) + ' records updated.', ;
'Update time: ' + ;
Alltrim(Str(Seconds()-nSeconds)) + ' seconds!' })
END SEQUENCE
lReplacing := .f.
RETURN nil
/* ------------------- */
* Part of X2CLIP.EXE
FUNCTION XClip60( aData )
LOCAL cDefault, cDatabase, cIndex, cRdd, dDate, cAreaCode, ;
nRecords := 0
cDefault := aData[1]
cDatabase := aData[2]
cIndex := aData[3]
cRdd := aData[4]
dDate := aData[5]
cAreaCode := aData[6]
SET DEFAULT TO (cDefault)
USE (cDatabase) SHARED VIA cRdd
GO TOP
DO WHILE !Eof()
IF XTEST->areacode == cAreaCode
IF _RecLock(5)
REPL XTEST->date WITH DTOC(dDate)
nRecords++
COMMIT
UNLOCK
ENDIF
ENDIF
DC_XCUPDATE( RecNo(), RecCount(), 100 )
SKIP
ENDDO
CLOSE
DC_XCReturn( { nRecords } )
RETURN nil
Source/Library:
X2CLIP.PRG/.OBJ, X2CLIP.EXE
See Also:
dc_xcopen()
dc_xccall()
dc_xml2objecttree()
Create an object tree from an XML file or stream
Syntax:
DC_Xml2ObjectTree( < cXml >, ;
[< lXb2Net >] ) - > oXmlTree
Arguments:
< cXml > contains either the fully qualified name of a file that
contains only XML data, or an XML data stream in the form of a
string.
< lXb2Net > is an optional parameter that uses the Xb2.Net XML parser
instead of the ASXML parser. This can occasionally prevent IDSC
errors. NOTE: The Xb2.Net function xbXML2Array() must be linked
into the program.
Returns:
An object.
Description:
DC_Xml2ObjectTree() is used to create an object tree that is a
hierarchy of DC_XmlNode() objects. An object tree can be used
to modify the XML, print XML data, export to an array, etc.
Notes:
This function calls XML*() functions from the Alaska Software
XML parser, therefore when DCXML.DLL is loaded, it must also load
Alaska's ASXML10.DLL.
Examples:
oTree := DC_Xml2ObjectTree( 'c:\test\test.xml' )
DC_ArrayView(oTree)
Source/Library:
_DCXML.PRG, DCXML.DLL
See Also:
dc_xmlnode()
dc_xorbits()
A logical EXCLUSIVE OR of two numbers
Syntax:
DC_XorBits( < nNum1 >, ;
< nNum2 > ) - >nResult
Arguments:
< nNum1 > and < nNum2 > are numeric values from 0 to 255.
Returns:
A numeric value from 0 - 255
Description:
DC_XORBITS() will produce the result of logically EXCLUSIVE OR
of two numbers.
Source/Library:
_DCAND.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_bittest()
dc_andbits()
dc_xorbitslong()
Exclusive OR on 2 long integer (32 bit values) values
Syntax:
DC_XorBitsLong( < nDecimal1 >, ;
< nDecimal2 > ) - > nDecimal
Arguments:
< nDecimal1 > and < nDecimal2 > are numeric values from 0 to
4294967295.
Returns:
A decimal number.
Description:
DC_XorBitsLong() performs an exclusive OR on 2 long integer
(32 bit values) values.
Source/Library:
_DCFUNCT.PRG/.OBJ, DCLIPX.LIB
See Also:
dc_dec2longint()
dc_xorstrings()
An Exclusive OR (XOR) of 2 input strings of equal length
Syntax:
DC_XorStrings( < cString1 >, ;
< cString2 > ) - > cResult
Arguments:
< cString1 > and < cString2 > are strings of equal length.
Returns:
A string.
Description:
DC_XORStrings() will return a string that is an Exclusive OR (XOR) of
2 input strings of equal length.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_xorbits()
dc_xpftoarray()
Load the contents of an .XPF memory file to an array
Syntax:
DC_XPFtoArray( < cMemFileName > ) - > aMemVars
Arguments:
< cMemFileName > is the name of the memory file. If no extension
is given then .XPF is assumed.
Returns:
A 2-dimensional array with the following structure:
Element Type Description
------- ----- ---------------------------------------
[1] C Memory Variable name
[2] C Memory Variable Type
[3] X Variable contents
Description:
DC_XPFtoArray() is used to read the contents of an .XPF (memory)
file and store it to a 2-dimensional array.
Examples:
. aMem := XPFtoArray('CUSTOMER.XPF')
. DC_ArrayView(aMem)
Source/Library:
_DCMEM.PRG, DCLIP2.DLL
See Also:
DISPLAY MEMORY
dc_xtoc()
Converts any variable type to a String
Syntax:
DC_XtoC( < xValue > ) - > cString
Arguments:
< xValue > is any variable type.
Returns:
A character string.
Description:
DC_XTOC() is used to convert any variable type to a character
string.
Examples:
PROCEDURE XTest( aArray )
FOR i := 1 TO Len(aArray)
? DC_XtoC(aArray[i])
NEXT
RETURN nil
Source/Library:
_DCVAL.PRG/.OBJ, DCLIPX.LIB
dc_zap()
Zap the database
Syntax:
DC_Zap() - > lStatus
Arguments:
None.
Returns:
A logical .TRUE. if the file was successfully Zapped, .FALSE.
otherwise.
Description:
DC_Zap() is a front end to the Xbase++ dbZap() function that
tests if a file is open exclusive and then prompts the user
to reopen it exclusive before Zapping the file. In either
case, the user is given the option of cancelling the operation.
Examples:
. USE COLLECT
. DC_Zap()
Source/Library:
_DCDBPK.PRG, DCLIP1.DLL
See Also:
ZAP
dc_zoomtransparent()
Zoom a Dialog Window from 0% to 100% Transparency
Syntax:
DC_ZoomTransparent( < oDlg >, ;
[< nMode >], ;
[< nSeconds >] ) - > Nil
Arguments:
< oDlg > is an object that is derived from the XbpDialog class and
is currently hidden with the :hide() method.
< nMode > if 0 will zoom from 0 to 100. If 1 will zoom from 100
to 0.
< nSeconds > is the amount of seconds required to complete the
zoom process.
Returns:
Nil.
Description:
DC_ZoomTransparent() will cause a dialog window to go from 0%
to 100% transparency or from 100% to 0% transparency at a
specified time period.
Examples:
Run XDEMO.EXE to see the main window fade in.
Source/Library:
_DCFUNCT.PRG, DCLIPX.DLL
See Also:
dc_setwindowtransparency()