Professional Documents
Culture Documents
Limitation of liability This document is provided “as-is”. Information and views expressed in this document, including
URL and other Internet Web site references, may change without notice. You bear the risk of using
it.
Some examples depicted herein are provided for illustration only and are fictitious. No real
association or connection is intended or should be inferred.
Intellectual property This document does not provide you with any legal rights to any intellectual property in any
Microsoft product.
You may copy and use this document for your internal, reference purposes.
Trademarks Microsoft, Dexterity, Excel, Microsoft Dynamics, Visual Basic, Windows, Windows NT, and
Windows Server are trademarks of the Microsoft group of companies. FairCom and c-tree Plus are
trademarks of FairCom Corporation and are registered in the United States and other countries.
Warranty disclaimer Microsoft Corporation disclaims any warranty regarding the sample code contained in this
documentation, including the warranties of merchantability and fitness for a particular purpose.
License agreement Use of this product is covered by a license agreement provided with the software product. If you
have any questions, please call the Microsoft Dynamics GP Customer Assistance Department at
800-456-0025 (in the U.S. or Canada) or +1-701-281-6500.
Command_GetAccelerator() ............................................................................................ 65
Command_GetBooleanProperty() ................................................................................... 67
Command_GetIDs ............................................................................................................. 68
Command_GetImageProperty() ...................................................................................... 69
Command_GetNamedProperty() .................................................................................... 71
Command_GetStringProperty()....................................................................................... 72
Command_GetTag() .......................................................................................................... 73
Command_GetType() ........................................................................................................ 74
Command_Reset().............................................................................................................. 75
Command_SetAccelerator() ............................................................................................. 76
Command_SetBooleanProperty() .................................................................................... 78
Command_SetImageProperty() ....................................................................................... 79
Command_SetNamedProperty() ..................................................................................... 81
Command_SetStringProperty() ....................................................................................... 82
Command bar function library .............................................................................................. 83
CommandBar_Create()...................................................................................................... 84
CommandBar_Destroy() ................................................................................................... 86
CommandBar_GetPosition() ............................................................................................ 87
Command list function library............................................................................................... 89
CommandList_Add() ........................................................................................................ 90
CommandList_CreateList() .............................................................................................. 92
CommandList_FindCommand() ..................................................................................... 94
CommandList_GetCommandByPosition() .................................................................... 95
CommandList_NumCommands()................................................................................... 96
CommandList_Remove() .................................................................................................. 97
CommandList_RemoveAll()............................................................................................. 98
CommandList_RemoveCommandByPosition() ............................................................ 99
Currency function library...................................................................................................... 101
Currency_GetDecimalSymbol() ..................................................................................... 102
Currency_GetLeadingSymbol() ..................................................................................... 103
Currency_GetLeadingZero() .......................................................................................... 104
Currency_GetNativeSymbol()........................................................................................ 105
Currency_GetNegativeAfterValue().............................................................................. 106
Currency_GetNegativeBeforeSymbol() ........................................................................ 107
Currency_GetNegativeParens() ..................................................................................... 108
Currency_GetNegativeSymbol().................................................................................... 109
Currency_GetNumberOfDecimals() ..............................................................................110
Currency_GetSymbol()..................................................................................................... 111
Currency_GetThousandsSymbol() .................................................................................112
Currency_SetDecimalSymbol() .......................................................................................113
Currency_SetLeadingSymbol() .......................................................................................114
Currency_SetLeadingZero() ............................................................................................115
Currency_SetNegativeAfterValue()................................................................................116
ii F U N C T I O N L I B R A R Y R E F E R E N C E
C O N T E N T S
Currency_SetNegativeBeforeSymbol().......................................................................... 118
Currency_SetNegativeParens()....................................................................................... 120
Currency_SetNegativeSymbol() ..................................................................................... 122
Currency_SetNumberOfDecimals()............................................................................... 123
Currency_SetSymbol() ..................................................................................................... 124
Currency_SetThousandsSymbol().................................................................................. 125
Defaults file function library ................................................................................................ 127
Defaults_ClearUserFile() ................................................................................................. 128
Defaults_Read()................................................................................................................. 129
Defaults_ReadBoolean() .................................................................................................. 130
Defaults_ReadColor()....................................................................................................... 131
Defaults_ReadKeys()........................................................................................................ 133
Defaults_Write() ................................................................................................................ 135
Dexterity object function library .......................................................................................... 137
DexObject_AddMethod() ................................................................................................ 138
DexObject_AddProperty()............................................................................................... 140
DexObject_Create()........................................................................................................... 142
Dictionary function library.................................................................................................... 143
Dict_CountCustomResource() ........................................................................................ 144
Dict_GetCustomResourceInfo()...................................................................................... 146
Dict_GetName() ................................................................................................................ 148
Dict_GetPathname() ......................................................................................................... 149
Dict_LockCustom()........................................................................................................... 150
Dict_UnlockCustom() ...................................................................................................... 151
Dict_UpdateFormsDictionary() ...................................................................................... 152
Dict_UpdateReportsDictionary() ................................................................................... 156
Exception function library ..................................................................................................... 161
Exception_Class().............................................................................................................. 162
Exception_ClassName()................................................................................................... 163
Exception_Message()........................................................................................................ 164
Exception_Product()......................................................................................................... 165
Exception_ProductName() .............................................................................................. 166
Exception_SubClass()....................................................................................................... 167
Exception_SubClassName() ............................................................................................ 168
Field function library.............................................................................................................. 169
Field_BDLAddToSubmenu() .......................................................................................... 171
Field_BDLCreateLinkedCommandList() ...................................................................... 172
Field_BDLCreateSubmenu() ........................................................................................... 173
Field_BDLGetLinkedItemCommandTag().................................................................... 175
Field_CreateLinkedCommand()..................................................................................... 176
Field_GetBooleanProperty()............................................................................................ 178
Field_GetCaption() ........................................................................................................... 180
Field_GetColor()............................................................................................................... 181
Field_GetFont()................................................................................................................. 183
Field_GetImage().............................................................................................................. 184
Field_GetInsertPosFromVisualPos() ............................................................................. 185
Field_GetIntegerProperty()............................................................................................. 186
Field_GetLinkedCommandTag() ................................................................................... 187
Field_GetPosition() .......................................................................................................... 188
Field_GetRequiredStatus().............................................................................................. 189
Field_GetSelection()......................................................................................................... 190
Field_GetSize().................................................................................................................. 191
Field_GetStringProperty() .............................................................................................. 192
Field_GetVisualPosFromInsertPos() ............................................................................. 193
Field_GetToolTip() ........................................................................................................... 194
Field_InsertStringInText() ............................................................................................... 195
Field_MarkListItems() ..................................................................................................... 196
Field_ParseText() .............................................................................................................. 197
Field_SetAltLineColor() .................................................................................................. 199
Field_SetBackColor() ....................................................................................................... 201
Field_SetBooleanProperty() ............................................................................................ 202
Field_SetCaption() ........................................................................................................... 204
Field_SetCustomPromptFormat().................................................................................. 205
Field_SetFont().................................................................................................................. 207
Field_SetFontColor()........................................................................................................ 208
Field_SetFontSize() .......................................................................................................... 209
Field_SetFontStyle() ......................................................................................................... 210
Field_SetImage()................................................................................................................211
Field_SetIntegerProperty().............................................................................................. 212
Field_SetPattern()............................................................................................................. 213
Field_SetPatternColor()................................................................................................... 214
Field_SetRequiredFormat()............................................................................................. 215
Field_SetRequiredStatus()............................................................................................... 217
Field_SetSelection().......................................................................................................... 219
Field_SetStringProperty() ............................................................................................... 220
Field_SetToolTip() ............................................................................................................ 221
Field_SetZoomFormat() .................................................................................................. 222
File function library................................................................................................................ 225
File_Count() ...................................................................................................................... 226
File_Delete() ...................................................................................................................... 227
File_GetSize() .................................................................................................................... 228
File_GetTempDirectory() ................................................................................................ 229
File_Probe() ....................................................................................................................... 230
File list function library ......................................................................................................... 231
FileList_Add()................................................................................................................... 232
iv F U N C T I O N L I B R A R Y R E F E R E N C E
C O N T E N T S
Launch_WriteDictPath().................................................................................................. 284
List view function library...................................................................................................... 287
ListView_ColumnAdd().................................................................................................. 289
ListView_ColumnCount()............................................................................................... 291
ListView_ColumnGetAlignment() ................................................................................ 292
ListView_ColumnGetLabel().......................................................................................... 293
ListView_ColumnGetPosition() ..................................................................................... 294
ListView_ColumnGetSubitem()..................................................................................... 295
ListView_ColumnGetWidth() ........................................................................................ 296
ListView_ColumnRemove() ........................................................................................... 297
ListView_ColumnSetAlignment() ................................................................................. 299
ListView_ColumnSetLabel()........................................................................................... 300
ListView_ColumnSetPosition() ...................................................................................... 301
ListView_ColumnSetWidth() ......................................................................................... 302
ListView_GetClickItem()................................................................................................. 304
ListView_GetSortColumn() ............................................................................................ 305
ListView_GetStringWidth() ............................................................................................ 306
ListView_GetView()......................................................................................................... 307
ListView_ItemAdd() ........................................................................................................ 308
ListView_ItemCount() ..................................................................................................... 310
ListView_ItemGetCurrencySubitem()............................................................................311
ListView_ItemGetData() ................................................................................................. 312
ListView_ItemGetDateSubitem()................................................................................... 313
ListView_ItemGetImage()............................................................................................... 314
ListView_ItemGetIntSubitem() ...................................................................................... 315
ListView_ItemGetLabel() ................................................................................................ 316
ListView_ItemGetStateImage() ...................................................................................... 317
ListView_ItemGetSubitem() ........................................................................................... 318
ListView_ItemGetTimeSubitem() .................................................................................. 319
ListView_ItemMakeVisible() .......................................................................................... 320
ListView_ItemRemove().................................................................................................. 321
ListView_ItemSetCurrencySubitem()............................................................................ 322
ListView_ItemSetData() .................................................................................................. 326
ListView_ItemSetDateSubitem().................................................................................... 327
ListView_ItemSetImage()................................................................................................ 328
ListView_ItemSetIntSubitem() ....................................................................................... 329
ListView_ItemSetLabel() ................................................................................................. 330
ListView_ItemSetStateImage() ....................................................................................... 331
ListView_ItemSetSubitem() ............................................................................................ 332
ListView_ItemSetTimeSubitem() ................................................................................... 333
ListView_SelectionCount() ............................................................................................. 334
ListView_SelectionGet() .................................................................................................. 335
ListView_SelectionSet() ................................................................................................... 336
vi F U N C T I O N L I B R A R Y R E F E R E N C E
C O N T E N T S
viii F U N C T I O N L I B R A R Y R E F E R E N C E
C O N T E N T S
x FU N C T I O N L I B R A R Y R E F E R E N C E
C O N T E N T S
Table_GetNumberOfKeys()............................................................................................. 582
Table_GetOSName()......................................................................................................... 583
Table_GetRangeKey()....................................................................................................... 584
Table_GetSeries() .............................................................................................................. 585
Table_GetSQLErrorText()................................................................................................. 586
Table_IsRangeSet()............................................................................................................ 588
Table_OpenAsTemp()....................................................................................................... 589
Table_OpenNewBuffer().................................................................................................. 590
Table_RebuildIndexes() ................................................................................................... 591
Table_SetCreateMode() .................................................................................................... 593
Table_SetDBType()............................................................................................................ 595
Table_SetDeleteOptions() ................................................................................................ 596
Table_SetRefreshFlags() ................................................................................................... 598
Table_StartConversion() .................................................................................................. 599
Table_StartShrink() ........................................................................................................... 602
Table_Truncate()................................................................................................................ 604
Table_VerifyRecord() ........................................................................................................ 606
Text file function library ........................................................................................................ 609
TextFile_Close()................................................................................................................. 610
TextFile_Open()................................................................................................................. 611
TextFile_ReadLine().......................................................................................................... 613
TextFile_ReadText() .......................................................................................................... 615
TextFile_WriteDOS()......................................................................................................... 616
TextFile_WriteLine() ......................................................................................................... 617
TextFile_WriteText().......................................................................................................... 618
Timer function library ............................................................................................................ 619
Timer_Sleep()..................................................................................................................... 620
Tools function library ............................................................................................................. 621
Tools_CloseDUOSTable()................................................................................................. 622
Tools_DisableLoadBalancing() ....................................................................................... 623
Tools_EnableCommandMenus() .................................................................................... 624
Tools_EnableCustomizationMaintenance() .................................................................. 625
Tools_EnableCustomizationStatus() .............................................................................. 626
Tools_EnableImport()....................................................................................................... 627
Tools_EnableLoadBalancing()......................................................................................... 628
Tools_EnableModifier().................................................................................................... 629
Tools_EnableReportWriter()............................................................................................ 630
Tools_GetTranLevel() ....................................................................................................... 631
Tools_IsAppProcessServer()............................................................................................ 632
Tools_IsScriptRemote() .................................................................................................... 633
Tools_OpenDUOSTable()................................................................................................. 634
Tools_UseShell .................................................................................................................. 635
xii FU N C T I O N L I B R A R Y R E F E R E N C E
C O N T E N T S
xiv FU N C T I O N L I B R A R Y R E F E R E N C E
INTRODUCTION
Introduction
This manual provides a detailed reference for the function libraries
provided with Microsoft® Dexterity. Function libraries group related
functions based on how they are used. For example, the functions used to
manipulate fields are located in the Fields Library. For general information
about scripting, refer to Volume 2 of the Dexterity Programmer’s Guide.
Symbol Description
➥ of table Items; A continuation character indicates that a script
continued from one line to the next should be
typed as one line in the Script Editor.
The light bulb symbol indicates helpful tips,
shortcuts and suggestions.
2 FU N C T I O N L I B R A R Y R E F E R E N C E
IN TRO DUCT IO N
Convention Description
Part 2, Basics Bold type indicates a part name.
Chapter 9, “Tables” Quotation marks indicate a chapter name.
Applying formats Italicized type indicates a section name.
set 'l_Item' to 1; This font is used to indicate script examples.
RUNTIME.EXE Words in uppercase indicate a file name.
Software Development Acronyms are spelled out the first time they’re
Kit (SDK) used.
TAB or ALT+M Small capital letters indicate a key or a key
sequence.
Command syntax
The syntax descriptions throughout this manual use the following
standards:
• A vertical bar (|) between two or more items should be read as “or,”
and indicates that one item in the list should be chosen.
• Ellipses (...) indicate that other commands can appear between the key-
words of the command being described.
Programming style
• Script examples are shown in Courier type.
4 FU N C T I O N L I B R A R Y R E F E R E N C E
PART 1: FUNCTION LIBRARY SUMMARY
Part 1: Function Library
Summary
This part describes the functions available in the various function libraries
for Dexterity. The naming convention groups related functions into libraries
and allows each function’s purpose to be readily identified. For example, all
functions included in the Currency function library begin with the word
Currency, and are used to manipulate the formats created for use in
multicurrency applications.
The following table lists the functions in each function library, along with
brief descriptions. The next part of the manual describes each function in
detail.
6 FU N C T I O N L I B R A R Y R E F E R E N C E
PA RT 1 F U N C T I O N L I B R A R Y S U M M A R Y
Activity tracking
Activity_GetBackgroundStatus() Ascertains whether the runtime engine’s process queue contains any
background procedures.
Activity_GetExitMode() Ascertains the mode used to exit the runtime engine.
Activity_GetResourceName() Returns a string containing a resource’s display name.
Auto-complete
AutoComplete_AddStringValue() Adds an auto-complete value for the specified field.
AutoComplete_RemoveAllData() Removes all of the auto-complete data for the user currently logged
into the workstation.
AutoComplete_RemoveFieldData() Removes the auto-complete data for the specified field for the user
currently logged into the workstation.
AutoComplete_RemoveStringValue() Removes the specified string from the auto-complete data for the
specified field.
AutoComplete_SetMode() Enables or disables auto-complete for the application.
AutoComplete_SetOptions() Sets options for auto-complete functionality.
Color
Color_ConvertNameToValue() Converts a Dexterity predefined color name to the corresponding
color value.
Color_ConvertRGBToValue() Converts red, green and blue color levels to a color value.
Color_ConvertValueToName() Converts a color value to a corresponding predefined color name.
Color_ConvertValueToRGB() Converts a color to its component red, green and blue color levels.
Color_GetFromDialog() Opens a color selection dialog that allows the user to pick a color.
Color_ResetSystemColor() Sets the specified system color category back to the default value,
which is derived from the current operating system settings.
Color_SetSystemColor() Sets a system color category to the specified color.
COM
COM_AttachEventHandler() Attaches a callback object as an event handler.
COM_CreateObject() Creates a COM object reference to a new instance of an object.
COM_DetachEventHandler() Detaches the event handler from a callback object in your Dexterity-
based application.
COM_GetObject() Retrieves a reference to the instance of an object that exists in the
running object table.
COM_RegisterRunningObject() Adds the specified callback object to the running object table.
COM_RevokeRunningObject() Removes a callback object from the running object table.
Command
Command_Execute() Performs the action for the specified command.
Command_GetAccelerator() Retrieves the shortcut that is defined for the command.
Command_GetBooleanProperty() Retrieves a specified boolean property for a command.
Command (continued)
Command_GetIDs Retrieves the resource IDs of the dictionary that contains the
command, the form on which the command is defined, and the
command itself.
Command_GetImageProperty() Retrieves the specified image defined for a command.
Command_GetNamedProperty() Retrieves the value of a specific named property that has been added
to a command.
Command_GetStringProperty() Retrieves a specified string property for a command.
Command_GetTag() Retrieves the tag associated with the specified command or
command list.
Command_GetType() Retrieves the type of a specific command.
Command_Reset() Returns the settings for a command back to their original state as
defined in the dictionary.
Command_SetAccelerator() Sets the shortcut that is defined for the command.
Command_SetBooleanProperty() Sets a specified boolean property for a command.
Command_SetImageProperty() Sets the specified image defined for a command.
Command_SetNamedProperty() Temporarily adds a property with the specified name to a command.
It then sets the value for the property.
Command_SetStringProperty() Sets a specified string property for a command.
Command bar
CommandBar_Create() Creates a toolbar based on the specified command list.
CommandBar_Destroy() Removes a toolbar based on the specified command list.
CommandBar_GetPosition() Retrieves the row and position of a toolbar that is based on the
specified command list.
Command list
CommandList_Add() Adds a command or another command list to the specified command
list.
CommandList_CreateList() Creates a command list and associates it with a specific form.
CommandList_FindCommand() Retrieves the position of the specified item in a command list.
CommandList_GetCommandByPosition() Retrieves the tag for a command, based on the position in the
command list.
CommandList_NumCommands() Retrieves the number of commands in the specified command list.
CommandList_Remove() Removes the specified item from a command list.
CommandList_RemoveAll() Removes all items from the specified command list.
CommandList_RemoveCommandByPosition() Removes the item from the specified position in a command list.
Currency
Currency_GetDecimalSymbol() Returns the string used as a decimal separator.
Currency_GetLeadingSymbol() Returns a boolean indicating whether the currency symbol is
positioned before the currency value.
Currency_GetLeadingZero() Returns a boolean indicating whether a currency value less than 1 and
greater than -1 will be displayed with a leading zero.
8 FU N C T I O N L I B R A R Y R E F E R E N C E
PA RT 1 F U N C T I O N L I B R A R Y S U M M A R Y
Currency (continued)
Currency_GetNativeSymbol() Returns a platform-specific string displaying the dollar, pound, yen or
Euro currency symbol.
Currency_GetNegativeAfterValue() Returns a boolean value indicating whether the negative symbol is
placed after the currency value.
Currency_GetNegativeBeforeSymbol() Returns a boolean indicating whether a leading negative symbol is
placed before a leading currency symbol.
Currency_GetNegativeParens() Returns a boolean indicating whether parentheses are used to denote
a negative currency value.
Currency_GetNegativeSymbol() Returns the string used as the negative symbol.
Currency_GetNumberOfDecimals() Returns the number of digits that will appear to the right of a currency
value’s decimal separator.
Currency_GetSymbol() Returns the string used as a currency symbol.
Currency_GetThousandsSymbol() Returns the string used as a thousands separator.
Currency_SetDecimalSymbol() Defines a string to use as a decimal separator.
Currency_SetLeadingSymbol() Specifies whether the currency symbol should appear before or after
the value.
Currency_SetLeadingZero() Defines whether a leading zero will be displayed with a currency value
less than 1 and greater than -1.
Currency_SetNegativeAfterValue() Defines whether the negative symbol is placed after the value.
Currency_SetNegativeBeforeSymbol() Defines whether a leading negative symbol is placed before or after a
leading currency symbol.
Currency_SetNegativeParens() Defines whether parentheses are used to denote a negative value.
Currency_SetNegativeSymbol() Defines a string to be used as a negative symbol.
Currency_SetNumberOfDecimals() Defines the number of digits that will appear to the right of the
decimal separator.
Currency_SetSymbol() Defines a string to use as a currency symbol.
Currency_SetThousandsSymbol() Defines a string to use as a thousands separator.
Defaults file
Defaults_ClearUserFile() Clears the contents of the user-specifc DEX.INI file.
Defaults_Read() Reads the value of a setting in the Dexterity defaults file.
Defaults_ReadBoolean() Reads a boolean value from the Defaults file.
Defaults_ReadColor() Reads a color value from the Defaults file.
Defaults_ReadKeys() Reads all of the key values in the specified DEX.INI file.
Defaults_Write() Writes a setting to the Dexterity defaults file.
Dexterity object
DexObject_AddProperty() Adds a field to a callback object.
DexObject_AddMethod() Adds a method to a callback object.
DexObject_Create() Creates a callback object.
Dictionary
Dict_CountCustomResource() Returns the number of forms in the forms dictionary, or the number
of reports in the reports dictionary.
Dict_GetCustomResourceInfo() Returns information about a form in a forms dictionary, or a report in
a reports dictionary.
Dict_GetName() Returns the operating system name of the current dictionary.
Dict_GetPathname() Returns the generic path of various components of the current
installation, such as the runtime engine or launch file.
Dict_LockCustom() Opens and locks a forms or reports dictionary.
Dict_UnlockCustom() Releases the lock added by Dict_LockCustom().
Dict_UpdateFormsDictionary() Updates existing new and modified reports to work with the new
version of an application.
Dict_UpdateReportsDictionary() Upgrades existing modified forms to work with the new version of an
application.
Exception handling
Exception_Class() Returns the class of the current exception.
Exception_ClassName() Returns a string containing the constant for the class of the current
system exception.
Exception_Message() Returns a string describing the current exception.
Exception_Product() Returns the ID of the product that threw the current exception.
Exception_SubClass() Returns the subclass of the current exception.
Exception_SubClassName() Returns a string containing the constant for the subclass of the
current system exception.
Field
Field_BDLAddToSubmenu() Adds an item to a submenu of a button drop list control.
Field_BDLCreateLinkedCommandList() Creates a command list based on the button drop list window field
specified.
Field_BDLCreateSubmenu() Adds a submenu to a button drop list control.
Field_BDLGetLinkedItemCommandTag() Retrieves the command tag for a button drop list item that is part of
the command list for a button drop list.
Field_CreateLinkedCommand() Creates a command based on the window field specified.
Field_GetBooleanProperty() Retrieves a specified boolean property for a field.
Field_GetCaption() Retrieves the text caption for the specified field.
Field_GetColor() Retrieves color information for a field.
Field_GetFont() Retrieves the font characteristics for a field.
Field_GetImage() Retrieves the item numbers of the images associated with a push
button or button drop list field.
Field_GetInsertPosFromVisualPos() Retrieves the insertion position of an item in a list field based on its
visual position.
Field_GetIntegerProperty() Retrieves a specified integer property for a field.
10 F U N C T I O N L I B R A R Y R E F E R E N C E
PA RT 1 F U N C T I O N L I B R A R Y S U M M A R Y
Field (continued)
Field_GetLinkedCommandTag() Returns the command tag for the command that was created for the
field.
Field_GetPosition() Returns the current coordinates of the named field’s top left corner.
Field_GetRequiredStatus() Ascertains the status of the Show Required Fields menu item.
Field_GetSelection() Retrieves the selected text from a text field.
Field_GetSize() Retrieves the horizontal and vertical size of a window field.
Field_GetStringProperty() Retrieves a specified string property for a field.
Field_GetToolTip() Returns the tooltip associated with a window field.
Field_GetVisualPosFromInsertPos() Retrieves the visual position of an item in a list field based on its
insertion position.
Field_InsertStringInText() Inserts a string or string field into a text field.
Field_MarkListItems() Marks and unmarks items in a non-native list box with an asterisk.
Field_ParseText() Parses a text field into string fields.
Field_SetAltLineColor() Specifies colors to use for alternate lines in scrolling windows.
Field_SetBackColor() Sets the background color of a field.
Field_SetBooleanProperty() Sets a specified boolean property for a field.
Field_SetCaption() Sets the text caption for the specified field.
Field_SetCustomPromptFormat() Specifies display characteristics of prompts.
Field_SetFont() Sets the font characteristics for a field.
Field_SetFontColor() Sets the color of the font used for a field.
Field_SetFontSize() Sets the size of the font used for a field.
Field_SetFontStyle() Sets the style of the font used for a field.
Field_SetImage() Specifies the default image to use for a push button or button drop
list field.
Field_SetIntegerProperty() Sets a specified integer property for a field.
Field_SetPattern() Sets the pattern used for a field.
Field_SetPatternColor() Sets the color of the pattern used for a field.
Field_SetRequiredFormat() Sets the style and color used for prompts linked to required fields.
Field_SetRequiredStatus() Checks or unchecks the Show Required Fields menu item.
Field_SetSelection() Selects text in a text field.
Field_SetStringProperty() Sets a specified string property for a field.
Field_SetToolTip() Sets the tooltip for a window field.
Field_SetZoomFormat() Sets the display characteristics of text and field objects whose Zoom
property is true.
File
File_Count() Returns the number of files currently open, currently available and the
maximum available for an application.
File_Delete() Deletes a file at the operating system.
File_GetSize() Retrieves the size in bytes of the specified file.
File_GetTempDirectory() Retrieves the complete path to the local temporary folder for the
current user.
File_Probe() Indicates whether a table or file exists in the specified location.
File list
FileList_Add() Adds a file to a file list.
FileList_Count() Returns the number of files in the specified file list.
FileList_Create() Creates a new file list.
FileList_Destroy() Frees the memory used for a file list.
FileList_Get() Retrieves the file information for a specific position in the file list.
FileList_Remove() Removes the specified file list item from a file list.
FileList_ShowDialog() Displays a file system dialog box that allows the user to select a set of
files. The selected files are returned as a file list.
File type
FileType_CanAppend() Indicates whether a specified file type can be appended to.
FileType_FillList() Fills a list box with the available file types that the Report Writer can
export to.
FileType_GetExtension() Retrieves the file extension for a specified file type.
FileType_IsValid() Indicates whether a file type is one of the valid types the Report Writer
can export to.
Form
Form_GetWindowGroup() Creates or retrieves a window group for the specified form.
Help pane
HelpPane_Create() Creates a docked HTML Help pane on the right side of the
application’s display area
HelpPane_Destroy() Removes the docked HTML Help pane from the right side of the
application’s display area.
HelpPane_DisplayTopic() Displays the specified topic from an compiled HTML Help file in the
docked help pane.
HelpPane_GetWidth() Retrieves the width of the docked HTML Help pane in the application.
HelpPane_SetTitle() Specifies the title that will appear at the top of the docked HTML Help
pane on the right side of the application’s display area.
HelpPane_SetWidth() Specifies the width of the docked HTML Help pane on the right side of
the application area.
HelpPane_Show() Causes the docked HTML Help pane to be shown or hidden in the
application.
Import
Import_CloseFile() Closes the text file opened using Import_OpenFile().
Import_GetNextField() Returns the value of the current field, and advances to the next field in
a record.
Import_GetNextRecord() Advances to the next record or line in the text file.
Import_OpenFile() Opens a specified text file and reserves a file ID.
12 F U N C T I O N L I B R A R Y R E F E R E N C E
PA RT 1 F U N C T I O N L I B R A R Y S U M M A R Y
IP
IP_GetIPName() Returns the host name of the current workstation.
IP_GetIPNumber() Returns the IP address of the current workstation.
IP_PingDPS() Pings a Process Server workstation to determine whether the Process
Server is running.
Launch
Launch_CountProds() Counts the number of products listed in the launch file.
Launch_FillListWithProds() Fills a list field with product names listed in the current launch file.
Launch_GetFileInfo() Fills list fields with product names, product IDs and dictionary
location IDs from the launch file.
Launch_GetFileName() Returns the full generic path and launch file name for the currently-
running application.
Launch_GetProdID() Returns a product ID based upon a product’s position in the launch
file.
Launch_GetProdName() Returns a product’s name from the launch file based upon its product
ID.
Launch_GetProdPosition() Returns the position of the product in the launch file.
Launch_ParseFileFromPath() Parses a file’s operating system name from a generic pathname.
Launch_ReadDictPath() Returns the location of an application, forms or reports dictionary
from the launch file.
Launch_SelectDict() Displays an operating system dialog box, from which you can select a
dictionary location.
Launch_SelectFile() Displays an operating system dialog box, from which you can select a
launch file.
Launch_WriteDictPath() Writes the location of an application, forms or reports dictionary to
the launch file.
ListView
ListView_ColumnAdd() Adds a column to the list view field.
ListView_ColumnCount() Retrieves the total number of columns that have been added to a list
view field.
ListView_ColumnGetAlignment() Retrieves the alignment of the specified column of a list view field.
ListView_ColumnGetLabel() Retrieves the label of the specified column of a list view field.
ListView_ColumnGetPosition() Retrieves the position of the specified column of a list view field.
ListView_ColumnGetSubitem() Retrieves the number of the subitem associated with the column.
ListView_ColumnGetWidth() Retrieves the width, in pixels, of the specified column.
ListView_ColumnRemove() Removes the specified column from a list view field.
ListView_ColumnSetAlignment() Specifies the alignment of a column in a list view field.
ListView_ColumnSetLabel() Sets the label of the specified column of a list view field.
ListView_ColumnSetPosition() Sets the position of the specified column of a list view field.
ListView_ColumnSetWidth() Sets the width of the specified column.
ListView_GetClickItem() Returns the index of the item that was most recently clicked.
ListView (continued)
ListView_GetSortColumn() Returns information for the column by which the list view field is
being sorted.
ListView_GetStringWidth() Returns the number of pixels required to fully display a string in the
current font of a specified list view field.
ListView_GetView() Retrieves the current view mode for the specified list view field.
ListView_ItemAdd() Adds an item to a list view field.
ListView_ItemCount() Retrieves the number of items currently in a list view field.
ListView_ItemGetCurrencySubitem() Retrieves a currency or variable currency value from the additional
component of a subitem.
ListView_ItemGetData() Retrieves the long integer data item associated with the specified list
view item.
ListView_ItemGetDateSubitem() Retrieves a date value from the additional component of a subitem.
ListView_ItemGetImage() Retrieves the item numbers of the images associated with the
specified list view item.
ListView_ItemGetIntSubitem() Retrieves an integer or long integer value from the additional
component of a subitem.
ListView_ItemGetLabel() Retrieves the label of the specified list view item.
ListView_ItemGetStateImage() Retrieves the item number of the state image associated with the
specified list view item.
ListView_ItemGetSubitem() Retrieves a subitem from the specified list view item.
ListView_ItemGetTimeSubitem() Retrieves a time value from the additional component of a subitem.
ListView_ItemMakeVisible() Makes the specified item in a list view field visible.
ListView_ItemRemove() Removes the specified item from a list view field.
ListView_ItemSetCurrencySubitem() Sets the value of the additional component of a subitem to a currency
or variable currency value.
ListView_ItemSetData() Sets the data item associated with the specified list view item.
ListView_ItemSetDateSubitem() Sets the value of the additional component of a subitem to a date
value.
ListView_ItemSetImage() Sets the item image associated with the specified list view item.
ListView_ItemSetIntSubitem() Sets the value of the additional component of a subitem to an integer
or long integer value.
ListView_ItemSetLabel() Sets the label of the specified list view item.
ListView_ItemSetStateImage() Sets the state image associated with the specified list view item.
ListView_ItemSetSubitem() Sets the value of a subitem for the specified list view item.
ListView_ItemSetTimeSubitem() Sets the value of the additional component of a subitem to a time
value.
ListView_SelectionCount() Retrieves the number of items currently selected in a list view field.
ListView_SelectionGet() Retrieves the item index of the specified item in the selection.
ListView_SelectionSet() Changes the selection in a list view field.
ListView_SetEmptyMessage() Specifies the message to display when the list view doesn’t contain
any items.
ListView_SetSortColumn() Specifies the column by which a list view field is sorted.
ListView_SetView() Sets the view mode for the specified list view field.
ListView_Sort() Sorts the items in a list view field.
14 F U N C T I O N L I B R A R Y R E F E R E N C E
PA RT 1 F U N C T I O N L I B R A R Y S U M M A R Y
Login
Login_AlterLogin() Changes the characteristics of a SQL login.
Login_CreateLogin() Creates a new SQL login.
Login_DropLogin() Drops a SQL login.
Login_ExitDataSource() Disconnects a user from the current data source.
Login_GetDataSources() Fills a list box or drop-down list with the names of all available data
sources.
Login_GetDBMSInfo() Retrieves information about the ODBC driver and data source being
used
Login_GetInfo() Returns the names of the data source and user ID associated with the
current client’s connection to the server.
Login_GetLoginSettings() Retrieves the login options for the specified SQL login.
Login_LogIntoDataSource() Logs the user into the named data source.
Login_LogIntoDataSourceEx() Logs the user into the named data source. It also supports the
additional password features available for SQL Server 2005.
Login_OpenDexDialog() Logs a user into the named data source using Dexterity’s predefined
Login window.
Login_VerifyInfo() Verifies whether the specified user ID and password are a valid
combination for access to the named data source.
Mail
Mail_AddressListAdd() Adds an address to the specified address list.
Mail_AddressListCount() Returns the number of addresses in the specified address list.
Mail_AddressListCreate() Creates a list that will contain addresses to which a mail message will
be sent or replies returned to.
Mail_AddressListDestroy() Removes the specified address list from memory.
Mail_AddressListGet() Retrieves an address from the specified address list.
Mail_AddressListRemove() Removes an address from the specified address list.
Mail_DisplayAddressDialog() Displays the mail message addressing dialog that allows a user to
specify who a message will be sent to.
Mail_DisplayReplyToDialog() Displays the mail message addressing dialog that allows the user to
select who message replies will be sent to
Mail_GetServerType() Retrieves the type of server that is being used for the current session.
Mail_GetSessionAddress() Retrieves the address from the current mail profile.
Mail_IsLoggedOn() Indicates whether the application is currently logged on to a mail
session.
Mail_LogOff() Closes the mail session on the current workstation.
Mail_LogOn() Creates a mail session on the current workstation.
Mail_ResolveAddress() Attempts to match a search string to an e-mail address in the address
book.
Mail_Send() Sends a message to the members of a specified address list.
Mail_SendDialog() Sends a message to the members of a specified address list.
Mail_SetServerType() Specifies the type of connection to use for the mail server.
MAPI
MAPI_AddAddress() Adds an address to the specified address list.
MAPI_CountAddresses() Returns the number of addresses in the specified address list.
MAPI_CreateAddressList() Creates a list that will contain addresses to which a mail message will
be sent.
MAPI_DestroyAddressList() Removes the specified address list from memory.
MAPI_DisplayDialog() Displays the MAPI message addressing dialog.
MAPI_GetAddress() Retrieves an address from the specified address list.
MAPI_IsLoggedOn() Indicates whether the application is logged on to a MAPI session.
MAPI_IsMailEnabled() Indicates whether the current workstation supports MAPI.
MAPI_ProfileGetAddress() Retrieves the name and e-mail address from the profile for the current
user.
MAPI_LogOff() Closes the MAPI session on the current workstation.
MAPI_LogOn() Creates a MAPI session on the current workstation.
MAPI_PropertyListCount() Retrieves the number of properties in a property list.
MAPI_PropertyListCreate() Creates a list that will contain properties that specify characteristics of
an e-mail message.
MAPI_PropertyListDestroy() Removes the specified property list from memory.
MAPI_PropertyListGetValue() Retrieves the value of a property from the specified property list.
MAPI_PropertyListGetValueByIndex() Retrieves the value of a property from the specified property list,
based on the index.
MAPI_PropertyListSetValue() Sets the value of a property in the specified property list.
MAPI_RemoveAddress() Removes an address from the specified address list.
MAPI_ResolveAddress() Attempts to match a search string to an e-mail address in the address
book.
MAPI_Send() Sends a message to the members of a specified address list.
MAPI_SendDialog() Sends a message to the members of a specified address list. A mail
dialog will be displayed for each message sent.
Menu
Menu_Invoke() Causes a menu item to be invoked, just as if it had been selected by
the user.
Menu bar
MenuBar_AddMenu() Adds a command list to the menu bar.
MenuBar_RemoveAllMenus() Removes all menus from the menu bar.
MenuBar_RemoveMenu() Removes the specified menu from the menu bar.
OLE
OLE_CloseNote() Closes the specified OLE container file.
OLE_DeleteNote() Closes the specified OLE container file (if open) and deletes it.
OLE_Exit() Closes the OLE container application.
16 F U N C T I O N L I B R A R Y R E F E R E N C E
PA RT 1 F U N C T I O N L I B R A R Y S U M M A R Y
OLE (continued)
OLE_IsNoteEnabled() Ascertains whether the current operating environment can support
the OLE container application.
OLE_OpenNote() Opens the specified OLE container file and sets the window title of the
OLE container application.
OLE_SaveNote() Saves the specified OLE container file.
Path
Path_ChangeDefault() Changes the default location for tables with a Pathname table series.
Path_CreateFolder() Creates a new folder or directory.
Path_DoesExist() Indicates whether the specified path exists.
Path_GetForApp() Returns the generic path of various components of the current
installation, such as the runtime engine or launch file.
Path_MakeGeneric() Converts a native pathname to a generic pathname.
Path_MakeNative() Converts a generic pathname to a native pathname.
Path_ParseFileFromPath() Parses a file’s operating system name from a generic path.
Path_ParsePathFromPath() Parses the path name from a generic path.
Path_SelectPathname() Allows a user to indicate the location of a file, and returns a generic
pathname to that location.
Printer
Printer_Define() Allows a Windows user to define a named printer destination.
Printer_GetName() Returns the name of a printer defined using the Printer_Define()
function.
Printer_SetDestination() Changes the application’s default printer destination on a Windows
workstation.
Registry
Registry_DeleteKey() Deletes the specified key from the registry
Registry_DeleteValue() Deletes the specified value from the registry.
Registry_GetProtectedString() Retrieves and decrypts the specified value from the
HKEY_CURRENT_USER subtree and key.
Registry_GetValue() Retrieves the specified value from the registry.
Registry_SetKeyValue() Sets the specified value in the registry.
Registry_SetProtectedKeyString() Encrypts and sets the specified value for the HKEY_CURRENT_USER
subtree and key.
Report
Report_Begin() Starts a Quick Report.
Report_DoubleLine() Draws a double line in the current band.
Report_End() Completes the processing of a Quick Report.
Report_GetPageRemaining() Returns how much vertical area of the page remains, not including
the current band.
Report (continued)
Report_GetPageSize() Returns the printable width and height of the page, based on the
settings for the currently-selected printer.
Report_GetStringWidth() Returns the width of a string using the font, size, and style specified.
Report_NewBand() Creates a new band in the report.
Report_NewPage() Creates a new page for the report.
Report_ReadyToRun() Verifies that a new Quick Report can be run.
Report_SetFont() Specifies the characteristics of the font to use for the Quick Report.
Report_SingleLine() Draws a single line in the current band.
Report_WriteText() Adds a text string to the current band.
Resource
Resource_EndSeriesFill() Releases resources that have been read into memory by the
Resource_StartSeriesFill() function.
Resource_FillSeriesList() Fills two list fields with the display names and technical names of
resources of a specified resource type and series.
Resource_GetDisplayName() Returns a string containing the display name of a specified resource
in an application dictionary.
Resource_GetID() Returns the resource ID for a specified resource type and name.
Resource_GetInfo() Returns the resource ID and resource name for a form, report, table or
table group for a specified series.
Resource_GetNthResource() Returns the resource ID, name, and series of the specified resource.
Resource_GetResourceName() Returns the name for a specified resource type and ID.
Resource_GetSubResourceName() Returns the name for a specified subresource of a primary resource.
Resource_StartSeriesFill() Returns the number of resources of a specific type for a series.
Runtime
Runtime_GetClientType() Returns the type of runtime engine that is processing the application.
Runtime_GetCPUType() Returns information about the processor on which the application is
being run.
Runtime_GetCurrentProductID() Returns the product ID of the application dictionary that contains the
script executing this function.
Runtime_GetModuleInfo() Retrieves the major and minor version numbers and the build
number from the application dictionary.
Runtime_GetOSBuildInfo() Returns build information for the operating system on which the
application is being run.
Runtime_GetOSInfo() Returns information about the operating system on which the
application is being run.
Runtime_GetVersionNum() Returns a string describing the current version of the runtime engine.
Runtime_GetWebClientTrustLevel() Returns an integer indicating the trust level of the Silverlight
application for the web client.
Runtime_SetAboutMenu() Allows you to change the application name in the About menu item.
Runtime_SetFieldEnterMode() Changes the functionality of the ENTER key to act as the TAB key.
Runtime_SetIcon() Allows you to specify which icons will be displayed in the application.
18 F U N C T I O N L I B R A R Y R E F E R E N C E
PA RT 1 F U N C T I O N L I B R A R Y S U M M A R Y
Script log
ScriptLog_Start() Starts logging scripts, writing the script log to the specified output
file.
ScriptLog_Stop() Stops logging scripts, closing the current output file.
Script profiler
ScriptProfile_Clear() Clears the script profile currently in memory.
ScriptProfile_Save() Saves the script profile currently in memory to the specified output
file.
ScriptProfile_Start() Causes the application to start profiling scripts.
ScriptProfile_Stop() Causes the application to stop profiling scripts.
Shell
Shell_DisplayNotification() Causes a notification to be displayed in the lower-right corner of the
display.
SQL
SQL_Clear() Clears any results sets and errors for the specified pass-through SQL
connection.
SQL_Connect() Creates a new pass-through SQL connection.
SQL_Execute() Executes a SQL string.
SQL_FetchNext() Retrieves the next row from the current results set.
SQL_GetData() Returns data in the specified column in the current row of the current
results set.
SQL_GetError() Returns information about the last error that occurred.
SQL_GetNextResults() Moves to the next results set.
SQL_GetNumCols() Returns the number of columns in the current results set.
SQL_GetNumRows() Returns the number of rows that were affected by a write operation.
SQL_Terminate() Deletes the specified pass-through SQL connection.
Table
Table_AutoShrink() Shrinks a data table and rebuilds the table’s indexes.
Table_Compare() Compares the structure of an existing table in the current data source
to that table’s definition in the application dictionary.
Table_CopyShrinkRecords() Copies a record from an original table to a temporary table created
using Table_StartShrink().
Table_CreateIndexes() Creates the indexes for the specified table on a data source.
Table_CreateProcedures() Creates the stored procedures for the specified table on a data source.
Table_DisableErrorChecks() Makes Dexterity to ignore automatic error checking for table
operations.
Table_DropProcedures() Drops the stored procedures for the specified table on a data source.
Table_EndConversion() Finishes a table conversion.
Table (continued)
Table_EndShrink() Closes the shrink table and finishes the table shrink.
Table_FillGroupList() Fills a list field with the names of the table groups from a series.
Table_FillList() Fills a list field with the names of tables from the specified table
group.
Table_FlushCache() Clears the table cache for all closed tables.
Table_GetAutoShrinkMode() Indicates whether the current database manager is capable of
conducting a table shrink using Table_AutoShrink() or rebuilding a
table’s indexes using Table_RebuildIndexes().
Table_GetDisplayName() Returns the display name for a specified table.
Table_GetFieldList() Retrieves the names of the fields in the specified table.
Table_GetKeyFieldList() Returns the list of fields that are part of the specified key
Table_GetGroup() Returns the resource ID of the table group a specified table is part of.
Table_GetKeyInfo() Returns information about a key in the specified table.
Table_GetKeyOption() Returns information about the key options for a key.
Table_GetNumberOfKeys() Returns the number of keys that are defined for the specified table.
Table_GetOSName() Returns the operating system name being used for a table.
Table_GetRangeKey() Retrieves the key used for the range applied to the specified table.
Table_GetSeries() Returns an integer corresponding to the series the specified table is
part of.
Table_GetSQLErrorText() Retrieves a block of SQL error text for the last SQL error that occurred.
Table_IsRangeSet() Ascertains whether a range is currently set for the specified table.
Table_OpenAsTemp() Creates a “clone” of the table specified. The clone will be a temporary
table with exactly the same structure as the table supplied.
Table_OpenNewBuffer() Creates a new table buffer and reference to the table specified.
Table_RebuildIndexes() Rebuilds the indexes for a table that stores data using the
c-tree Plus database manager.
Table_SetCreateMode() Allows you to choose whether tables that don’t already exist will be
created automatically at runtime.
Table_SetDBType() Sets a default database type for an application.
Table_SetDeleteOptions() Allows you to choose whether a delete all or drop will be executed
when the delete table statement is used.
Table_SetRefreshFlags() Sets the refresh flags for each client buffer associated with the named
table.
Table_StartConversion() Opens the old and new table definitions for exclusive use so data can
be converted.
Table_StartShrink() Creates a temporary data table that can be used to store data from an
original table that’s being shrunk.
Table_Truncate() Removes all records from a named table, leaving the table structure
intact in the database.
Table_VerifyRecord() Verifies the contents of the fields in a record for the specified table.
Text file
TextFile_Close() Closes a text file opened by the TextFile_Open() function.
20 F U N C T I O N L I B R A R Y R E F E R E N C E
PA RT 1 F U N C T I O N L I B R A R Y S U M M A R Y
Timer
Timer_Sleep() Causes the application to wait for the specified period of time.
Tools
Tools_CloseDUOSTable() Closes the DUOS table available to the Visual Basic® for Applications
(VBA) environment.
Tools_DisableLoadBalancing() Disables load balancing on a process server or client workstation.
Tools_EnableCommandMenus() Causes command-based menus to be used for an application, rather
than resource-defined menus.
Tools_EnableCustomizationMaintenance() Enables the Customization Maintenance menu item.
Tools_EnableCustomizationStatus() Enables the Customization Status menu item.
Tools_EnableImport() Enables the Import Utility.
Tools_EnableLoadBalancing() Enables load balancing on a process server or client workstation.
Tools_EnableModifier() Enables the Modifier.
Tools_EnableReportWriter() Enables the Report Writer.
Tools_GetTranLevel() Indicates whether a database transaction is currently active.
Tools_IsAppProcessServer() Returns whether the application is running on the Process Server.
Tools_IsScriptRemote() Returns whether the current script is being processed remotely on a
process server.
Tools_OpenDUOSTable() Opens the DUOS table available to the Visual Basic for Applications
(VBA) environment.
Tree view
TreeView_AddNode() Adds a new child node to the specified node in a tree view field.
TreeView_CollapseNode() Collapses the specified node.
TreeView_CountChildren() Returns the number of children for the specified node.
TreeView_CountNodes() Returns the entire number of nodes in a tree view field.
TreeView_ExpandNode() Expands the specified node.
TreeView_GetClickNode() Returns the ID of the node whose state image was clicked.
TreeView_GetCollapsingNode() Returns the ID of the node that is being collapsed.
TreeView_GetExpandingNode() Returns the ID of the node that is being expanded.
TreeView_GetFirstChild() Returns the ID of the first child node for the specified parent node.
Trigger
Trigger_CausedByProduct() Used in a trigger processing procedure of a database trigger to find
out which product caused the trigger to activate.
Trigger_DisableSingle() Disables a specific trigger.
Trigger_Enable() Enables or disables all client-side triggers for an application.
Trigger_EnableSingle() Enables a specific trigger.
Trigger_GetCurrentTag Used in a trigger processing procedure to retrieve the tag associated
with the current trigger.
Trigger_IsTriggerEnabled() Returns a boolean indicating whether a specific trigger is enabled.
Trigger_RegisterDatabase() Registers a database trigger for use with the runtime engine.
Trigger_RegisterDatabaseByName() Registers a database trigger for a table in the specified dictionary.
Trigger_RegisterFocus() Registers a focus trigger for use with the runtime engine.
Trigger_RegisterFocusByName() Registers a focus trigger for a resource in the specified dictionary.
Trigger_RegisterForm() Registers a form trigger for use with the runtime engine.
Trigger_RegisterFormByName() Registers a form trigger for a form in the specified dictionary.
Trigger_RegisterFunction() Registers a function trigger for use with the runtime engine.
Trigger_RegisterFunctionByName() Registers a function trigger for a function in the specified dictionary.
Trigger_RegisterProcedure() Registers a procedure trigger for use with the runtime engine.
Trigger_RegisterProcedureByName() Registers a procedure trigger for a procedure in the specified
dictionary.
Trigger_Unregister() Unregisters a specific trigger.
22 F U N C T I O N L I B R A R Y R E F E R E N C E
PA RT 1 F U N C T I O N L I B R A R Y S U M M A R Y
Utility
Utility_DecodeString() Decodes a string that was encoded by the Utility_EncodeString()
function.
Utility_DecryptTableString() Decrypts a string that has been stored in a table in encrypted format.
Utility_EncodeString() Converts a string into a format that isn’t easily readable by users or
other applications.
Utility_EncryptTableString() Encrypts a string using the same method that Dexterity uses when
storing encrypted strings in tables.
Utility_LaunchUrl() Opens a web browser and displays the content of the specified URL.
Utility_LoadDLL() Loads the specified DLL into memory.
Utility_SubstituteTokens() Replaces product tokens in a string with the corresponding product
names.
Utility_UnloadDLL() Removes the specified DLL from memory.
Window
Window_ForceRedraw() Forces a window to be redrawn.
Window_GetMainWindowTitle() Returns the window title of a form’s main window.
Window_GetPosition() Returns the coordinates of a window’s top left corner.
Window_GetRibbonCommandTag() Retrieves the command tag for the root command list that defines the
ribbon for a window.
Window_GetSize() Returns the width and height, in pixels, of a window.
Window_GetState() Retrieves the visual state for a window.
Window_GetTitle() Returns the title of the specified window.
Window_GetTitleByProduct() Returns the title of a window in a specified dictionary.
Window_PullFocus() Pulls the focus from the specified window.
Window_SetBaseSize() Sets the size of the window without resizing any of the controls in the
window.
Window_SetLineMode() Changes the window type of the scrolling window.
Window_SetState() Sets the visual state for a window.
Window group
WindowGroup_AddWindow() Adds a window to the specified window group.
WindowGroup_SetBooleanProperty() Sets the value of a boolean property for the specified window group.
WindowGroup_SetPosition() Changes the position of a window group.
WindowGroup_SetSize() Changes the size of a window group.
WindowGroup_SetState() Sets the visual state for a window group.
WindowGroup_SetStringProperty() Sets the value of a string property for the specified window group.
WinHelp
WinHelp_ALinkLookup() Starts the help engine, indicating the help file to be used, and displays
the topic corresponding to the ALink (associative link) value specified.
WinHelp_GetCurWindow() Returns the resource ID of the current window.
WinHelp (continued)
WinHelp_GetFieldContextNumber() Returns the context number for the selected field.
WinHelp_GetHelpType() Returns an integer indicating the type of help requested.
WinHelp_GetWindowContextNumber() Returns the context number for the current window.
WinHelp_InvokeHelp() Starts the help engine, indicating the help file, help command and
context number to be used.
WinHelp_LaunchUrl() Launches help content for the Microsoft Dynamics GP web client.
WinHelp_RegisterHelpProcedure() Indicates which procedure script to call when help is accessed.
WinHelp_RunHelpMacro() Specifies a help file and the help macro or macros to run.
WinHelp_Search() Starts the help engine and searches for the specified keyword in the
help file indicated.
24 F U N C T I O N L I B R A R Y R E F E R E N C E
PART 2: FUNCTION LIBRARIES
Part 2: Function Libraries
This part provides detailed descriptions of the functions available in the
various function libraries for Dexterity. Each function includes a
description, syntax, parameter list and examples of the function’s use.
26 F U N C T I O N L I B R A R Y R E F E R E N C E
Activity tracking function library
Refer to Chapter 6, Use the functions in this library when developing an activity tracking
“Activity Tracking,” in system in your application. This library contains the following functions:
the Dexterity Stand-
Alone Application • Activity_GetBackgroundStatus()
Guide for more • Activity_GetExitMode()
information. • Activity_GetResourceName()
Activity_GetBackgroundStatus()
Description The Activity_GetBackgroundStatus() function ascertains whether the
runtime engine’s process queue contains any background procedures. You
designate background procedures using the background parameter of the
call statement.
Syntax Activity_GetBackgroundStatus()
Parameters • None
Return value A boolean indicating the result; true if the function succeeded, false if it
didn’t succeed.
View background processes using the Process Monitor window. Use the
Process Monitor inherited action in the Menu Definition window to allow
the Process Monitor to be opened from within an application.
if Activity_GetBackgroundStatus() then
warning "A background process is currently active. Display the
➥ Process Monitor to view background processes.";
else
warning "No background processes are running at this time.";
end if;
28 F U N C T I O N L I B R A R Y R E F E R E N C E
A C T I V I T Y _G E T E X I T M O D E ()
Activity_GetExitMode()
Description The Activity_GetExitMode() function ascertains the mode used to exit the
runtime engine. You exit the runtime engine by exiting the application, or
by accessing the Modifier or Report Writer.
Syntax Activity_GetExitMode()
Parameters • None
Return value mode – An integer representing one of the following exit modes:
Value Description
0 The runtime engine closed.
1 The Report Writer was accessed.
2 The Modifier was accessed.
Comments Add this function to a form post script for the application’s Main Menu
form. This ensures that you can determine the exit mode, regardless of
where the user chooses to exit the runtime session.
Examples This example logs the date and time the user closed the runtime engine,
accessed the Modifier, or accessed the Report Writer. It’s attached as a post
script for the Main Menu form.
l_mode = Activity_GetExitMode();
l_date = sysdate();
l_time = systime();
if l_mode = 0 then
call Activity_Log, "Exited application", l_date, l_time;
elseif l_mode = 1 then
call Activity_Log, "Entered Report Writer", l_date, l_time;
else
call Activity_Log, "Entered the Modifier", l_date, l_time;
end if;
Activity_GetResourceName()
Description The Activity_GetResourceName() function returns a string containing a
resource’s display name.
Constant Description
FORMTYPE Indicates a form.
TABLETYPE Indicates a table.
GROUPTYPE Indicates a table group.
REPORTTYPE Indicates a report.
Comments If you implement activity tracking in your application, you can use this
function in conjunction with the Security procedure to retrieve names of
windows, table groups and reports accessed by the user. The Security
procedure runs each time a form, report or table is accessed. The runtime
engine automatically passes a product ID, resource type and resource ID in
parameters to this procedure. With this information, the
Activity_GetResourceName() function can determine the resource’s
display name, and store the name in an activity table (see the following
example).
30 F U N C T I O N L I B R A R Y R E F E R E N C E
A C T I V I T Y _ G E T R E S O U R C E N A M E ()
Examples The following Security procedure returns the product ID, resource type and
resource ID of a form, report or table group accessed during runtime. It
passes these values to a procedure that updates an activity table.
in integer l_prod_ID;
in integer l_resource_type;
in integer l_resource_ID;
The product_ID, resource_type and resource_ID are passed from the Security
procedure to the Add_User_Activity_Record procedure shown in the
following example. The Activity_GetResourceName() function uses these
values to find out the display name of the resource. A new record is then
added to the Activity Master table.
in integer l_prod_ID;
in integer l_resource_type;
in integer l_resource_ID;
Additional information
Chapter 5, “Security,” in the Stand-Alone Application Guide
AutoComplete_AddStringValue()
Description The AutoComplete_AddStringValue() function adds an auto-complete
value for the specified field.
Parameters • field field_name – The field for which the auto-complete value is being
added. The field must be on a window that is currently open in the
application.
Return value A boolean. True indicates the string was added, while false indicates it was
not.
Examples The following example is the pre script for a window. It uses the
AutoComplete_AddStringValue() function to add several auto-complete
values to the City field.
34 F U N C T I O N L I B R A R Y R E F E R E N C E
A U T O C O M P L E T E _ R E M O V E A L L D A T A ()
AutoComplete_RemoveAllData()
Description The AutoComplete_RemoveAllData() function removes all of the auto-
complete data for the user currently logged into the workstation.
Syntax AutoComplete_RemoveAllData()
Parameters • None
Return value A boolean. True indicates the data was removed, while false indicates it was
not.
result = AutoComplete_RemoveAllData();
AutoComplete_RemoveFieldData()
Description The AutoComplete_RemoveFieldData() function removes the auto-
complete data for the specified field for the user currently logged into the
workstation.
Parameters • field field_name – The field for which the auto-complete value is being
removed. The field must be on a window that is currently open in the
application.
Return value A boolean. True indicates the data was removed, while false indicates it was
not.
Examples The following example is a form post script that uses the
AutoComplete_RemoveFieldData() function to remove all auto-complete
data for the City field.
36 F U N C T I O N L I B R A R Y R E F E R E N C E
A U T O C O M P L E T E _ R E M O V E S T R I N G V A L U E ()
AutoComplete_RemoveStringValue()
Description The AutoComplete_RemoveStringValue() function removes the specified
string from the auto-complete data for the specified field.
Parameters • field field_name – The field for which the auto-complete value is being
removed. The field must be on a window that is currently open in the
application.
Return value A boolean. True indicates the value was removed, while false indicates it
was not.
Examples The following example is a form post script that uses the
AutoComplete_RemoveStringValue() function to remove the value
“Fargo” from the auto-complete data for the City field.
AutoComplete_SetMode()
Description The AutoComplete_SetMode() function enables or disables auto-complete
for the application.
Syntax AutoComplete_SetMode(mode)
Parameters • mode – A long integer that enables or disables auto-complete for the
application. The value corresponds to one of the following constants:
Constant Description
AUTOCOMPLETE_MODE_ENABLED Turns auto-complete on
AUTOCOMPLETE_MODE_DISABLED Turns auto-complete off
Return value A long integer that indicates the previous setting for the auto-complete
mode.
Comments To enable auto-complete for an individual field, you must set the
AutoComplete property for the field to True.
Examples The following example reads a setting from the DEX.INI file and uses the
AutoComplete_SetMode() function to enable or disable auto-complete for
the application.
auto_complete = upper(Defaults_Read("AutoComplete"));
38 F U N C T I O N L I B R A R Y R E F E R E N C E
A U T O C O M P L E T E _ S E T O P T I O N S ()
AutoComplete_SetOptions()
Description The AutoComplete_SetOptions() function sets several options for auto-
complete functionality.
Be sure this function is run only when all forms that contain auto-complete fields
have been closed. Otherwise, auto-complete items won’t be saved in the correct
location.
Parameters • folder_name – A string value that specifies the name of the folder that will
contain the auto-complete files. This additional folder will be located in the
\Application Data\Microsoft Business Solutions\Product_Name\ folder for
the user currently logged into the workstation. The Product_Name will
depend on the name you’ve given your application.
Use this parameter when you want your application to have multiple sets
of auto-complete items, such as one set for each different company. If you
don’t want multiple sets of auto-complete items, specify the empty string
("").
Examples The following example is a portion of the form pre script for the Main Menu
form. It uses the AutoComplete_SetOptions() function to specify the
maximum number of items and age for auto-complete items.
AutoComplete_SetOptions("",100,5);
• Color_ConvertNameToValue()
• Color_ConvertRGBToValue()
• Color_ConvertValueToName()
• Color_ConvertValueToRGB()
• Color_GetFromDialog()
• Color_ResetSystemColor()
• Color_SetSystemColor()
Color_ConvertNameToValue()
Description The Color_ConvertNameToValue() function converts a Dexterity
predefined color name to the corresponding color value.
Syntax Color_ConvertNameToValue(color_name)
Return value A long integer containing the color value. If an invalid color name is passed
to this function, the value 0 is returned.
42 F U N C T I O N L I B R A R Y R E F E R E N C E
C O L O R _ C O N V E R T RG BT O V A L U E ()
Color_ConvertRGBToValue()
Description The Color_ConvertRGBToValue() function converts red, green and blue
color levels to a color value.
Parameters • red_level – An integer specifying the level of red in the color. The value must
be between 0 and 255.
• green_level – An integer specifying the level of green in the color. The value
must be between 0 and 255.
• blue_level – An integer specifying the level of blue in the color. The value
must be between 0 and 255.
Comments The colors created by this function look best when the system is displaying
at least 65,535 colors. Otherwise, the colors may appear dithered.
Color_ConvertValueToName()
Description The Color_ConvertValueToName() function converts a color value to the
corresponding Dexterity predefined color name.
Syntax Color_ConvertValueToName(color_value)
Return value A string containing the name of the color. The following table lists the
predefined color names for Dexterity:
Examples The following example uses the Field_GetColor() function to retrieve color
information for the Color Specifications field. The font color and back color
values are converted to their color names and written to the defaults file.
44 F U N C T I O N L I B R A R Y R E F E R E N C E
C O L O R _ C O N V E R T V A L U E T O R G B ()
Color_ConvertValueToRGB()
Description The Color_ConvertValueToRGB() function converts a color value to its
component red, green and blue color levels.
• red_level – A returned integer containing the level of red in the color. The
value will be between 0 and 255.
• blue_level – A returned integer containing the level of blue in the color. The
value will be between 0 and 255.
Color_GetFromDialog()
Description The Color_GetFromDialog() function opens a color selection dialog that
allows the user to pick a color.
Parameters • color_value – A long integer field or variable containing a color value. If you
supply an initial value for this parameter, that color will be the default
selection in the color selection dialog. If the user clicks OK in the color
selection dialog, the color value selected will be returned. If the user clicks
Cancel, the value -1 will be returned.
Constant Description
COLOR_MODE_EXACT The exact color the user selected is returned from the
color selection dialog.
COLOR_MODE_SOLID Only solid colors can be selected and returned from the
color selection dialog,
If you don’t supply this parameter, an exact color will be returned from the
color selection dialog.
Return value A boolean indicating which buttons was clicked. True is indicates that OK
was clicked, while false indiates that Cancel was clicked.
46 F U N C T I O N L I B R A R Y R E F E R E N C E
C O L O R _ G E T F R O M D I A L O G ()
Comments You can use the following constants when specifying solid colors:
Constant Constant
COLOR_BLACK COLOR_GREEN
COLOR_WHITE COLOR_DARK_YELLOW
COLOR_RED COLOR_VIOLET
COLOR_BRIGHT_GREEN COLOR_DARK_RED
COLOR_BLUE COLOR_DARK_BLUE
COLOR_TURQUOISE COLOR_MEDIUM_GRAY
COLOR_PINK COLOR_LIGHT_GRAY
COLOR_YELLOW COLOR_LIGHT_YELLOW
COLOR_TEAL
color_selected = Color_GetFromDialog(color);
if color_selected = true then
result = Field_SetBackColor('Buyer ID', color);
end if;
The following example reads 16 custom color values from the defaults file.
It then displays the color selection dialog, allowing the user to pick a color.
After the color selection dialog has closed, the sixteen custom colors are
written to the defaults file.
local integer i;
local long color, custom_colors[16];
local boolean result;
48 F U N C T I O N L I B R A R Y R E F E R E N C E
C O L O R _ R E S E T S Y S T E M C O L O R ()
Color_ResetSystemColor()
Description The Color_ResetSystemColor() function sets the specified system color
category back to the default value, which is derived from the current
operating system settings.
Syntax Color_ResetSystemColor(category)
Parameters • category – A long integer specifying the system color category to be reset.
Use one of the following constants:
SYSTEM_ACTIVE_BORDER SYSTEM_SCROLLBARS
SYSTEM_ACTIVE_TITLE_BAR SYSTEM_TOOLTIP
SYSTEM_ACTIVE_TITLE_BAR_TEXT SYSTEM_TOOLTIP_TEXT
SYSTEM_APPLICATION_WORKSPACE SYSTEM_WINDOW_BACKGROUND
SYSTEM_BUTTON_DARK_SHADOW SYSTEM_WINDOW_FRAME
SYSTEM_BUTTON_FACE SYSTEM_WINDOW_TEXT
SYSTEM_BUTTON_HIGHLIGHT SYSTEM_STATUS_BAR
SYSTEM_BUTTON_LIGHT_SHADOW SYSTEM_TOOLBAR
SYSTEM_BUTTON_SHADOW SYSTEM_LIST_HEADER1
SYSTEM_BUTTON_TEXT SYSTEM_LIST_HEADER1_TEXT
SYSTEM_DESKTOP SYSTEM_LIST_HEADER2
SYSTEM_DISABLED_TEXT SYSTEM_LIST_HEADER2_TEXT
SYSTEM_HIGHLIGHT SYSTEM_LIST_LINE1
SYSTEM_HIGHLIGHT_TEXT SYSTEM_LIST_LINE1_TEXT
SYSTEM_INACTIVE_BORDER SYSTEM_LIST_LINE2
SYSTEM_INACTIVE_TITLE_BAR SYSTEM_LIST_LINE2_TEXT
SYSTEM_INACTIVE_TITLE_BAR_TEXT SYSTEM_FIELD_BORDER
SYSTEM_MENU_BAR SYSTEM_BUTTON_BORDER
SYSTEM_MENU_TEXT
Return value A boolean indicating whether the system color category was reset. True
indicates it was reset, while false indicates it was not.
Examples The following example resets the desktop color for the application back to
the default color specified by the operating system.
result = Color_ResetSystemColor(SYSTEM_DESKTOP);
if result = false then
error "System color category could not be reset.";
end if;
50 F U N C T I O N L I B R A R Y R E F E R E N C E
C O L O R _ S E T S Y S T E M C O L O R ()
Color_SetSystemColor()
Description The Color_SetSystemColor() function sets a system color category to the
specified color.
Parameters • category – A long integer specifying the system color category to be set. Use
one of the following constants:
SYSTEM_ACTIVE_BORDER SYSTEM_SCROLLBARS
SYSTEM_ACTIVE_TITLE_BAR SYSTEM_TOOLTIP
SYSTEM_ACTIVE_TITLE_BAR_TEXT SYSTEM_TOOLTIP_TEXT
SYSTEM_APPLICATION_WORKSPACE SYSTEM_WINDOW_BACKGROUND
SYSTEM_BUTTON_DARK_SHADOW SYSTEM_WINDOW_FRAME
SYSTEM_BUTTON_FACE SYSTEM_WINDOW_TEXT
SYSTEM_BUTTON_HIGHLIGHT SYSTEM_STATUS_BAR
SYSTEM_BUTTON_LIGHT_SHADOW SYSTEM_TOOLBAR
SYSTEM_BUTTON_SHADOW SYSTEM_LIST_HEADER1
SYSTEM_BUTTON_TEXT SYSTEM_LIST_HEADER1_TEXT
SYSTEM_DESKTOP SYSTEM_LIST_HEADER2
SYSTEM_DISABLED_TEXT SYSTEM_LIST_HEADER2_TEXT
SYSTEM_HIGHLIGHT SYSTEM_LIST_LINE1
SYSTEM_HIGHLIGHT_TEXT SYSTEM_LIST_LINE1_TEXT
SYSTEM_INACTIVE_BORDER SYSTEM_LIST_LINE2
SYSTEM_INACTIVE_TITLE_BAR SYSTEM_LIST_LINE2_TEXT
SYSTEM_INACTIVE_TITLE_BAR_TEXT SYSTEM_FIELD_BORDER
SYSTEM_MENU_BAR SYSTEM_BUTTON_BORDER
SYSTEM_MENU_TEXT
Return value A boolean indicating whether the system color category was set. True
indicates it was set, while false indicates it was not.
Comments You can use the following constants when specifying solid colors:
Constant Constant
COLOR_BLACK COLOR_GREEN
COLOR_WHITE COLOR_DARK_YELLOW
COLOR_RED COLOR_VIOLET
COLOR_BRIGHT_GREEN COLOR_DARK_RED
COLOR_BLUE COLOR_DARK_BLUE
COLOR_TURQUOISE COLOR_MEDIUM_GRAY
COLOR_PINK COLOR_LIGHT_GRAY
COLOR_YELLOW COLOR_LIGHT_YELLOW
COLOR_TEAL
Examples The following example sets the control area color, indicated by the constant
SYSTEM_TOOLBAR, to medium gray.
52 F U N C T I O N L I B R A R Y R E F E R E N C E
COM function library
Refer to Chapter 39, Use the functions in this library to create and manipulate COM object
“COM in sanScript,” references. This library contains the following functions:
and Chapter 40, “Call-
backs and Events,” in • COM_AttachEventHandler()
Volume 2 of the Dex- • COM_CreateObject()
terity Programmer’s • COM_DetachEventHandler()
Guide for more infor- • COM_GetObject()
mation on using these • COM_RegisterRunningObject()
functions. • COM_RevokeRunningObject()
COM_AttachEventHandler()
Description The COM_AttachEventHandler() function attaches a callback object as an
event handler.
• interface_id – An optional string parameter that indicates the GUID for the
class or interface that contains the event. Use this parameter if you must
attach to a specific interface that is not the default interface. If this
parameter is not specified, the function will use the default source interface.
Return value A long integer that identifies the event handler. You will use this value if
you need to detach the event handler. The value 0 indicates the event
handler could not be attached.
Comments When you attach a callback object as an event handler, your application is
notified when that event occurs. If your application no longer needs to be
notified that the event has occurred, use the COM_DetachEventHandler()
function to detach the event handler.
Examples The following example creates an event handler for the Activate event of
the currently active workbook in Microsoft Excel®. It uses the
COM_AttachEventHandler() function to attach the callback object in the
Dexterity-based application to the appropriate interface in Excel.
54 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M _ A T T A C H E V E N T H A N D L E R ()
COM_CreateObject()
Description The COM_CreateObject() function creates a COM object reference to a new
instance of an object.
Parameters • object_type – A string containing the fully-qualified class name of the object
to be created.
Return value A COM object reference of the type specified with the object_type parameter.
If the object cannot be created, the value null is returned.
56 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M _ D E T A C H E V E N T H A N D L E R ()
COM_DetachEventHandler()
Description The COM_DetachEventHandler() function detaches the event handler
from a callback object in your Dexterity-based application. When an event
handler is detached, your application no longer receives notifications of the
event.
Parameters • COM_reference – A reference to the object that registers the event and
notifies the Dexterity application.
• handler_id – A long integer that identifies the event handler. This is the
value that was returned from the COM_AttachEventHandler() function.
• interface_id – An optional string parameter that indicates the GUID for the
class or interface that contains the event. Use this parameter if you attached
to a specific interface that was not the default interface. If this parameter is
not specified, the function will attempt to detach from the default source
interface.
Return value A boolean. True indicates the event handler was detached, while false
indicates it was not.
result = COM_DetachEventHandler(Excel.ActiveWorkbook,
➥ '(L) Handler ID');
if result = false then
error "Unable to detach event handler";
end if;
COM_GetObject()
Description The COM_GetObject() function retrieves a reference to the instance of an
object that exists in the running object table.
Syntax COM_GetObject(object_type)
Parameters • object_type - A string containing the fully qualified class name of the object
to be retrieved.
Return value A COM object reference of the type specified. If the reference can’t be
retrieved, the value null is returned.
58 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M _ R E G I S T E R R U N N I N G O B J E C T ()
COM_RegisterRunningObject()
Description The COM_RegisterRunningObject() function adds the specified callback
object to the running object table.
Return value A long integer that identifies the COM object in the running object table.
Comments The running object table is managed by the operating system. It maintains a
list of all COM objects that can currently be accessed. For a callback object
to be accessed by external applications, you must add it to the running
object table.
Examples The following example creates a callback object and uses the
COM_RegisterRunningObject() function to add it to the running object
table. The object is added with the name “RESM.LoginInfo”.
local reference callback_obj;
local boolean result;
local long obj_id;
The following example is Visual Basic code that retrieves a reference to the
callback object that was added to the running object table in the previous
example. Notice that exactly the same name is used to refer to the object.
60 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M _ R E V O K E R U N N I N G O B J E C T ()
COM_RevokeRunningObject()
Description The COM_RevokeRunningObject() function removes a callback object
from the running object table. When the callback object is removed from the
running object table, it can no longer be accessed by other applications.
Syntax COM_RevokeRunningObject(object_id)
Parameters • object_id - A long value that specifies the COM object to remove from the
running object table. This is the value that was returned from the
COM_RegisterRunningObject() function.
Return value A boolean. True indicates the object was removed, while false indicates it
was not.
Command_Execute()
Description The Command_Execute() function performs the action for the specified
command.
Syntax Command_Execute(command_tag)
Parameters • command_tag – The integer tag value for the command to be performed.
Comments If the command has been disable with the disable command statement, it
will not be run. If the command is known at design time, you can use the
run command statement to perform the command’s action.
64 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M M A N D _ G E T A C C E L E R A T O R ()
Command_GetAccelerator()
Description The Command_GetAccelerator() function retrieves the shortcut that is
defined for the command.
Parameters • command_tag – The integer tag value for the command whose shortcut is
being retrieved.
• modifier – A long integer specifying the modifier key combination for the
shortcut. The value is 0 (zero) if no modifier is used. Otherwise, the value
corresponds to one of the following constants:
Constant Description
COMMAND_SHORTCUT_CTRL Control
COMMAND_SHORTCUT_CTRLSHIFT Control + Shift
COMMAND_SHORTCUT_CTRLALT Control + Alt
COMMAND_SHORTCUT_ALT Alt
COMMAND_SHORTCUT_ALTSHIFT Alt + Shift
COMMAND_SHORTCUT_CTRLALTSHIFT Control + Alt + Shift
• key – A long integer containing the ASCII value of the alpha-numeric key
used for the shortcut. If the key is a function key, the value corresponds to
one of the following constants:
Constant
COMMAND_SHORTCUT_KEY_F1
COMMAND_SHORTCUT_KEY_F2
COMMAND_SHORTCUT_KEY_F3
COMMAND_SHORTCUT_KEY_F4
COMMAND_SHORTCUT_KEY_F5
COMMAND_SHORTCUT_KEY_F6
COMMAND_SHORTCUT_KEY_F7
COMMAND_SHORTCUT_KEY_F8
COMMAND_SHORTCUT_KEY_F9
COMMAND_SHORTCUT_KEY_F10
COMMAND_SHORTCUT_KEY_F11
COMMAND_SHORTCUT_KEY_F12
Return value A boolean. The value true indicates the shortcut was retrieved, while false
indicates it was not.
66 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M M A N D _ G E T B O O L E A N P R O P E R T Y ()
Command_GetBooleanProperty()
Description The Command_GetBooleanProperty() function retrieves a specified
boolean property for a command.
Parameters • command_tag – The integer tag value for the command whose property is
being retrieved.
Constant Description
COMMAND_PROP_CHECKED True if the command is checked in a
menu. False if it is not.
COMMAND_PROP_DISABLED True if the command is disabled. False
if it is not.
COMMAND_PROP_HIDDEN True if the command is hidden. False if
it is not.
COMMAND_PROP_MENU_SHOW_IMAGE True if the command is showing an
image in the menu. False if it is not.
COMMAND_PROP_TOOLBAR_SHOW_IMAGE True if the command is showing an
image in a toolbar. False if it is not.
COMMAND_PROP_TOOLBAR_SHOW_TEXT True if the command is showing text in
the toolbar. False if it is not.
Command_GetIDs
Description The Command_GetIDs() function retrieves the resource IDs of the
dictionary that contains the command, the form on which the command is
defined, and the command itself.
Parameters • command_tag – The integer tag value for the command whose IDs are being
retrieved.
Return value A boolean. The value true indicates the IDs were retrieved, while the value
false indicates they were not.
for i = 1 to CommandList_NumCommands(command_list_tag) do
item_tag = CommandList_GetCommandByPosition(command_list_tag, i);
result = Command_GetIDs(item_tag, dict_ID, form_ID, res_ID);
68 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M M A N D _ G E T I M A G E P R O P E R T Y ()
Command_GetImageProperty()
Description The Command_GetImageProperty() function retrieves the specified image
defined for a command.
Parameters • command_tag – The integer tag value for the command whose property is
being retrieved.
Constant Description
COMMAND_PROP_NORMAL_IMAGE Specifies the image displayed in the normal
state.
COMMAND_PROP_CHECKED_IMAGE Specifies the image displayed in the checked
state.
Constant Description
DT_PICT A native picture resource from the dictionary.
DT_EXTERNAL_ICON An icon resource in an external resource
assembly.
Return value A boolean. The value true indicates the property was retrieved, while the
value false indicates it was not.
result = Command_GetImageProperty(item_tag,COMMAND_PROP_NORMAL_IMAGE,
➥ dict_ID, image_type, image_ID);
70 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M M A N D _ G E T N A M E D P R O P E R T Y ()
Command_GetNamedProperty()
Description The Command_GetNamedProperty() function retrieves the value of a
specific named property that has been added to a command.
Parameters • command_tag – The integer tag value for the command from which a named
property is being retrieved.
Comments The named property and its value are valid only for the current session of
the application. The named property can be set with the
Command_SetNamedProperty() function.
Command_GetStringProperty()
Description The Command_GetStringProperty() function retrieves a specified string
property for a command.
Parameters • command_tag – The integer tag value for the command whose property is
being retrieved.
Constant Description
COMMAND_PROP_ATTACHED_FORM_NAME The name of the form that is opened by
the command.
COMMAND_PROP_CLEAN_DISPLAY_NAME The text used for the command name,
but with special characters excluded.
COMMAND_PROP_DISPLAY_NAME The text used for the command name,
including any special characters.
COMMAND_PROP_TOOLTIP The tooltip displayed when the
command is used on a toolbar.
COMMAND_PROP_SECURITY_FORM_NAME The name of the security form that is
specified for the command.
72 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M M A N D _ G E T T A G ()
Command_GetTag()
Description The Command_GetTag() function retrieves the tag associated with the
specified command or command list.
Syntax Command_GetTag(command)
Parameters • command – The command for which the tag will be retrieved.
Comments You can also retrieve the tag for a command or command list if you know
the product ID, the form ID that contains the command, and the command
ID. There is no compile-time checking when a tag is retrieved this way.
Examples The following example retrieves the tag for the CL_View command list, and
then removes all of the items from the list.
The following example retrieves the tag for the product ID 3333, the form
ID 22002, and the command ID 22001.
Command_GetType()
Description The Command_GetType() function retrieves the type of a specific
command.
Syntax Command_GetType(command_tag)
Parameters • command_tag – The integer tag value for the command whose type is being
retrieved.
Constant Description
COMMANDTYPE_NONE The specified command could not be
found.
COMMANDTYPE_SCRIPT The command runs a command script.
COMMANDTYPE_FORM The command opens a form.
COMMANDTYPE_CMDLIST The command is a command list.
COMMANDTYPE_SEPARATOR The command is a separator.
Examples The following example counts the number of sub-menus (command lists)
that appear in the Tools menu.
local integer command_list_tag, item_tag;
local integer command_type, i, count;
count = 0;
for i = 1 to CommandList_NumCommands(command_list_tag) do
{Get the tag for the list item}
item_tag = CommandList_GetCommandByPosition(command_list_tag, i);
74 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M M A N D _R E S E T ()
Command_Reset()
Description The Command_Reset() function returns the settings for a command back to
their original state as defined in the dictionary.
Syntax Command_Reset(command_tag)
Parameters • command_tag – The integer tag value for the command being reset.
Return value A boolean. The value true indicates the command was reset, while false
indicates it was not.
Comments The only characteristics affected are those in the command definition. Other
characteristics, such as whether the command is visible or is checked are
not affected.
Examples The following example uses the Command_Reset() function to return to the
default settings for the CMD_Buyers command.
result = Command_Reset(item_tag);
Command_SetAccelerator()
Description The Command_SetAccelerator() function sets the shortcut that is defined
for the command.
Parameters • command_tag – The integer tag value for the command whose shortcut is
being set.
• modifier – A long integer specifying the modifier key combination for the
shortcut. The value 0 (zero) specifies no modifier is to be used. Otherwise,
the value corresponds to one of the following constants:
Constant Description
COMMAND_SHORTCUT_CTRL Control
COMMAND_SHORTCUT_CTRLSHIFT Control + Shift
COMMAND_SHORTCUT_CTRLALT Control + Alt
COMMAND_SHORTCUT_ALT Alt
COMMAND_SHORTCUT_ALTSHIFT Alt + Shift
COMMAND_SHORTCUT_CTRLALTSHIFT Control + Alt + Shift
• key – A long integer containing the ASCII value of the alpha-numeric key to
use for the shortcut. If the key is a function key, the value corresponds to
one of the following constants:
Constant
COMMAND_SHORTCUT_KEY_F1
COMMAND_SHORTCUT_KEY_F2
COMMAND_SHORTCUT_KEY_F3
COMMAND_SHORTCUT_KEY_F4
COMMAND_SHORTCUT_KEY_F5
COMMAND_SHORTCUT_KEY_F6
COMMAND_SHORTCUT_KEY_F7
COMMAND_SHORTCUT_KEY_F8
COMMAND_SHORTCUT_KEY_F9
COMMAND_SHORTCUT_KEY_F10
COMMAND_SHORTCUT_KEY_F11
COMMAND_SHORTCUT_KEY_F12
76 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M M A N D _ S E T A C C E L E R A T O R ()
Return value A boolean. The value true indicates the shortcut was set, while false
indicates it was not.
Command_SetBooleanProperty()
Description The Command_SetBooleanProperty() function sets a specified boolean
property for a command.
Parameters • command_tag – The integer tag value for the command whose property is
being set.
Constant Description
COMMAND_PROP_CHECKED True if the command is checked in a
menu. False if it is not.
COMMAND_PROP_DISABLED True if the command is disabled. False
if it is not.
COMMAND_PROP_HIDDEN True if the command is hidden. False if
it is not.
COMMAND_PROP_MENU_SHOW_IMAGE True if the command is showing an
image in the menu. False if it is not.
COMMAND_PROP_TOOLBAR_SHOW_IMAGE True if the command is showing an
image in a toolbar. False if it is not.
COMMAND_PROP_TOOLBAR_SHOW_TEXT True if the command is showing text in
the toolbar. False if it is not.
• value – A boolean indicating how to set the property. Refer to the preceding
table.
Return value A boolean indicating whether the property was set. True indicates the
property was set, while false indicates it was not.
78 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M M A N D _ S E T I M A G E P R O P E R T Y ()
Command_SetImageProperty()
Description The Command_SetImageProperty() function sets the specified image
defined for a command.
Parameters • command_tag – The integer tag value for the command whose property is
being set.
Constant Description
COMMAND_PROP_NORMAL_IMAGE Specifies the image displayed in the normal
state.
COMMAND_PROP_CHECKED_IMAGE Specifies the image displayed in the checked
state.
Constant Description
DT_PICT A native picture resource from the dictionary.
DT_EXTERNAL_ICON An icon resource in an external resource
assembly.
Return value A boolean. The value true indicates the property was set, while the value
false indicates it was not.
result = Command_SetImageProperty(item_tag,COMMAND_PROP_NORMAL_IMAGE,
➥ 0, DT_PICT, image_ID);
result = Command_SetImageProperty(item_tag,
➥ COMMAND_PROP_NORMAL_IMAGE, 0, DT_EXTERNAL_ICON, image_ID);
80 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M M A N D _ S E T N A M E D P R O P E R T Y ()
Command_SetNamedProperty()
Description The Command_SetNamedProperty() function temporarily adds a property
with the specified name to a command. It then sets the value for the
property.
Parameters • command_tag – The integer tag value for the command for which a named
property is being added and set.
Return value A boolean indicating whether the named property was added and set. True
indicates the property was added and set, while false indicates it was not.
Comments The named property and its value are valid only for the current session of
the application. The named property can be retrieved with the
Command_GetNamedProperty() function.
Command_SetStringProperty()
Description The Command_SetStringProperty() function sets a specified string
property for a command.
Parameters • command_tag – The integer tag value for the command whose property is
being set.
Constant Description
COMMAND_PROP_DISPLAY_NAME The text used for the command name,
including any special characters.
COMMAND_PROP_TOOLTIP The tooltip displayed when the
command is used on a toolbar.
Return value A boolean indicating whether the property was set. True indicates the
property was set, while false indicates it was not.
82 F U N C T I O N L I B R A R Y R E F E R E N C E
Command bar function library
Refer to Chapter 18, Use the functions in this library to create toolbars for your application. This
“Toolbars,” in Volume library contains the following functions:
1 of the Dexterity Pro-
grammer’s Guide for • CommandBar_Create()
more information. • CommandBar_Destroy()
• CommandBar_GetPosition()
CommandBar_Create()
Description The CommandBar_Create() function creates a toolbar based on the
specified command list.
Parameters • command_list_tag – The integer tag value specifying the command list from
which the toolbar will be created.
• row – An optional integer that specifies the row that the toolbar will be
added to. The value 1 indicates the first row.
Return value An integer. The value 1 indicates the toolbar was created successfully.
Comments To use the sequence parameter when adding toolbars, start the value 1 for
the first toolbar you add, the value 2 for the second, and so on. A sequence
number shouldn’t repeat.
The row parameter specifies the row you want the toolbar to appear in. The
value 1 specifies being the first row. When adding toolbars, begin by adding
those in the first row (row value 1), then those in the second row (row value
2), and so on.
As the user rearranges toolbars, the sequence and row values adjust
automatically.
84 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M M A N D B A R _ C R E A T E ()
Examples The following example uses the CommandBar_Create() function to add the
toolbars for the Real Estate Sales Manager sample application. Notice how
the sequence and row parameters are used as the four toolbars are added.
The sequence values start at 1 and increment for each additional toolbar.
The first three toolbars appear on the first row, so the row parameter is 1.
The last toolbar is placed on the second row, so its row value is 2.
{View items}
result = CommandBar_Create(Command_GetTag(command CL_View of form
'Main Menu'),1, 1);
{Edit items}
result = CommandBar_Create(Command_GetTag(command cmdListEdit), 2,1);
{Report items}
result = CommandBar_Create(Command_GetTag(command CL_Reports of form
'Main Menu'),3,1);
{Export items}
result = CommandBar_Create(Command_GetTag(command CL_Export of form
'Main Menu'), 4, 2);
CommandBar_Destroy()
Description The CommandBar_Destroy() function removes a toolbar based on the
specified command list.
Syntax CommandBar_Destroy(command_list_tag)
Parameters • command_list_tag – The integer tag value specifying the command list that
the toolbar to be removed is based on.
86 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M M A N D B A R _ G E T P O S I T I O N ()
CommandBar_GetPosition()
Description The CommandBar_GetPosition() function retrieves the row and sequence
of a toolbar that is based on the specified command list.
Parameters • command_list_tag – The integer tag value specifying the command list that
the toolbar whose position is being retrieved is based on.
• row – A returned integer containing the row that the toolbar is in. The value
1 indicates the first row.
Return value A boolean. The value true indicates the position information was retrieved,
while false indicates it was not.
Comments This function is typically used to retrieve and save the positions of all the
toolbars currently displayed in an application. The position information is
later retrieved to re-create the same toolbar arrangement.
{View toolbar}
result = CommandBar_GetPosition(Command_GetTag(command CL_View of
➥ form 'Main Menu'), seq, row);
setting = str(resourceid(command CL_View of form 'Main Menu')) + "," +
➥ str(resourceid(form 'Main Menu')) + "," + str(row);
result = Defaults_Write("Toolbar"+str(seq), setting);
{Reports toolbar}
result = CommandBar_GetPosition(Command_GetTag(command CL_Reports of
➥ form 'Main Menu'), seq, row);
setting = str(resourceid(command CL_Reports of form 'Main Menu')) +
➥ "," + str(resourceid(form 'Main Menu')) + "," + str(row);
result = Defaults_Write("Toolbar"+str(seq), setting);
{Export toolbar}
result = CommandBar_GetPosition(Command_GetTag(command CL_Export of
➥ form 'Main Menu'), seq, row);
setting = str(resourceid(command CL_Export of form 'Main Menu')) + ","
➥ + str(resourceid(form 'Main Menu')) + "," + str(row);
result = Defaults_Write("Toolbar"+str(seq), setting);
88 F U N C T I O N L I B R A R Y R E F E R E N C E
Command list function library
Use the functions in this library to manage command list resources for your
application. This library contains the following functions:
• CommandList_Add()
• CommandList_CreateList()
• CommandList_FindCommand()
• CommandList_GetCommandByPosition()
• CommandList_NumCommands()
• CommandList_Remove()
• CommandList_RemoveAll()
• CommandList_RemoveCommandByPosition()
CommandList_Add()
Description The CommandList_Add() function adds a command or another command
list to the specified command list.
Parameters • command_list_tag – The integer tag value specifying the command list to
which a command or command list is being added.
• added_item – The integer tag value for the command or command list to be
added.
• position – An optional integer that specifies the location of the new item. The
value 1 indicates the first position. The value 0 indicates the end of the
command list.
Return value An integer specifying the position to which the item was added to the
command list.
Comments The command that defines the command list must already be defined in the
application. The form that contains the definition of the command list must
be open when the command list is used.
Examples The following example adds items to the CL_Tools command list, which is
used to define the Tools menu in an application. It also adds commands to
the CL_Export command list, which is used as a sub-menu for the Tools
menu.
90 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M M A N D L I S T _ A D D ()
CommandList_CreateList()
Description The CommandList_CreateList() function creates a command list and
associates it with a specific form. The command lists created with this
function are typically used for ribbons that are shown in the web client.
Parameters • product_ID – An integer specifying the product ID that contains the form for
which a command list is being created.
Return value An integer specifying the tag of the command list that is created for the
form.
in integer productId;
in integer formId;
in integer windowId;
in integer windowType;
inout integer ribbonTag;
92 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M M A N D L I S T _ C R E A T E L I S T ()
CommandList_FindCommand()
Description The CommandList_FindCommand() function retrieves the position of the
specified item in a command list.
Parameters • command_list_tag – The integer tag value specifying the command list in
which to search.
• item_tag – The integer tag value for the command or command list being
searched for.
Return value An integer specifying the location of the item. The value 0 indicates the item
was not found.
Examples The following example retrieves the position of the House command
(CMD_Houses) from the CL_View command list.
{Retrieve the tag values for the command list and the command}
command_list_tag = Command_GetTag(command CL_View of form
➥ 'Main Menu');
item_tag = Command_GetTag(command CMD_Houses of form 'Main Menu');
94 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M M A N D L I S T _ G E T C O M M A N D B Y P O S I T I O N ()
CommandList_GetCommandByPosition()
Description The CommandList_GetCommandByPosition() function retrieves the tag
for a command, based on the position in the command list.
Parameters • command_list_tag – The integer tag value specifying the command list in
which to search.
Return value An integer containing the command tag for the specified item. If the item
can’t be found, the value 0 is returned.
count = 0;
for i = 1 to CommandList_NumCommands(command_list_tag) do
{Get the tag for the list item}
item_tag = CommandList_GetCommandByPosition(command_list_tag, i);
CommandList_NumCommands()
Description The CommandList_NumCommands() function retrieves the number of
commands in the specified command list.
Syntax CommandList_NumCommands(command_list_tag)
Parameters • command_list_tag – The integer tag value specifying the command list for
which commands will be counted.
Examples The following example counts the number of commands in the CL_View
command list.
96 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M M A N D L I S T _ R E M O V E ()
CommandList_Remove()
Description The CommandList_Remove() function removes the specified item from a
command list.
Parameters • command_list_tag – The integer tag value specifying the command list from
which an item is being removed.
• item_tag – The integer tag value for the command or command list being
removed.
Return value A boolean. The value true indicates the item was removed, while false
indicates it was not.
Examples The following example removes the CMD_Houses command from the
CL_View command list.
CommandList_RemoveAll()
Description The CommandList_RemoveAll() function removes all items from the
specified command list.
Syntax CommandList_RemoveAll(command_list_tag)
Parameters • command_list_tag – The integer tag value specifying the command list from
which all items are being removed.
Return value A boolean. The value true indicates all items were removed, while false
indicates they were not.
Examples The following example removes all items from the CL_Tools command list.
98 F U N C T I O N L I B R A R Y R E F E R E N C E
C O M M A N D L I S T _ R E M O V E C O M M A N D B Y P O S I T I O N ()
CommandList_RemoveCommandByPosition()
Description The CommandList_RemoveCommandByPosition() function removes the
item from the specified position in a command list.
Parameters • command_list_tag – The integer tag value specifying the command list from
which an item is being removed.
Return value A boolean. The value true indicates the item was removed, while false
indicates it was not.
Examples The following example removes the third command from the CL_View
command list.
Refer to Chapter 41, You may not need to use all of the possible characteristics of a multiformat
“Modifying Fields,” in value. When a characteristic isn’t set for a specific multiformat value, the
Volume 1 of the operating system default for that characteristic will be used.
Dexterity Program-
mer’s Guide for This library contains the following functions:
information about
currency formats for • Currency_GetDecimalSymbol()
reports. • Currency_GetLeadingSymbol()
• Currency_GetLeadingZero()
• Currency_GetNativeSymbol()
• Currency_GetNegativeAfterValue()
• Currency_GetNegativeBeforeSymbol()
• Currency_GetNegativeParens()
• Currency_GetNegativeSymbol()
• Currency_GetNumberOfDecimals()
• Currency_GetSymbol()
• Currency_GetThousandsSymbol()
• Currency_SetDecimalSymbol()
• Currency_SetLeadingSymbol()
• Currency_SetLeadingZero()
• Currency_SetNegativeAfterValue()
• Currency_SetNegativeBeforeSymbol()
• Currency_SetNegativeParens()
• Currency_SetNegativeSymbol()
• Currency_SetNumberOfDecimals()
• Currency_SetSymbol()
• Currency_SetThousandsSymbol()
Currency_GetDecimalSymbol()
Description The Currency_GetDecimalSymbol() function returns the string used as a
decimal separator when the specified multiformat value is applied to a
currency field.
Syntax Currency_GetDecimalSymbol(multiformat_value)
Return value String. If a decimal symbol has not been defined for the specified
multiformat value, the operating system decimal symbol will be returned.
Examples The following example uses this function to return the string used as the
decimal separator for the multiformat value 3000.
dec_symbol = Currency_GetDecimalSymbol(3000);
102 F U N C T I O N L I B R A R Y R E F E R E N C E
C U R R E N C Y _ G E T L E A D I N G S Y M B O L ()
Currency_GetLeadingSymbol()
Description The Currency_GetLeadingSymbol() function returns a boolean value
indicating whether the currency symbol is positioned before the currency
value when the specified multiformat value is applied to a currency field.
Syntax Currency_GetLeadingSymbol(multiformat_value)
Return value Boolean. If true is returned, a leading currency symbol is used. If false is
returned, a trailing currency symbol is used.
Examples The following example uses this function to ascertain whether a leading or
trailing currency symbol is used with the multiformat value 3000.
use_leading = Currency_GetLeadingSymbol(3000);
Currency_GetLeadingZero()
Description The Currency_GetLeadingZero() function returns a boolean value
indicating whether a currency value less than 1 and greater than -1 will be
displayed with a leading zero when the specified multiformat value is
applied to a currency field.
Syntax Currency_GetLeadingZero(multiformat_value)
Return value Boolean. If true is returned, a leading zero is used. If false is returned, a
leading zero isn’t used.
Examples The following example uses this function to ascertain whether a leading
zero is used with the multiformat value 3000.
use_lead_zero = Currency_GetLeadingZero(3000);
104 F U N C T I O N L I B R A R Y R E F E R E N C E
C U R R E N C Y _ G E T N A T I V E S Y M B O L ()
Currency_GetNativeSymbol()
Description The Currency_GetNativeSymbol() function returns a platform-specific
string displaying the dollar, pound, yen or Euro currency symbol.
Syntax Currency_GetNativeSymbol(symbol)
Constant Description
DEX_DOLLAR_SYM The dollar symbol ($)
DEX_POUND_SYM The pound symbol (£)
DEX_YEN_SYM The yen symbol (¥)
DEX_EURO_SYM The Euro symbol (€)
Comments The various currency symbols are platform-specific. This function allows
your application to always retrieve the appropriate symbol, regardless of
which operating system is being used.
For platforms that cannot display the Euro symbol, the string EUR is
returned.
Currency_GetNegativeAfterValue()
Description The Currency_GetNegativeAfterValue() function returns a boolean value
indicating whether the negative symbol is placed after the currency value
when the specified multiformat value is applied to a currency field.
Syntax Currency_GetNegativeAfterValue(multiformat_value)
Return value Boolean. If true is returned, a trailing negative symbol is used. If false is
returned, a leading negative symbol is used.
Examples The following example uses this function to ascertain whether a trailing
negative symbol is used with the multiformat value 3000.
trailing_neg = Currency_GetNegativeAfterValue(3000);
106 F U N C T I O N L I B R A R Y R E F E R E N C E
C U R R E N C Y _ G E T N E G A T I V E B E F O R E S Y M B O L ()
Currency_GetNegativeBeforeSymbol()
Description The Currency_GetNegativeBeforeSymbol() function returns a boolean
value indicating whether a leading negative symbol is placed before a
leading currency symbol when the specified multiformat value is applied to
a currency field.
Syntax Currency_GetNegativeBeforeSymbol(multiformat_value)
Return value Boolean. If true is returned, a leading negative symbol precedes a leading
currency symbol. If false is returned, a leading negative symbol follows a
leading currency symbol.
Examples The following example uses this function to ascertain whether a leading
negative symbol precedes a leading currency symbol when the multiformat
value 3000 is used.
neg_before_symb = Currency_GetNegativeBeforeSymbol(3000);
Currency_GetNegativeParens()
Description The Currency_GetNegativeParens() function returns a boolean value
indicating whether parentheses are used to denote a negative currency
value when the specified multiformat value is applied to a currency field.
Syntax Currency_GetNegativeParens(multiformat_value)
Return value Boolean. If true is returned, parentheses are used to denote negative values.
If false is returned, parentheses aren’t used.
Examples The following example uses this function to ascertain whether parentheses
are used to denote a negative currency value when the multiformat value
3000 is used.
use_parens = Currency_GetNegativeParens(3000);
108 F U N C T I O N L I B R A R Y R E F E R E N C E
C U R R E N C Y _ G E T N E G A T I V E S Y M B O L ()
Currency_GetNegativeSymbol()
Description The Currency_GetNegativeSymbol() function returns the string that is
used as the negative symbol when the specified multiformat value is
applied to a currency field.
Syntax Currency_GetNegativeSymbol(multiformat_value)
Return value String. If parentheses are used to denote negative values when the specified
multiformat value is applied to a currency field, this function will not
return parentheses. It will return the string defined as a negative symbol
using the Currency_SetNegativeSymbol() function. If one wasn’t defined
using that function, the operating system’s default negative string, most
commonly a minus sign (-), will be returned.
Examples The following example uses this function to retrieve the string used as a
negative symbol when the multiformat value 3000 is used.
neg_string = Currency_GetNegativeSymbol(3000);
Currency_GetNumberOfDecimals()
Description The Currency_GetNumberOfDecimals() function returns the number of
digits that will appear to the right of a currency value’s decimal separator
when the specified multiformat value is applied to a currency field.
Syntax Currency_GetNumberOfDecimals(multiformat_value)
Return value Integer. If the number of decimal digits for use with the specified
multiformat value hasn’t been defined using the function
Currency_SetNumberOfDecimals(), the operating system’s default for
currency field decimal places will be used.
Comments This function ignores the currency format applied to the currency field’s
data type, should one exist.
Examples The following example uses this function to return the number of digits that
will appear to the right of the decimal separator when the multiformat
value 3000 is used.
dec_digits = Currency_GetNumberOfDecimals(3000);
110 F U N C T I O N L I B R A R Y R E F E R E N C E
C U R R E N C Y _ G E T S Y M B O L ()
Currency_GetSymbol()
Description The Currency_GetSymbol() function returns the string used as a currency
symbol when the specified multiformat value is applied to a currency field.
Syntax Currency_GetSymbol(multiformat_value)
Return value String. If a currency string or symbol has not been defined for the specified
multiformat value, the operating system’s currency string or symbol will be
returned.
Examples The following example uses this function to return the string used as a
currency symbol when the multiformat value 3000 is used.
c_symbol = Currency_GetSymbol(3000);
Currency_GetThousandsSymbol()
Description The Currency_GetThousandsSymbol() function returns the string used as
a thousands separator when the specified multiformat value is applied to a
currency field.
Syntax Currency_GetThousandsSymbol(multiformat_value)
Return value String. If a thousands separator has not been defined for the specified
multiformat value, the operating system’s thousands separator will be
returned.
Examples The following example uses this function to return the string used as a
thousands separator when the multiformat value 3000 is used.
thousands_symbol = Currency_GetThousandsSymbol(3000);
112 F U N C T I O N L I B R A R Y R E F E R E N C E
C U R R E N C Y _ S E T D E C I M A L S Y M B O L ()
Currency_SetDecimalSymbol()
Description The Currency_SetDecimalSymbol() function defines a string to use as a
decimal separator when the specified multiformat value is applied to a
currency field.
Parameters • multiformat_value – An integer value that you assign to the currency format
being defined. If your application is integrating with Microsoft Dynamics
GP (and your integrating dictionary has a product ID that is not zero), this
value must be in the 3000-4999 range. If you’re creating a stand-alone
application, this value must be in the 1000-2999 range.
Examples The following example could be used as part of the change script for the
save button in a window used to define currency formats. It uses this
function to define the decimal symbol string for the multiformat value 3000.
The value a user enters in the d_symbol field is used as the decimal_symbol
parameter. This function returns that specified value to the dec_symbol
field, which is then saved in the currency_format table.
Currency_SetLeadingSymbol()
Description The Currency_SetLeadingSymbol() function specifies whether the
currency symbol should appear before or after the value when the specified
multiformat value is applied to a currency field.
Parameters • multiformat_value – An integer value that you assign to the currency format
being defined. If your application is integrating with Microsoft Dynamics
GP (and your integrating dictionary has a product ID that is not zero), this
value must be in the 3000-4999 range. If you’re creating a stand-alone
application, this value must be in the 1000-2999 range.
Value Description
true A leading currency symbol will be used.
false A trailing currency symbol will be used.
Examples The following example is part of the change script for the save button in a
window used to define currency formats. It uses this function to define the
currency symbol placement for the multiformat value 3000, based upon
whether a user checked the lead_symbol check box. The result of this
function is set to the cs_placement field, which is saved in the
currency_format table.
114 F U N C T I O N L I B R A R Y R E F E R E N C E
C U R R E N C Y _ S E T L E A D I N G Z E R O ()
Currency_SetLeadingZero()
Description The Currency_SetLeadingZero() function defines whether a currency value
less than 1 and greater than -1 will be displayed with a leading zero when
the specified multiformat value is applied to a currency field.
Parameters • multiformat_value – An integer value that you assign to the currency format
being defined. If your application is integrating with Microsoft Dynamics
GP (and your integrating dictionary has a product ID that is not zero), this
value must be in the 3000-4999 range. If you’re creating a stand-alone
application, this value must be in the 1000-2999 range.
Value Description
true A leading zero will be used.
false A leading zero won’t be used.
Examples The following example is part of the change script for the save button in a
window used to define currency formats. It uses this function to define
whether a leading zero will be used for the multiformat value 3000, based
upon whether a user checked the use_zero check box. The result of this
function is set to the lead_zero field, which is saved in the currency_format
table.
Currency_SetNegativeAfterValue()
Description The Currency_SetNegativeAfterValue() function defines whether the
negative symbol should be placed after the value when the specified
multiformat value is applied to a currency field.
Parameters • multiformat_value – An integer value that you assign to the currency format
being defined. If your application is integrating with Microsoft Dynamics
GP (and your integrating dictionary has a product ID that is not zero), this
value must be in the 3000-4999 range. If you’re creating a stand-alone
application, this value must be in the 1000-2999 range.
Value Description
true A trailing negative symbol will be used.
false A leading negative symbol will be used.
Examples The following example is part of the change script for the save button in a
window used to define currency formats. It uses this function to define
whether a trailing negative symbol will be used for the multiformat value
3000, based upon whether a user checked the use_trailing check box. The
result of this function is set to the trailing_neg_sym field, which is saved in
the currency_format table.
116 F U N C T I O N L I B R A R Y R E F E R E N C E
C U R R E N C Y _ S E T N E G A T I V E A F T E R V A L U E ()
Currency_SetNegativeBeforeSymbol()
Description The Currency_SetNegativeBeforeSymbol() function defines whether a
leading negative symbol should be placed before or after a leading currency
symbol when the specified multiformat value is applied to a currency field.
Parameters • multiformat_value – An integer value that you assign to the currency format
being defined. If your application is integrating with Microsoft Dynamics
GP (and your integrating dictionary has a product ID that is not zero), this
value must be in the 3000-4999 range. If you’re creating a stand-alone
application, this value must be in the 1000-2999 range.
Value Description
true A leading negative symbol will be placed before a
leading currency symbol.
false A leading negative symbol will be placed after a
leading currency symbol.
Comments If this function is used, it will be overridden by the following settings if they
are used and set to true:
• Currency_SetNegativeParens()
• Currency_SetNegativeAfterValue()
If the operating system’s default format for currency values places the
negative symbol after the currency value, you must set the
Currency_SetNegativeAfterValue() function to false to override the
operating system default. Until this occurs, the negative symbol placement
you specify will not be used.
118 F U N C T I O N L I B R A R Y R E F E R E N C E
C U R R E N C Y _ S E T N E G A T I V E B E F O R E S Y M B O L ()
Examples The following example is part of the change script for the save button in a
window used to define currency formats. It uses this function to define the
position of a leading negative symbol for the multiformat value 3000, based
upon whether a user checked the neg_first check box. The result of this
function is set to the lead_neg_position field, which is saved in the
currency_format table.
Currency_SetNegativeParens()
Description The Currency_SetNegativeParens() function defines whether parentheses
should be used to denote a negative value when the specified multiformat
value is applied to a currency field.
Parameters • multiformat_value – An integer value that you assign to the currency format
being defined. If your application is integrating with Microsoft Dynamics
GP (and your integrating dictionary has a product ID that is not zero), this
value must be in the 3000-4999 range. If you’re creating a stand-alone
application, this value must be in the 1000-2999 range.
Value Description
true Parentheses will be used.
false Parentheses won’t be used.
Comments If this function is used, it will override settings made by the following
functions:
• Currency_SetNegativeAfterValue()
• Currency_SetNegativeBeforeSymbol()
• Currency_SetNegativeSymbol()
120 F U N C T I O N L I B R A R Y R E F E R E N C E
C U R R E N C Y _ S E T N E G A T I V E P A R E N S ()
Examples The following example is part of the change script for the save button in a
window used to define currency formats. It uses this function to define
whether parentheses will be used for the multiformat value 3000, based
upon whether a user checked the neg_parens check box. The result of this
function is set to the use_neg_parens field, which is saved in the
currency_format table.
Currency_SetNegativeSymbol()
Description The Currency_SetNegativeSymbol() function defines a string to be used as
a negative symbol when the specified multiformat value is applied to a
currency field.
Parameters • multiformat_value – An integer value that you assign to the currency format
being defined. If your application is integrating with Microsoft Dynamics
GP (and your integrating dictionary has a product ID that is not zero), this
value must be in the 3000-4999 range. If you’re creating a stand-alone
application, this value must be in the 1000-2999 range.
Examples The following example is part of the change script for the save button in a
window used to define currency formats. It uses this function to define a
string to be used as the negative symbol for the multiformat value 3000,
based upon a value entered in the neg_symbol field. The result of this
function is set to the negative_string field, which is saved in the
currency_format table.
122 F U N C T I O N L I B R A R Y R E F E R E N C E
C U R R E N C Y _ S E T N U M B E R O F D E C I M A L S ()
Currency_SetNumberOfDecimals()
Description The Currency_SetNumberOfDecimals() function defines the number of
digits that will appear to the right of the decimal separator when the
specified multiformat value is applied to a currency field.
Parameters • multiformat_value – An integer value that you assign to the currency format
being defined. If your application is integrating with Microsoft Dynamics
GP (and your integrating dictionary has a product ID that is not zero), this
value must be in the 3000-4999 range. If you’re creating a stand-alone
application, this value must be in the 1000-2999 range.
Comments If this function isn’t used, the operating system’s default for currency
decimal places will be used, not the number of places specified in the
format defined for the data type the currency field is based upon.
Examples The following example uses this function to define the number of decimal
digits to be used for the multiformat value 3000. The value a user enters in
the digits field is used as the dec_digits parameter. This function returns the
specified value to the dec_number field, which is then saved in the
currency_format table.
Currency_SetSymbol()
Description The Currency_SetSymbol() function defines a string to use as a currency
symbol when the specified multiformat value is applied to a currency field.
Parameters • multiformat_value – An integer value that you assign to the currency format
being defined. If your application is integrating with Microsoft Dynamics
GP (and your integrating dictionary has a product ID that is not zero), this
value must be in the 3000-4999 range. If you’re creating a stand-alone
application, this value must be in the 1000-2999 range.
Examples The following example uses this function to define the currency symbol
string for the multiformat value 3000. The value a user enters in the
c_symbol field is used as the currency_symbol parameter. This function
returns the specified value to the curr_symbol field, which is then saved in
the currency_format table.
124 F U N C T I O N L I B R A R Y R E F E R E N C E
C U R R E N C Y _ S E T T H O U S A N D S S Y M B O L ()
Currency_SetThousandsSymbol()
Description The Currency_SetThousandsSymbol() function defines a string to use as a
thousands separator when the specified multiformat value is applied to a
currency field.
Parameters • multiformat_value – An integer value that you assign to the currency format
being defined. If your application is integrating with Microsoft Dynamics
GP (and your integrating dictionary has a product ID that is not zero), this
value must be in the 3000-4999 range. If you’re creating a stand-alone
application, this value must be in the 1000-2999 range.
Examples The following example uses this function to define the thousands separator
for the multiformat value 3000. The value a user enters in the t_symbol field
is used as the thousands_symbol parameter. This function returns the
specified value to the thou_symbol field, which is then saved in the
currency_format table.
Defaults_ClearUserFile()
Description The Defaults_ClearUserFile() function clears the contents of the user-
specifc DEX.INI file.
Parameters • None
128 F U N C T I O N L I B R A R Y R E F E R E N C E
D E F A U L T S _ R E A D ()
Defaults_Read()
Description The Defaults_Read() function reads the value of a setting in the Dexterity
defaults file.
Constant Description
USER_INI Accesses the user-specific DEX.INI file, found in the user’s
temporary folder.
GLOBAL_INI Accesses the global DEX.INI file, found in the Data folder
of the application.
When specifying the optional target parameter, you can add the constant
values together (USER_INI + GLOBAL_INI) to read the value from the
user-specific DEX.INI file, and then from the global DEX.INI file. This is the
default behavior when the per-user defaults file is enabled, and you don’t
specify the target.
Return value A string indicating the value of setting. If the setting doesn’t exist, the
returned string will be empty.
Examples The following example reads the value of the Pathname setting in the
defaults file and sets a window field.
'Pathname' = Defaults_Read("Pathname");
Defaults_ReadBoolean()
Description The Defaults_ReadBoolean() function reads a boolean value from the
Defaults file.
Constant Description
USER_INI Accesses the user-specific DEX.INI file, found in the user’s
temporary folder.
GLOBAL_INI Accesses the global DEX.INI file, found in the Data folder
of the application.
When specifying the optional target parameter, you can add the constant
values together (USER_INI + GLOBAL_INI) to read the value from the
user-specific DEX.INI file, and then from the global DEX.INI file. This is the
default behavior when the per-user defaults file is enabled, and you don’t
specify the target.
Return value A boolean containing the value. If the setting isn’t found, the default
boolean value is returned.
Comments The string value retrieved from the defaults file is converted to uppercase
and compared with the string “TRUE”. If the strings match, then true is
returned. Otherwise, false is returned.
130 F U N C T I O N L I B R A R Y R E F E R E N C E
D E F A U L T S _ R E A D C O L O R ()
Defaults_ReadColor()
Description The Defaults_ReadColor() function reads a color value from the Defaults
file.
Constant Description
USER_INI Accesses the user-specific DEX.INI file, found in the user’s
temporary folder.
GLOBAL_INI Accesses the global DEX.INI file, found in the Data folder
of the application.
When specifying the optional target parameter, you can add the constant
values together (USER_INI + GLOBAL_INI) to read the value from the
user-specific DEX.INI file, and then from the global DEX.INI file. This is the
default behavior when the per-user defaults file is enabled, and you don’t
specify the target.
Return value A long integer containing the color value. If the setting isn’t found, the
default color value is returned.
Comments The color value in the defaults file can be the name of a predefined
Dexterity color. It can also be a color value in decimal or hexadecimal
format. The following table lists the predefined color names for Dexterity.
132 F U N C T I O N L I B R A R Y R E F E R E N C E
D E F A U L T S _ R E A D K E Y S ()
Defaults_ReadKeys()
Description The Defaults_ReadKeys() function reads all of the key values in the
specified DEX.INI file.
Parameters • key_list – A list field that will contain the key values that were retrieved
from the specified DEX.INI file.
Constant Description
USER_INI Accesses the user-specific DEX.INI file, found in the user’s
temporary folder.
GLOBAL_INI Accesses the global DEX.INI file, found in the Data folder
of the application.
Return value A boolean. The value true indicates that the key values were retrieved. The
value false indicates that an error occurred.
Examples The following example shows a script that is run when a different user is
logging into a stand-alone application. If the user-specific defaults file is
being used, then the Defaults_ReadKeys() function settings reads the keys
from that file, and a helper procedure saves the values to the appropriate
table in the database. Finally, the Defaults_ClearUserFile() function
removes the user’s settings from the defaults file to prepare it for the new
user that is logging in.
database.}
call SaveINIValues, '(L) KeyValues', UserID of globals;
end if;
end if;
134 F U N C T I O N L I B R A R Y R E F E R E N C E
D E F A U L T S _ W R I T E ()
Defaults_Write()
Description The Defaults_Write() function writes a setting to the Dexterity defaults file.
Parameters • setting – A string indicating the setting in the file you want to write to. If
setting doesn’t exist, one is created.
Constant Description
USER_INI Accesses the user-specific DEX.INI file, found in the user’s
temporary folder.
GLOBAL_INI Accesses the global DEX.INI file, found in the Data folder
of the application.
If the per-user defaults file is not enabled, the setting will be written to the
global DEX.INI file found in the Data folder of the application. If the per-
user defaults file is enabled, but the target is not specified, the value will be
written to the user-specific DEX.INI file.
Examples This example writes a new pathname to the Pathname setting in the global
defaults file. It opens a dialog box using the Path_SelectPathname()
function, and returns a pathname. The Defaults_Write() function then
writes this pathname to the Pathname setting in the global defaults file.
DexObject_AddMethod()
Description The DexObject_AddMethod() function adds a method to a callback object.
• method_name – A string specifying the name for the method. Each method
in the callback object must have a unique name.
• function script – A user-defined function that is run when the method in the
callback object is invoked.
Return value A boolean indicating whether the method was added. True indicates that
the method was added, while false indicates that it was not.
Comments If you are creating a callback object to handle events from another
application, be sure the method has exactly the same name as the
corresponding method in the COM interface for that application. The name
is case-sensitive.
Examples The following example creates a callback object that allows external
applications to access information about the user currently logged into the
application. The DexObject_AddMethod() function is used to add the
“VerifyPassword” method to the callback object. A user-defined function
with the name “VerifyPassword” has already been added to the application,
and will be run when the VerifyPassword method is invoked.
138 F U N C T I O N L I B R A R Y R E F E R E N C E
D E X O B J E C T _ A D D M E T H O D ()
The following example creates an event handler for the Activate event of
the currently active workbook in Microsoft Excel. It uses the
DexObject_AddMethod() function to add the “Activate” method to the
callback object. Because the method is being used in a callback to handle the
“Activate” event, the name must match the event name specified in the
type library for Excel.
DexObject_AddProperty()
Description The DexObject_AddProperty() function adds a property to a callback
object.
• name – A string specifying the name for the property being added to the
callback. Each property in the callback object must have a unique name.
• type – An integer that specifies the property type. The following values are
valid types.
DATATYPE_BOOLEAN DATATYPE_INTEGER
DATATYPE_CURRENCY DATATYPE_LONG_INTEGER
DATATYPE_VCURRENCY DATATYPE_REFERENCE
DATATYPE_DATE DATATYPE_STRING
DATATYPE_DATETIME DATATYPE_TIME
• dispatch_id - An optional long integer that specifies the identifier for the
property. It is typically represented as a hexadecimal value.
Return value A boolean indicating whether the property was added. True indicates that
the property was added, while false indicates that it was not.
Comments If you are creating a callback object to handle events from another
application, be sure the property has exactly the same name as the
corresponding property in the COM interface for that application. The
name is case-sensitive.
140 F U N C T I O N L I B R A R Y R E F E R E N C E
D E X O B J E C T _ A D D P R O P E R T Y ()
Examples The following example creates a callback object that allows external
applications to access information about the user currently logged into the
application. The DexObject_AddProperty() function is used to add the
“UserID” and “Name” properties to the callback object.
DexObject_Create()
Description The DexObject_Create() function creates a callback object.
Syntax DexObject_Create()
Parameters • None
142 F U N C T I O N L I B R A R Y R E F E R E N C E
Dictionary function library
Use the functions in this library when working with dictionaries in your
application. This library contains the following functions:
• Dict_CountCustomResource()
• Dict_GetCustomResourceInfo()
• Dict_GetName()
• Dict_GetPathname()
• Dict_LockCustom()
• Dict_UnlockCustom()
• Dict_UpdateFormsDictionary()
• Dict_UpdateReportsDictionary()
These functions read information about the resources in the forms and
reports dictionaries for an application.
• Dict_CountCustomResource()
• Dict_GetCustomResourceInfo()
• Dict_LockCustom()
• Dict_UnlockCustom()
Refer to Chapter 60, These functions update the forms and reports dictionaries when you
“Updating an Applica- upgrade your application from one version to the next. Typically, these
tion,” in Volume 1 of functions are used in a utility application that migrates users from the
the Dexterity Program- current version of your application to the next version.
mer's Guide for more
information about • Dict_UpdateFormsDictionary()
updating applications. • Dict_UpdateReportsDictionary()
Dict_CountCustomResource()
Description The Dict_CountCustomResource() function returns the number of forms in
the forms dictionary, or the number of reports in the reports dictionary.
Constant Description
REPORTTYPE Count reports in the reports dictionary.
FORMTYPE Count forms in the forms dictionary.
Return value An integer indicating the number of forms or reports in the forms or reports
dictionary.
Counting forms or reports in a custom dictionary will work only if your application
is opened with the runtime engine. Dexterity test mode has no provisions for
accessing information for forms and reports dictionaries.
144 F U N C T I O N L I B R A R Y R E F E R E N C E
D I C T _ C O U N T C U S T O M R E S O U R C E ()
Dict_GetCustomResourceInfo()
Description The Dict_GetCustomResourceInfo() function returns information about a
form in a forms dictionary, or a report in a reports dictionary.
Constant Description
REPORTTYPE Indicates a report resource type.
FORMTYPE Indicates a form resource type.
• series – An integer specifying the series from which you want to retrieve
form or report information. The following table lists all series that can be
applied to forms and reports and their corresponding integer values.
Return value An integer containing the resource ID for the form or report for which
information was retrieved.
146 F U N C T I O N L I B R A R Y R E F E R E N C E
D I C T _ G E T C U S T O M R E S O U R C E I N F O ()
Counting forms or reports in a custom dictionary will work only if your application
is opened with the runtime engine. Dexterity test mode has no provisions for
accessing information for forms and reports dictionaries.
Dict_GetName()
Description The Dict_GetName() function returns the operating system name of the
current application dictionary.
Syntax Dict_GetName()
Parameters • None
Comments This function returns the operating system name of the “current”
application dictionary. In a multidictionary environment, this is the
dictionary whose form is currently active, or topmost.
Examples This example sets a window field to the name of the current dictionary:
148 F U N C T I O N L I B R A R Y R E F E R E N C E
D I C T _ G E T P A T H N A M E ()
Dict_GetPathname()
Description The Dict_GetPathname() function returns the generic path of various
components of the current installation, such as the runtime engine or
launch file.
Syntax Dict_GetPathname(option)
Comments The path that’s returned is in a generic format. Generic pathnames use a
colon (:) before and after DOS drive letters. The characters that separate
folders and directories are forward slashes (/).
Examples This example sets a window field to the path that contains the current
application dictionary or launch file being used:
'(L) Pathname' = Dict_GetPathname(PATH_SETFOLDER);
Dict_LockCustom()
Description The Dict_LockCustom() function attempts to open a forms or reports
dictionary. If it can, it locks the dictionary, preventing other users from
accessing the dictionary.
Value Description
0 No error
1 No dictionary
2 Unable to open
If the result is no error (0), the forms dictionary is opened and locked.
Value Description
0 No error
1 No dictionary
2 Unable to open
If the result is no error (0), the reports dictionary is opened and locked.
Return value A boolean representing the result; true only if both the forms and reports
dictionaries are available, and false if one or both are unavailable.
This function will work only if your application is opened with the runtime engine.
Dexterity test mode has no provisions for accessing information for forms and
reports dictionaries.
150 F U N C T I O N L I B R A R Y R E F E R E N C E
D I C T _ U N L O C K C U S T O M ()
Dict_UnlockCustom()
Description The Dict_UnlockCustom() function releases the dictionary lock imposed
by the Dict_LockCustom() function.
Syntax Dict_UnlockCustom(product_ID)
Comments Always unlock any custom dictionary opened and locked using the
Dict_LockCustom() function.
Dict_UpdateFormsDictionary()
Description The Dict_UpdateFormsDictionary() function updates a forms dictionary to
work with the new version of your application. This function attempts to
preserve the modifications made to the forms in the forms dictionary.
Syntax Dict_UpdateFormsDictionary(main_product_dictionary,
previous_application_dictionary, new_application_dictionary, forms_dictionary,
exception_script, progress_script)
Constant Description
STATUS_SUCCESS No error occurred.
STATUS_PRIMARY_DICT_MISSING Unable to open main product dictionary.
STATUS_OLD_PROD_DICT_MISSING Unable to open previous application dictionary.
STATUS_NEW_PROD_DICT_MISSING Unable to open new application dictionary.
STATUS_FORM_DICT_MISSING Unable to open forms dictionary.
STATUS_VERSION_INCOMPATIBLE The forms dictionary is not compatible with the
previous application dictionary.
STATUS_ERROR An unknown error occurred.
152 F U N C T I O N L I B R A R Y R E F E R E N C E
D I C T _ U P D A T E F O R M S D I C T I O N A R Y ()
Examples The following example updates the forms dictionary for the RESM sample
application. The exception and progress scripts are part of the
Progress_Control form, which will show the progress of the update process.
The previous version of the application was renamed RESM4.DIC. All
dictionaries needed to perform the update are in the same location as the
runtime engine.
154 F U N C T I O N L I B R A R Y R E F E R E N C E
D I C T _ U P D A T E F O R M S D I C T I O N A R Y ()
Dict_UpdateReportsDictionary()
Description The Dict_UpdateReportsDictionary() function updates a reports
dictionary to work with the new version of your application. This function
attempts to preserve the modifications made to the reports in the reports
dictionary. The update is performed in two parts. The first part updates
resources in the reports dictionary. The second part updates reports to make
them compatible with database changes in the application.
Syntax Dict_UpdateReportsDictionary(main_product_dictionary,
previous_application_dictionary, new_application_dictionary, reports_dictionary,
exception_script, progress_script, from_version, to_version, input_file,
output_file)
156 F U N C T I O N L I B R A R Y R E F E R E N C E
D I C T _ U P D A T E R E P O R T S D I C T I O N A R Y ()
• to_version – A string specifying the product version to update to. This value
is used to indicate which sections of the input file will be used when
performing the second part of the report update. If you want the second
part of the report update process to simply perform a “cleanup” operation,
specify the empty string ("") for this parameter.
Constant Description
STATUS_SUCCESS No error occurred.
STATUS_PRIMARY_DICT_MISSING Unable to open main product dictionary.
STATUS_OLD_PROD_DICT_MISSING Unable to open previous application dictionary.
STATUS_NEW_PROD_DICT_MISSING Unable to open new application dictionary.
STATUS_REPORT_DICT_MISSING Unable to open reports dictionary.
STATUS_ERROR_OPENING_LOG Unable to open the log file.
STATUS_ERROR_OPENING_INPUT Unable to open the input file.
STATUS_INPUT_FILE_ERROR An error exists in the input file contents.
STATUS_VERSION_INCOMPATIBLE The reports dictionary is not compatible with the
previous application dictionary.
STATUS_ERROR An unknown error occurred.
Comments The first part of the the updating operation performed by this function is
also performed automatically during the unchunking process. If the first
part of the report update (updating resources in the reports dictionary) was
performed as part of unchunking, we recommend that you use the
Dict_UpdateReportsDictionary() function in an installation script to
perform the second part of the update process. If you haven’t made any
database changes or don’t have an input file, we still recommend
performing the second part of the update because it performs some
“cleanup” operations on the reports dictionary.
158 F U N C T I O N L I B R A R Y R E F E R E N C E
D I C T _ U P D A T E R E P O R T S D I C T I O N A R Y ()
Examples The following example shows how you would update the reports
dictionary for the RESM sample application. The exception and progress
scripts are part of the Progress_Control form, which will show the progress
of the update process. The previous version of the application was renamed
RESM4.DIC. All dictionaries needed to perform the update are in the same
location as the runtime engine.
in [STATUS_REPORT_DICT_MISSING]
error "Could not open the reports dictionary.";
in [STATUS_ERROR_OPENING_LOG]
error "Could not open the log file.";
in [STATUS_ERROR_OPENING_INPUT]
error "Could not open the input file.";
in [STATUS_INPUT_FILE_ERROR]
error "An error was found in the input file.";
in [STATUS_ERROR]
error "An unknown error occurred during the update process.";
end case;
160 F U N C T I O N L I B R A R Y R E F E R E N C E
Exception function library
Refer to Chapter 26, Use the functions in this library when implementing exception handling in
“Structured Exception your application. The functions in this library are used to retrieve
Handler,” in Volume 2 information about an exception that was thrown. This library contains the
of the Dexterity following functions:
Programmer’s Guide
for more information • Exception_Class()
about exception • Exception_ClassName()
handling. • Exception_Message()
• Exception_Product()
• Exception_ProductName()
• Exception_SubClass()
• Exception_SubClassName()
Exception_Class()
Description The Exception_Class() function returns the class of the current exception.
Syntax Exception_Class()
Parameters • None
Return value A long integer containing the class of the current exception.
Comments The Exception_Class() function must be used in the catch or else block of
the try...end try statement.
Examples This procedure contains sanScript code to handle the exception that can
occur when you reference an invalid form by name. If an invalid name is
supplied to the open form with name statement, a system exception is
thrown. If any other exception is thrown, the Exception_Product(),
Exception_Class(), Exception_SubClass(), and Exception_Message()
functions are used to retrieve information about the exception. If the
exception was thrown by another product, the exception is rethrown.
Otherwise, information about the exception is displayed.
in string form_name;
try
{Open the named form.}
open form with name form_name;
catch [EXCEPTION_CLASS_FORM_MISSING]
{Catch the exception if the form is missing.}
error "Cannot find the form " + form_name + ". Error in script "+
➥ _script_ + ".";
else
{Some other exception occurred.}
if Exception_Product() = 3333 then
{It's our exception. Display information.}
error "An unknown exception occurred. Class: " +
➥ str(Exception_Class()) + " Subclass: " +
➥ str(Exception_SubClass()) + " Message:" +
➥ Exception_Message();
else
{It's not our exception. Rethrow it.}
throw;
end if;
end try;
162 F U N C T I O N L I B R A R Y R E F E R E N C E
E X C E P T I O N _ C L A S S N A M E ()
Exception_ClassName()
Description The Exception_ClassName() function returns a string containing the
constant for the class of the current system exception.
Syntax Exception_ClassName({class})
Parameters • class – An optional long integer containing the value of a system exception
class. If this parameter is supplied, the constant for the specified system
exception class will be returned.
Comments Use the class parameter with this function when you know the long integer
class value of a system exception, but want a string containing the constant
for the exception class.
If you include the class parameter, you can use this function anywhere in
your code. If you don’t include the class parameter, you can use this
function only in a catch or else block of a try...end try statement.
Examples Several system exceptions have been logged and saved in a table.
The contents of this table are displayed in a scrolling window.
The following is the fill script for the scrolling window. As records
are read from the Exception_Log table, the Exception_ClassName(),
Exception_SubClassName() and Exception_ProductName() functions
convert the exception class, subclass and product values into strings that
are displayed in the scrolling window.
Exception_Message()
Description The Exception_Message() function returns a string describing the current
exception.
Syntax Exception_Message()
Parameters • None
Return value A text value containing a message describing the current exception.
Comments The Exception_Message() function must be used in the catch or else block
of the try...end try statement.
164 F U N C T I O N L I B R A R Y R E F E R E N C E
E X C E P T I O N _ P R O D U C T ()
Exception_Product()
Description The Exception_Product() function returns the ID of the product that threw
the current exception.
Syntax Exception_Product()
Parameters • None
Return value An integer containing the ID of the product that threw the current
exception.
Comments The Exception_Product() function must be used in the catch or else block of
the try...end try statement.
Exception_ProductName()
Description The Exception_ProductName() function returns a string containing the
name of the product that threw the current exception.
Syntax Exception_ProductName({product_ID})
Comments Use the product_ID parameter with this function when you know the
product ID, but need a string containing the name of the product.
If you include the product_ID parameter, you can use this function
anywhere in your code. If you don’t include the product_ID parameter, you
can use this function only in a catch or else block of a try...end try
statement.
166 F U N C T I O N L I B R A R Y R E F E R E N C E
E X C E P T I O N _ S U B C L A S S ()
Exception_SubClass()
Description The Exception_SubClass() function returns the subclass of the current
exception.
Syntax Exception_SubClass()
Parameters • None
Return value A long integer containing the subclass of the current exception.
Comments The Exception_SubClass() function must be used in the catch or else block
of the try...end try statement.
Exception_SubClassName()
Description The Exception_SubClassName() function returns a string containing the
constant for the subclass of the current system exception.
Parameters • class – An optional long integer containing the value of a system exception
class.
Comments Use the class and subclass parameters with this function when you know the
long integer values of a system exception class and subclass, but need a
string containing the constant for the system exception subclass.
If you include the class and subclass parameters, you can use this function
anywhere in your code. If you don’t include the class and subclass
parameters, you can use this function only in a catch or else block of a
try...end try statement.
168 F U N C T I O N L I B R A R Y R E F E R E N C E
Field function library
Use the functions in this library to work with fields. This library contains
the following functions:
• Field_BDLAddToSubmenu()
• Field_BDLCreateLinkedCommandList()
• Field_BDLCreateSubmenu()
• Field_BDLGetLinkedItemCommandTag()
• Field_CreateLinkedCommand()
• Field_GetBooleanProperty()
• Field_GetCaption()
• Field_GetColor()
• Field_GetFont()
• Field_GetImage()
• Field_GetInsertPosFromVisualPos()
• Field_GetIntegerProperty()
• Field_GetLinkedCommandTag()
• Field_GetPosition()
• Field_GetRequiredStatus()
• Field_GetSelection()
• Field_GetSize()
• Field_GetStringProperty()
• Field_GetToolTip()
• Field_GetVisualPosFromInsertPos()
• Field_InsertStringInText()
• Field_MarkListItems()
• Field_ParseText()
• Field_SetAltLineColor()
• Field_SetBackColor()
• Field_SetBooleanProperty()
• Field_SetCaption()
• Field_SetCustomPromptFormat()
• Field_SetFont()
• Field_SetFontColor()
• Field_SetFontSize()
• Field_SetFontStyle()
• Field_SetImage()
• Field_SetIntegerProperty()
• Field_SetPattern()
• Field_SetPatternColor()
• Field_SetRequiredFormat()
• Field_SetRequiredStatus()
170 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ B D L A D D T O S U B M E N U ()
Field_BDLAddToSubmenu()
Description The Field_BDLAddToSubmenu() function adds an item to a submenu of a
button drop list control.
• parent_ID – The ID of the submenu to which the new item is being added.
Use the constant BDL_ROOT if the item is being added at the first level of
the button drop list.
• value – An optional long integer value that will be associated with new
item. If this parameter isn’t used, 0 will be associated with the new item.
Return value A boolean indicating the result; true indicates the item was successfully
added, while false indicates it was not.
Comments Each new item will be added to the end of the specified button drop list or
submenu. The numeric position assigned to the new item is based on the
order items were added to the button drop list.
Field_BDLCreateLinkedCommandList()
Description The Field_BDLCreateLinkedCommandList() function creates a command
list based on the button drop list window field specified. This function is
used only in the InitializeRibbon procedure for a form.
Parameters • field – The button drop list field for which the command list is being created.
• command_name – A string value that supplies a name for the command list
that is being created. Typically, a string with the fully-qualified name of the
button drop list is used.
• hide_field – An optional boolean that indicates whether the button drop list
field will be hidden on the window when the command list is created. If
you do not supply this parameter, the button drop list will always be
hidden when this function is used for the web client.
Return value An integer containing the command tag for the command list that is
created.
• A link is established between the button drop list and the command list.
This link is valid as long as the form remains open.
After the command list for the button drop list has been created, the content
of the button drop list should be considered static. Do not add or remove
items from the corresponding button drop list.
The command list that is created will not have its display name set. If you
want to display the command list in the ribbon, you should use the
Command_GetStringProperty() function to set the display name for the
command list.
172 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ B D L C R E A T E S U B M E N U ()
Field_BDLCreateSubmenu()
Description The Field_BDLCreateSubmenu() function adds a submenu to a button
drop list control.
• value – An optional long integer value that will be associated with submenu
item. If this parameter isn’t used, 0 will be associated with the submenu
item.
Comments Each new submenu will be added to the end of the specified button drop
list or submenu.
Examples The following example creates the items for the Reports button drop list.
Notice that there are data items associated with each item added to the
button drop list. These data items will be used to find out the item chosen
when the user makes a selection.
The following is the change script for the button drop list. It shows how the
data item can be retrieved from the item selected in the button drop list. The
data item can then be used to perform the appropriate action in the
application.
174 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ B D LG E T L I N K E D I T E M C O M M A N D T A G ()
Field_BDLGetLinkedItemCommandTag()
Description The Field_BDLGetLinkedItemCommandTag() function retrieves the
command tag for a button drop list item that is part of the command list
that was created for the button drop list by the
Field_BDLCreateLinkedCommandList() function.
Return value An integer containing the command tag for the button drop list item.
Field_CreateLinkedCommand()
Description The Field_CreateLinkedCommand() function creates a command based on
the window field specified. Typically, this will be a push button field on the
window. This function is used only in the InitializeRibbon procedure for a
form.
Parameters • field – The field for which the command is being created.
• command_name – A string value that supplies a name for the command that
is being created. Typically, a string with the fully-qualified name of the field
is used.
Return value An integer containing the command tag for the command that is created.
• A link is established between the field and the command. This link is
valid as long as the form remains open.
The command that is created will not have its display name set. If you want
to display the command in the ribbon, you should use the
Command_GetStringProperty() function to set the display name for the
command.
Examples The following example is the InitializeRibbon procedure for an About Box
form. This procedure creates a custom ribbon that is shown when the form
is displayed in the Microsoft Dynamics GP web client. The procedure uses
the Field_CreateLinkedCommand() function to create a command based
on the Close box that is in the window. The command is used in the ribbon.
176 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ C R E A T E L I N K E D C O M M A N D ()
in integer productId;
in integer formId;
in integer windowId;
in integer windowType;
inout integer ribbonTag;
Field_GetBooleanProperty()
Description The Field_GetBooleanProperty() function retrieves a specified boolean
property for a field.
Constant Description
FIELD_PROP_AUTOCOMPLETE True if the string field has AutoComplete
enabled. False if it does not.
FIELD_PROP_BDL_DROP_INDICATOR True if the drop indicator for a button drop list
is displayed. False if it is not.
FIELD_PROP_CANCEL True if the field is the Default Cancel for the
window. False if it is not.
FIELD_PROP_DEFAULT True if the field is the Default OK field for the
window. False if it is not.
FIELD_PROP_DISABLED True if the field is disabled. False if it is not.
FIELD_PROP_EDITABLE True if the field is editable. False otherwise.
FIELD_PROP_FOCUS True if the field currently contains the focus.
False if it does not. This property is
independent of whether the window is active
or inactive.
FIELD_PROP_HYPERSPACE True if the field is marked as Hyperspace. False
if it is not.
FIELD_PROP_LOCKED True if the field is locked. False if it is not.
FIELD_PROP_REQUIRED True if the field is required. False if it is not.
FIELD_PROP_SURROUNDING_BOX True if the field is drawn with a border. False if
it is not.
FIELD_PROP_TAB_STOP True if the field is in the tab sequence. False if it
is not.
FIELD_PROP_VISIBLE True if the field is visiable. False if it is not.
FIELD_PROP_ZOOM True if the field is set to show the zoom pointer.
False if it is not.
178 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ G E T B O O L E A N P R O P E R T Y ()
Be aware that the required() function will not consider disabled fields
required, even though they have the Required property set to true.
However, the value retrieved from the FIELD_PROP_REQUIRED property
will be true, even if the field is disabled.
Field_GetCaption()
Description The Field_GetCaption() function retrieves the text caption for the specified
field, such as a push button or button drop list. If the field doesn’t have a
caption, the prompt linked to the field is returned.
Syntax Field_GetCaption(field_name)
Examples The following example retrieves the caption used for the Save button.
180 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ G E T C O L O R ()
Field_GetColor()
Description The Field_GetColor() function retrieves color information for a field.
Parameters • field – The field for which color information will be retrieved.
• font_color – A return long integer containing the font color. The value
corresponds to one of the following constants:
Constant Constant
COLOR_SYSTEM COLOR_TEAL
COLOR_TRANSPARENT COLOR_GREEN
COLOR_BLACK COLOR_DARK_YELLOW
COLOR_WHITE COLOR_VIOLET
COLOR_RED COLOR_DARK_RED
COLOR_BRIGHT_GREEN COLOR_DARK_BLUE
COLOR_BLUE COLOR_MEDIUM_GRAY
COLOR_TURQUOISE COLOR_LIGHT_GRAY
COLOR_PINK COLOR_LIGHT_YELLOW
COLOR_YELLOW
• back_color – A returned long integer containing the back color. The value
corresponds to one of the constants listed for font_color.
PATTERN_25_SHADING PATTERN_UP_DIAGONAL
PATTERN_50_SHADING PATTERN_DOWN_DIAGONAL
PATTERN_75_SHADING PATTERN_GRID
PATTERN_HORIZONTAL PATTERN_TRELLIS
Return value A boolean. True indicates color information was retrieved, while false
indicates it was not.
Examples The following example retrieves the color and pattern information from the
Buyer ID field.
182 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ G E T F O N T ()
Field_GetFont()
Description The Field_GetFont() function retrieves the font characteristics for a field.
Parameters • text_field – The field for which the font characteristics will be retrieved.
Constant Description
FONT_COURIER Courier
FONT_HELVETICA Helvetica
FONT_TIMES Times
FONT_SYSTEM The default system font
Constant Description
FONT_STYLE_PLAIN Plain
FONT_STYLE_BOLD Bold
FONT_STYLE_ITALIC Italic
FONT_STYLE_UNDERLINE Underline
If several styles are applied to the field, the sum of the appropriate
constants will be returned. For example, if the bold and underline
styles are applied, a value corresponding to FONT_STYLE_BOLD +
FONT_STYLE_UNDERLINE will be returned.
Return value A boolean. True indicates the font characteristics were retrieved, while false
indicates they were not.
Examples The following example retrieves the font used for the Buyer ID field.
Field_GetImage()
Description The Field_GetImage() function retrieves the item numbers of the images
associated with a push button or button drop list field.
Parameters • field – The push button or button drop list for which an image number will
be retrieved.
Constant Description
IMAGE_UP The button up image
IMAGE_DOWN The button down image
IMAGE_OVER The mouse-over image
Return value A integer indicating the image. This value corresponds to the item number
of the image listed in the Button Items window.
Examples The following example retrieves the item number for the button up image
of the Reports button drop list.
184 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ G E T I N S E R T P O S F R O M V I S U A L P O S ()
Field_GetInsertPosFromVisualPos()
Description The Field_GetInsertPosFromVisualPos() function retrieves the insertion
position of an item in a list field (list box, drop-down list, button drop list,
or visual switch) based on its visual position.
• visual_pos – An integer specifying the visual position of the item for which
the insertion position is being returned. The value 1 indicates the first item
at the top of the list.
Comments When static items are added to list fields, either in the data type definition
or with sanScript, they are added in insertion order. The value of the list
field is based on the insertion position of the item selected. If the list is
sorted, the visual order of the items may be different than the insertion
order. If you know the visual position of an item, use this function to
retrieve the item’s insertion position.
If you are using the add item statement to add items to a list field, be sure to use
the redraw statement to resort the items before using the
Field_GetInsertPosFromVisualPos() function.
Examples The following example retrieves the insertion position of the first item
listed in the House Type drop-down list.
Field_GetIntegerProperty()
Description The Field_GetIntegerProperty() function retrieves a specified integer
property for a field.
Return value An integer specifying how the field was set. Refer to the preceding table for
a list of integer properties and their corresponding values.
186 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ G E T L I N K E D C O M M A N D T A G ()
Field_GetLinkedCommandTag()
Description The Field_GetLinkedCommandTag() function returns the command tag
for the command that was created for the field by the
Field_CreateLinkedCommand() function.
Syntax Field_GetLinkedCommandTag(field)
Parameters • field – The field for which the command tag of the linked command is being
returned.
Return value An integer containing the command tag. If the field does not have a linked
command, the value 0 is returned.
Examples The following example retrieves the command tag for the command that
was created based on the Note Absent Button that appears in the Customer
Maintenance window. The display name for the command is changed.
Field_GetPosition()
Description The Field_GetPosition() function returns the current coordinates of the
named field’s top left corner.
Parameters • field_name – The name of the field for which you want to retrieve a position.
Return value A boolean. True indicates the field position was returned, while false
indicates it was not.
Comments The coordinates are expressed in pixels. The coordinates 0,0 specify the
upper left corner of the window.
Examples The following example returns the coordinates of the Seller ID field.
local integer x, y;
local boolean result;
188 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ G E T R E Q U I R E D S T A T U S ()
Field_GetRequiredStatus()
Description The Field_GetRequiredStatus() function ascertains the current status of the
Show Required Fields menu item. If the item is checked, required fields are
being displayed.
Syntax Field_GetRequiredStatus()
Parameters • None
Comments The boolean value denotes the status of the Show Required Fields menu
item. When the Show Required Fields menu item is checked, the prompts
linked to required fields in a window will be displayed as defined by the
Field_SetRequiredFormat() function.
This function can be used in the Main Menu post script to ascertain whether
the Show Required Fields menu item was checked, so that the information
can be saved in a user preferences table.
Examples The following example can be part of a Main Menu post script. It uses the
Field_GetRequiredStatus() function to ascertain the current status of the
Show Required Fields menu item, then saves the returned value to the
User_Preferences table.
show_required = Field_GetRequiredStatus();
UserID of table User_Preferences = UserID of globals;
change table User_Preferences;
'Show Required' of table User_Preferences = show_required;
save table User_Preferences;
Field_GetSelection()
Description The Field_GetSelection() function retrieves the text currently selected in a
text field.
Parameters • text_field – The text field from which you are retrieving the selection.
Return value A string containing the selected text. Up to 255 characters can be returned.
Comments If more than 255 characters are selected, only the first 255 characters are
returned. You can use the substring() function to retrieve the additional
characters.
Examples The following example retrieves the current selection in the Description text
field. If no text is selected, an error is displayed.
190 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ G E T S I Z E ()
Field_GetSize()
Description The Field_GetSize() function retrieves the horizontal and vertical size of a
window field.
Return value A boolean. True indicates the field size was returned, while false indicates it
was not.
Examples The following example retrieves the size of the Buyers button.
Field_GetStringProperty()
Description The Field_GetStringProperty() function retrieves a specified string
property for a field.
Constant Description
FIELD_PROP_AUTOCOMPLETE_ For auto-complete fields that have a linked-lookup
LOOKUP_ITEM button, specifies the text to display for the auto-
complete item that opens the lookup.
FIELD_PROP_CAPTION The caption to use for the field.
192 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ G E T V I S U A L P O S F R O M I N S E R T P O S ()
Field_GetVisualPosFromInsertPos()
Description The Field_GetVisualPosFromInsertPos() function retrieves the visual
position of an item in a list field (list box, drop-down list, button drop list,
or visual switch) based on its insertion position.
Comments When static items are added to list fields, either in the data type definition
or with sanScript, they are added in insertion order. The value of the list
field is based on the insertion position of the item selected. If the list is
sorted, the visual order of the items may be different than the insertion
order. If you know the insertion position of an item, use this function to
retrieve the item’s visual position.
If you are using the add item statement to add items to a list field, be sure to use
the redraw statement to resort the items before using the
Field_GetVisualPosFromInsertPos() function.
Examples The following example retrieves the visual position of the item that is
currently selected in the House Type drop-down list.
Field_GetToolTip()
Description Returns the tooltip associated with a window field.
Syntax Field_GetToolTip(field_name)
Examples The following example returns the tooltip associated with the Print button
of the RESM Explorer window.
194 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ I N S E R T S T R I N G I N T E X T ()
Field_InsertStringInText()
Description The Field_InsertStringInText() function inserts a string or string field into
a text field.
Parameters • text_field – The text field into which you wish to add the string.
• string_expression – The static string or string field you want to insert into the
text field.
Comments This function inserts the string_expression into the text_field at the current
position of the cursor in the text field. If characters are highlighted in the
text field, they will be deleted before the string is inserted. Once the string is
added to the text field, the field is redrawn to include the newly-added
information.
Examples In the following example, the contents of a Customer_Quote field are added
to the Contact Comments field:
Field_MarkListItems()
Description The Field_MarkListItems() function marks or unmarks the selected item in
a non-native list box. An asterisk appears to the left of a marked item.
Syntax Field_MarkListItems(list_field)
Parameters • list_field – The non-native list box field containing the item to mark.
Comments Each item must be added to the list using the add item statement and
should be preceded by a leading blank to allow appropriate space for the
asterisk. The list should not contain static text values.
The following illustration shows how the non-native list box will appear
when items in it are marked using this function:
Marked
Use a nonproportional font, such as Courier, for items in a list box. Then items in
the list will appear in alignment when displayed with or without an asterisk.
Examples The following example is a change script for a button that marks and
unmarks items in the “Item List” non-native list box. The list is initially
filled using the add item statement in the window pre script; each item is
added so that a leading blank appears in front of the item name. When an
item is selected in the list and the button is clicked, an asterisk will appear
next to the item.
local boolean l_boolean;
196 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ P A R S E T E X T ()
Field_ParseText()
Description The Field_ParseText() function breaks up, or parses, a text field into strings.
Parameters • text_field – The text field you want to parse. The text_field can be a window
field, table field or text local variable.
Comments This function returns characters to a string field until the specified
number_of_chars for the string is reached, or until a carriage return is
encountered.
This function can be used in a loop (see the following example) to retrieve
consecutive sections of a text field, and return the retrieved strings to an
array field. If a carriage return is encountered, no more characters will be
returned to the current string. The characters returned to the string in the
next loop will begin immediately following the carriage return.
The defined number_of_chars may not be returned each time this function is
used, since the string values returned will never stop in the middle of a word.
Returned strings always break at spaces. For example, if you split the
following line into 30-character strings, the string returned would break
before the word “this” instead of breaking after the “h” in “this.” Therefore,
only 28 characters will be returned.
28 characters
30 characters
Examples In the following example, a text field (Comments) is parsed into an array of
10 30-character strings.
start_position = 1;
for ind = 1 to 10 do
old_start_position = start_position;
return_string[ind] = Field_ParseText(Comments, 30,
➥ start_position);
{Set each array element to the corresponding returned string.}
'(L) Text_Array'[ind] = return_string[ind];
if old_start_position = start_position then
{The text field has been read.}
exit for;
end if;
end for;
198 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ S E T A L T L I N E C O L O R ()
Field_SetAltLineColor()
Description The Field_SetAltLineColor() function specifies colors for alternate lines in
scrolling windows whose AltLineColor property is true and whose
BackColor, FontColor, Pattern and PatternColor properties are Custom.
Parameters • back_color – A long integer specifying the back color of the scrolling window
line. Use the following constants to set the back color:
Constant Constant
COLOR_SYSTEM COLOR_TEAL
COLOR_TRANSPARENT COLOR_GREEN
COLOR_BLACK COLOR_DARK_YELLOW
COLOR_WHITE COLOR_VIOLET
COLOR_RED COLOR_DARK_RED
COLOR_BRIGHT_GREEN COLOR_DARK_BLUE
COLOR_BLUE COLOR_MEDIUM_GRAY
COLOR_TURQUOISE COLOR_LIGHT_GRAY
COLOR_PINK COLOR_LIGHT_YELLOW
COLOR_YELLOW
• font_color – A long integer specifying the font color of the scrolling window
line. Use the constants listed above to set the font color.
• pattern – An integer specifying the pattern of the scrolling window line. Use
the following constants to set the pattern:
PATTERN_25_SHADING PATTERN_UP_DIAGONAL
PATTERN_50_SHADING PATTERN_DOWN_DIAGONAL
PATTERN_75_SHADING PATTERN_GRID
PATTERN_HORIZONTAL PATTERN_TRELLIS
You can use the User Interface Conversion Utility in Dexterity Utilities to
update your application to use custom colors for scrolling windows. Mark
the Use Custom Colors for Scrolling Windows option when you run the
utility. The utility will set the AltLineColor property to true, and the
BackColor, FontColor, Pattern and PatternColor properties to Custom for all
scrolling windows in your application.
Examples The following example causes the alternate lines of scrolling windows to
appear light yellow.
200 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ S E T B A C K C O L O R ()
Field_SetBackColor()
Description The Field_SetBackColor() function sets the background color of a field.
Parameters • field – The field for which the back color will be set.
• color – A long integer specifying the color to use. The value corresponds to
one of the following constants:
Constant Constant
COLOR_SYSTEM COLOR_TEAL
COLOR_TRANSPARENT COLOR_GREEN
COLOR_BLACK COLOR_DARK_YELLOW
COLOR_WHITE COLOR_VIOLET
COLOR_RED COLOR_DARK_RED
COLOR_BRIGHT_GREEN COLOR_DARK_BLUE
COLOR_BLUE COLOR_MEDIUM_GRAY
COLOR_TURQUOISE COLOR_LIGHT_GRAY
COLOR_PINK COLOR_LIGHT_YELLOW
COLOR_YELLOW
Return value A boolean. True indicates the back color was set, while false indicates it was
not.
Examples The following example sets the background color used for the Buyer ID
field to white.
Field_SetBooleanProperty()
Description The Field_SetBooleanProperty() function sets a specified boolean property
for a field.
Constant Description
FIELD_PROP_AUTOCOMPLETE True if the string field has AutoComplete
enabled. False if it does not.
FIELD_PROP_BDL_DROP_INDICATOR True if the drop indicator for a button drop list
is displayed. False if it is not.
FIELD_PROP_CANCEL True if the field is the Default Cancel for the
window. False if it is not.
FIELD_PROP_DEFAULT True if the field is the Default OK field for the
window. False if it is not.
FIELD_PROP_DISABLED True if the field is disabled. False if it is not.
FIELD_PROP_EDITABLE True if the field is locked or disable. False
otherwise.
FIELD_PROP_FOCUS True if the field currently contains the focus.
False if it does not. This property is
independent of whether the window is active
or inactive.
FIELD_PROP_HYPERSPACE True if the field is marked as Hyperspace. False
if it is not.
FIELD_PROP_LOCKED True if the field is locked. False if it is not.
FIELD_PROP_REQUIRED True if the field is required. False if it is not.
FIELD_PROP_SURROUNDING_BOX True if the field is drawn with a border. False if
it is not.
FIELD_PROP_TAB_STOP True if the field is in the tab sequence. False if
it is not.
FIELD_PROP_VISIBLE True if the field is visiable. False if it is not.
FIELD_PROP_ZOOM True if the field is set to show the zoom
pointer. False if it is not.
• value – A boolean indicating how to set the property. Refer to the preceding
table.
202 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ S E T B O O L E A N P R O P E R T Y ()
Return value A boolean indicating whether the property was set. True indicates the
property was set, while false indicates it was not.
Be aware that the required() function will not consider disabled fields
required, even though they have the FIELD_PROP_REQUIRED property
set to true.
Field_SetCaption()
Description The Field_SetCaption() function sets the text caption for the specified field,
such as a push button or button drop list.
Examples The following example sets the caption of the Save button to Sa&ve. The
ampersand indicates an access key will be available for the push button.
204 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ S E T C U S T O M P R O M P T F O R M A T ()
Field_SetCustomPromptFormat()
Description The Field_SetCustomPromptFormat() function sets the display
characteristics for all text and field objects in an application whose
BackColor, FontColor, PatternColor and Pattern properties are Custom.
Parameters • back_color – A long integer speciying the back color of the object. Use the
following constants to set the back color:
Constant Constant
COLOR_SYSTEM COLOR_TEAL
COLOR_TRANSPARENT COLOR_GREEN
COLOR_BLACK COLOR_DARK_YELLOW
COLOR_WHITE COLOR_VIOLET
COLOR_RED COLOR_DARK_RED
COLOR_BRIGHT_GREEN COLOR_DARK_BLUE
COLOR_BLUE COLOR_MEDIUM_GRAY
COLOR_TURQUOISE COLOR_LIGHT_GRAY
COLOR_PINK COLOR_LIGHT_YELLOW
COLOR_YELLOW
• font_color – A long integer specifying the font color of the object. Use the
constants listed above to set the font color.
• pattern_color – A long integer specifying the pattern color of the object. Use
the constants listed above. COLOR_SYSTEM is not valid for this parameter.
• pattern – An integer specifying the pattern of the object. Use the following
constants to set the pattern:
PATTERN_25_SHADING PATTERN_UP_DIAGONAL
PATTERN_50_SHADING PATTERN_DOWN_DIAGONAL
PATTERN_75_SHADING PATTERN_GRID
PATTERN_HORIZONTAL PATTERN_TRELLIS
These defaults do not apply to static text items for controls such as push
buttons, check boxes and radio buttons. Your operating system color
settings control the display characteristics for those objects if you chose the
Use System Colors option in the User Interface Application Utility.
Examples The following example causes the custom prompts and fields to have a
dark green background color.
206 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ S E T F O N T ()
Field_SetFont()
Description The Field_SetFont() function sets the font characteristics for a field.
Parameters • text_field – The field for which the font will be set.
Constant Description
FONT_COURIER Courier
FONT_HELVETICA Helvetica
FONT_TIMES Times
FONT_SYSTEM The default system font
Constant Description
FONT_STYLE_PLAIN Plain
FONT_STYLE_BOLD Bold
FONT_STYLE_ITALIC Italic
FONT_STYLE_UNDERLINE Underline
Return value A boolean. True indicates the font characteristics were set, while false
indicates they were not.
Examples The following example sets the font used for the Description field to 10
point Courier and applies the bold style.
Field_SetFontColor()
Description The Field_SetFontColor() function sets the color of the font used for a field.
Parameters • text_field – The field for which the font color will be set.
• color – A long integer specifying the color to use. The value corresponds to
one of the following constants:
Constant Constant
COLOR_SYSTEM COLOR_TEAL
COLOR_TRANSPARENT COLOR_GREEN
COLOR_BLACK COLOR_DARK_YELLOW
COLOR_WHITE COLOR_VIOLET
COLOR_RED COLOR_DARK_RED
COLOR_BRIGHT_GREEN COLOR_DARK_BLUE
COLOR_BLUE COLOR_MEDIUM_GRAY
COLOR_TURQUOISE COLOR_LIGHT_GRAY
COLOR_PINK COLOR_LIGHT_YELLOW
COLOR_YELLOW
Return value A boolean. True indicates the font color was set, while false indicates it was
not.
Examples The following example sets the font color used for the Description field to
red.
208 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _S E T F O N T S I Z E ()
Field_SetFontSize()
Description The Field_SetFontSize() function sets the size of the font used for a field.
Parameters • text_field – The field for which the font size will be set.
Return value A boolean. True indicates the font size was set, while false indicates it was
not.
Examples The following example sets the font size used for the Description field to 14
points.
Field_SetFontStyle()
Description The Field_SetFontStyle() function sets the style of the font used for a field.
Parameters • text_field – The field for which the font style will be set.
Constant Description
FONT_STYLE_PLAIN Plain
FONT_STYLE_BOLD Bold
FONT_STYLE_ITALIC Italic
FONT_STYLE_UNDERLINE Underline
Return value A boolean. True indicates the font style was set, while false indicates it was
not.
Examples The following example sets the style used for the Description field to plain.
210 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ S E T I M A G E ()
Field_SetImage()
Description The Field_SetImage() function specifies the default image to use for a push
button or button drop list field.
Parameters • field – The push button or button drop list whose image will be set.
Constant Description
IMAGE_UP The button up image
IMAGE_DOWN The button down image
IMAGE_OVER The mouse-over image
Return value A boolean indicating whether the image was changed. True indicates the
image was changed, while false indicates it was not.
Comments You must use the redraw statement to display the images specified.
Examples The following example sets the button up image for the Reports button
drop list to use the third image for the field.
Field_SetIntegerProperty()
Description The Field_SetIntegerProperty() function sets a specified integer property
for a field.
Constant Description/Values
FIELD_PROP_BDL_DROP_POS_X Specifies the distance in pixels the drop indicator
will be drawn from the right edge of the control.
FIELD_PROP_BDL_DROP_POS_Y Specifies the distance in pixels the drop indicator
will be drawn from the bottom edge of the control.
FIELD_PROP_BUTTON_STYLE Indicates the style for the push button. The
possible values correspond to one of the following
constants:
BUTTON_STYLE_TEXT_ONLY
BUTTON_STYLE_TEXT_ON_LEFT
BUTTON_STYLE_TEXT_ON_RIGHT
BUTTON_STYLE_TEXT_ON_TOP
BUTTON_STYLE_TEXT_ON_BOTTOM
BUTTON_STYLE_GRAPHIC_ONLY
• value – An integer value indicating how to set the property. Refer to the
preceding table.
Return value A boolean indicating whether the property was set. True indicates the
property was set, while false indicates it was not.
212 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ S E T P A T T E R N ()
Field_SetPattern()
Description The Field_SetPattern() function sets the pattern used for a field.
Parameters • field – The field for which the pattern will be set.
PATTERN_25_SHADING PATTERN_UP_DIAGONAL
PATTERN_50_SHADING PATTERN_DOWN_DIAGONAL
PATTERN_75_SHADING PATTERN_GRID
PATTERN_HORIZONTAL PATTERN_TRELLIS
Return value A boolean. True indicates the pattern was set, while false indicates it was
not.
Examples The following example sets the pattern used for the Buyer ID field to 50%
shading.
Field_SetPatternColor()
Description The Field_SetPatternColor() function sets the color of the pattern used for a
field.
Parameters • field – The field for which the pattern color will be set.
• color – A long integer specifying the color to use. The value corresponds to
one of the following constants:
Constant Constant
COLOR_SYSTEM COLOR_TEAL
COLOR_TRANSPARENT COLOR_GREEN
COLOR_BLACK COLOR_DARK_YELLOW
COLOR_WHITE COLOR_VIOLET
COLOR_RED COLOR_DARK_RED
COLOR_BRIGHT_GREEN COLOR_DARK_BLUE
COLOR_BLUE COLOR_MEDIUM_GRAY
COLOR_TURQUOISE COLOR_LIGHT_GRAY
COLOR_PINK COLOR_LIGHT_YELLOW
COLOR_YELLOW
Return value A boolean. True indicates the pattern color was set, while false indicates it
was not.
Examples The following example sets the pattern color used for the Buyer ID field to
yellow.
214 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _S E T R E Q U I R E D F O R M A T ()
Field_SetRequiredFormat()
Description The Field_SetRequiredFormat() function sets the font style and color to use
for prompts linked to required fields when the Show Required Fields menu
item is selected.
Value Description
0 Plain text
1 Bold
2 Italic
3 Bold and italic
Value Description
0 Black
1 Red
Comments For a prompt to appear with the characteristics defined using this function,
the prompt must be linked to a field in the Layout window, and the field’s
Required property in the Properties window must be set to true. When a
user chooses the Show Required Fields menu item, all prompts linked to
required fields will appear in the specified font style and color.
Use -1 as a parameter value if you do not want to change that format. For
example, use 1 as the font_style and -1 as the font_color to change the style to
bold and to leave the color unchanged.
Examples The following example allows a user of your application to set the display
characteristics of prompts for required fields. Two check boxes (CB_Bold
and CB_Italic) are used to specify the font_style, and a radio group
(RG_Font_Color) containing two radio button fields (Black and Red) is used
to define the font_color.
216 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ S E T R E Q U I R E D S T A T U S ()
Field_SetRequiredStatus()
Description The Field_SetRequiredStatus() function either checks or unchecks the
Show Required Fields menu item.
Syntax Field_SetRequiredStatus(mode)
Value Description
true Sets the Show Required Fields menu item to checked.
false Sets the Show Required Fields menu item to unchecked.
Return value Boolean. The value returned denotes the status of the Show Required Fields
menu item before if it was changed using this function.
Comments When the Show Required Fields menu item is checked, the prompts linked
to required fields in a window will be displayed as defined by the
Field_SetRequiredFormat() function.
This function can be used in your application’s Main Menu pre script to set
the Show Required Fields menu item to the status stored in a user
preferences table. Conversely, it can be used in the Main Menu post script to
ascertain whether the Show Required Fields menu item was checked, so
that the information could be saved in a user preferences table.
Examples The following example can be part of a Main Menu pre script. It retrieves a
record containing information about the current user’s desired settings
from the user_prefs table. It then uses the information in the show_req field
as the mode parameter for the Field_SetRequiredStatus() function.
The following example can be part of a Main Menu post script. It ascertains
whether the current user checked the Show Required Fields menu item
using the Field_SetRequiredStatus() function, and reads the returned
value. If false is returned, the menu command wasn’t checked; if true is
returned, the menu command was checked. The returned value is then
saved to the user_prefs table.
req_pref = Field_SetRequiredStatus(true);
user_ID of table user_prefs = current_user of globals;
get table user_prefs by user_ID_key;
show_req of table user_prefs = req_pref;
save table user_prefs;
218 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _S E T S E L E C T I O N ()
Field_SetSelection()
Description The Field_SetSelection() function selects text in a text field.
Parameters • text_field – The text field in which you are setting the selection.
Examples The following example selects the first 10 characters in the Description text
field.
Field_SetStringProperty()
Description The Field_SetStringProperty() function sets a specified string property for
a field.
Constant Description
FIELD_PROP_AUTOCOMPLETE_ For auto-complete fields that have a linked-lookup
LOOKUP_ITEM button, specifies the text to display for the auto-
complete item that opens the lookup.
FIELD_PROP_CAPTION The caption to use for the field.
Return value A boolean indicating whether the property was set. True indicates the
property was set, while false indicates it was not.
220 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ S E T T O O L T I P ()
Field_SetToolTip()
Description Sets the tooltip for a window field.
Parameters • field_name – The name of a window field whose tooltip is being set.
Examples The following example sets the tooltip for the Print button of the RESM
Explorer window to “Disabled”.
Field_SetZoomFormat()
Description The Field_SetZoomFormat() function sets the display characteristics of text
and field objects (string, currency, integer, long, date and time) whose Zoom
property is true.
• font_color – A long integer specifying the color of the text or field object. Use
the following constants:
Constant Constant
COLOR_SYSTEM COLOR_TEAL
COLOR_TRANSPARENT COLOR_GREEN
COLOR_BLACK COLOR_DARK_YELLOW
COLOR_WHITE COLOR_VIOLET
COLOR_RED COLOR_DARK_RED
COLOR_BRIGHT_GREEN COLOR_DARK_BLUE
COLOR_BLUE COLOR_MEDIUM_GRAY
COLOR_TURQUOISE COLOR_LIGHT_GRAY
COLOR_PINK COLOR_LIGHT_YELLOW
COLOR_YELLOW
Comments For text objects used for prompts, use these visual indicators to indicate the
presence of a zoom field. The following illustration shows one way a zoom
field’s prompt can look:
Don’t confuse the Zoom property for field and text objects with the Zoom property
for push buttons. When set to true, the Zoom property for push buttons displays a
different mouse pointer, indicating the presence of a zoom field.
222 F U N C T I O N L I B R A R Y R E F E R E N C E
F I E L D _ S E T Z O O M F O R M A T ()
The User Interface Conversion Utility in Dexterity Utilities searches for all
prompts that appear beneath zoom buttons and sets each prompt’s Zoom
property to true. Once you’ve converted your application’s user interface
using this utility, use this function to specify the characteristics of zoom
field prompts throughout your application. If you don’t use this function,
zoom field prompts will automatically appear with an underline and a
black font color.
Examples The following example shows the change script for an Apply button in a
user options window. The window allows the user to specify whether to
show underlines for zoom field prompts (using the CB_Use_Underlines
field), and the color of those prompts (a selection from a drop-down list):
• File_Count()
• File_Delete()
• File_GetSize()
• File_GetTempDirectory()
• File_Probe()
File_Count()
Description The File_Count() function returns the number of files currently open,
currently available and the maximum available for an application.
Return value An integer indicating the number of files currently open in an application.
Comments Use this function to check whether enough file buffers are available before
starting a process. The number of available file buffers is depleted
whenever a table is opened. A large number of file buffers can be depleted
in the following ways:
While it’s unlikely that a Dexterity application will encounter a file open
limitation under normal processing, precautions should be taken to ensure
that extensive processes that access several tables, such as posting, have
enough buffer resources to run to completion.
Examples The following example checks for the number of available buffers before a
posting routine is started. If the number of buffers available is lower than 20
(the number of tables required for the routine), then the user is warned and
processing is stopped. Otherwise, the posting process can continue.
local integer l_available, l_open, l_max;
226 F U N C T I O N L I B R A R Y R E F E R E N C E
F I L E _ D E L E T E ()
File_Delete()
Description The File_Delete() function deletes a file from the operating system.
Syntax File_Delete(file_name)
Parameters • file_name – A string indicating the generic pathname of the file you want to
delete. A generic pathname can be set using either the getfile() function or
the Path_SelectPathname() function.
Comments This function deletes any file from the operating system. You also can use
the delete table statement to delete a table from the operating system, but
this statement works for Dexterity data tables only.
Examples The following example is attached to a Delete button and deletes a file
that’s listed in the File Name field. This field displays a generic pathname
returned by the getfile() function.
File_GetSize()
Description The File_GetSize() function retrieves the size in bytes of the specified file.
Syntax File_GetSize(path)
Return value A long integer containing the size of the file in bytes.
Examples The following example displays a dialog box that allows the user to select a
graphics file. When the user selects the file, the size of the file is retrieved
and displayed in a message.
end if;
228 F U N C T I O N L I B R A R Y R E F E R E N C E
F I L E _ G E T T E M P D I R E C T O R Y ()
File_GetTempDirectory()
Description The File_GetTempDirectory() function retrieves the complete path to the
local temporary folder for the current user.
Syntax File_GetTempDirectory()
Parameters • None
Return value A string containing the complete path to the local temporary folder. The
path is in native format.
Examples The following example retrieves the path to the local temporary folder for
the current user.
temp_directory = File_GetTempDirectory();
File_Probe()
Description The File_Probe() function indicates whether a table or file exists in the
specified location and can be opened.
Syntax File_Probe(pathname)
Return value A boolean indicating whether the table or file exists in the specified location
and can be opened.
Value Description
true The table or file exists in the specified location and can be opened.
false The table or file doesn’t exist in the specified location or can’t be
opened.
Comments This function is typically used in the Main Menu form pre script to
ascertain whether the pathnames in the Pathnames table specify valid
locations.
Examples The following example uses the File_Probe() function to verify whether the
USERS.DAT file exists in the DEX subdirectory.
result = File_Probe(":C:DEX/USERS.DAT");
230 F U N C T I O N L I B R A R Y R E F E R E N C E
File list function library
Use the functions in this library to build a list of files to be used for other
processes in the application, such as the list of attachments in an e-mail
message. This library contains the following functions:
• FileList_Add()
• FileList_Count()
• FileList_Create()
• FileList_Destroy()
• FileList_Get()
• FileList_Remove()
• FileList_ShowDialog()
FileList_Add()
Description The FileList_Add() function adds a file to a file list.
Parameters • filelist – A long integer specifying the file list that the file is being added to.
Constant Description
TEXTFILE A text file
TABFILE A tab-delimited file
COMMAFILE A comma-delimited file
HTMLFILE An HTML file
PDFFILE A PDF file
XMLFILE An XML file
DOCXFILE A Microsoft Word file
XLSXFILE A Microsoft Excel file
Return value A boolean. The value true indicates the file was added to the list, while false
indicates it was not.
Examples The following example created a file list and stores the ID in a local field.
Then it displays a file dialog that allows the user to select a graphics file.
When the user selects a file and clicks Open, the file is added to the file list
identified by the value in the (L) Picture_List local field.
232 F U N C T I O N L I B R A R Y R E F E R E N C E
F I L E L I S T _ A D D ()
FileList_Count()
Description The FileList_Count() function returns the number of files in the specified
file list.
Syntax FileList_Count(filelist)
Parameters • filelist – A long integer specifying the file list for which the files are being
counted.
Return value An integer containing the number of files in the file list.
Comments The file list count is -1 if the file list has not been created.
Examples The ID for a file list is stored in the (L) Picture_List local field for a window.
The following example retrieves the number of file list items in this file list
and displays the file paths in a dialog box.
for i = 1 to count do
end for;
234 F U N C T I O N L I B R A R Y R E F E R E N C E
F I L E L I S T _ C R E A T E ()
FileList_Create()
Description The FileList_Create() function creates a new file list.
Syntax FileList_Create()
Parameters • None
Examples The following example creates a file list and stores the ID in the local field
(L) Picture_List.
FileList_Destroy()
Description The FileList_Destroy() function frees the memory used for a file list.
Syntax FileList_Destroy(filelist)
Parameters • filelist – A long integer specifying the file list for which the memory is being
freed.
Return value A boolean. The value true indicates the memory for the file list was freed,
while false indicates it was not.
Examples The following example frees the memory for the file list identified by the ID
value stored in the (L) Picture_List local field.
236 F U N C T I O N L I B R A R Y R E F E R E N C E
F I L E L I S T _ G E T ()
FileList_Get()
Description The FileList_Get() function retrieves the file information for a specific
position in the file list.
Parameters • filelist – A long integer specifying the file list from which file information is
being retrieved.
• index – An integer specifying the file list item to be retrieved from the file
list. The value 1 indicates the first item.
• full_path – A returned string containing the full path of the file list item.
• file_format – An optional returned integer that identifies the type of file for
the file list item. The value typically corresponds to one of the following
constants:
Constant Description
TEXTFILE A text file
TABFILE A tab-delimited file
COMMAFILE A comma-delimited file
HTMLFILE An HTML file
PDFFILE A PDF file
XMLFILE An XML file
DOCXFILE A Microsoft Word file
XLSXFILE A Microsoft Excel file
Return value A boolean. The value true indicates the file list item was retrieved, while
false indicates it was not.
Examples The following example retrieves all of the file list items for the file list
identified by the ID value stored in the local field (L) Picture_List. The file
paths are displayed in a dialog box.
for i = 1 to count do
end for;
238 F U N C T I O N L I B R A R Y R E F E R E N C E
F I L E L I S T _ R E M O V E ()
FileList_Remove()
Description The FileList_Remove() function removes the specified file list item from a
file list.
Parameters • filelist – A long integer specifying the file list from which a file list item is
being removed.
• index – An integer specifying the file list item to be removed from the file
list. The value 1 indicates the first item.
Return value A boolean. The value true indicates the file list item was removed, while
false indicates it was not.
Examples The following example removes the first file list item from the file list
identified by the ID value stored in the local field (L) Picture_List.
FileList_ShowDialog()
Description The FileList_ShowDialog() function displays a file system dialog box that
allows the user to select a set of files. The selected files are returned as a file
list.
Parameters • prompt – A string that will be displayed in the title bar of the dialog box.
Constant Description
APPFILE Displays only application files
DICTIONARY Displays only dictionary files (.DIC)
LAUNCH Displays only launch files (.SET)
MACROFILE Displays only Dexterity macro files (.MAC)
XMLFILE Displays only XML files
TEXTFILE Displays all files
If you are using a custom filter, the default_filter parameter indicates which
filter in the custom filter set will be used by default. For instance, assume
three filter types are defined in the custom filter. To specify that the second
filter type be used as the default, use 2 for this parameter.
If a string is used to specify the custom filter list, the following syntax is
used:
description |filter{;filter}|
240 F U N C T I O N L I B R A R Y R E F E R E N C E
F I L E L I S T _ S H O W D I A L O G ()
The filter parameter specifies a file extension, such as “*.DIC”. When this
filter is used, files that match this extension will be displayed in the dialog
box. The filter parameter should not contain spaces. To specify multiple
filters, separate them with a semicolon (;). End the list of filters with a pipe
(|) character. Several custom filters can be concatenated within the
custom_filter string.
Return value A long integer containing the ID of the file list. If the user clicks Cancel, the
value 0 is returned.
Examples The following example displays a file dialog that allows the user to select
multiple dictionary files from the Dynamics GP folder. The selected files are
returned in a file list.
local long file_list;
The following example displays a file dialog that allows the user to select
graphics files from a folder. A custom filter is used so that only graphics
files are displayed. No default path is specified, so the current path for the
application is used.
local long file_list;
• FileType_CanAppend()
• FileType_FillList()
• FileType_GetExtension()
• FileType_IsValid()
FileType_CanAppend()
Description The FileType_CanAppend() function indicates whether a specified file
type can be appended to.
Syntax FileType_CanAppend(file_type)
Parameters • file_type – An integer specifying the file type. The value typically
corresponds to one of the following file type constants:
Return value A boolean. True indicates the file type can be appended to, while false
indicates that it cannot.
Comments Typically, the value passed to this function will come from the item data for
the list field filled by the FileType_FillList() function.
Examples The following example is the change script for a list box that contains file
types added by the FileType_FillList() function. It retrieves the item data
for the selected item, and then sets a check box based on whether the
selected file type can be appended to.
244 F U N C T I O N L I B R A R Y R E F E R E N C E
F I L E T Y P E _ F I L L L I S T ()
FileType_FillList()
Description The FileType_FillList() function fills a list box with the available file types
that the Report Writer can export to.
Syntax FileType_FillList(list_field)
Parameters • list_field – A list box that will contain the available file types. The item data
for each item contains the file type value for that item.
Return value A boolean. The value true indicates the file types were added to the list,
while false indicates they were not.
Comments The following file types will be added to the list box:
Examples The following example fills the (L) FileType list box field with the available
file types.
FileType_GetExtension()
Description The FileType_GetExtension() function retrieves the file extension for a
specified file type.
Syntax FileType_GetExtension(file_type)
Parameters • file_type – An integer specifying the file type for which the extension will be
returned. The following table lists the constants for the file types of which
an extension can be returned.
Constant Description
TEXTFILE Text file
TABFILE Tab-delimited file
COMMAFILE Comma-delimited file
HTMLFILE HTML file
PDFFILE PDF file
XMLFILE XML file
APPFILE Application file
DICTIONARY Dictionary file
LAUNCH Launch file
MACROFILE Macro file
DOCXFILE Microsoft Word file
XLSXFILE Microsoft Excel file
XPSFILE XPS file
RTFFILE Rich Text file
Return value A string containing the file type extension. The extension does not include
the initial period character.
Examples The following example retrieves the first item in a file list. Then it retrieves
the file extension based on the file type for the item.
246 F U N C T I O N L I B R A R Y R E F E R E N C E
F I L E T Y P E _ G E T E X T E N S I O N ()
FileType_IsValid()
Description The FileType_IsValid() function indicates whether a file type is one of the
valid types the Report Writer can export to.
Syntax FileType_IsValid(file_type)
Return value A boolean. The value true indicates the file type is valid for the Report
Writer to export to, while false indicates it is not.
Examples The following example is the change script for a list box that contains file
types added by the FileType_FillList() function. It retrieves the item data
for the selected item, and then sets a check box based on whether the
selected file type can be exported to.
248 F U N C T I O N L I B R A R Y R E F E R E N C E
Form function library
Use the functions in this library to perform special actions for forms. This
library contains the following function:
• Form_GetWindowGroup()
Form_GetWindowGroup()
Description The Form_GetWindowGroup() function creates a window group for the
specified form. If the window group already exists for the form, the ID for
the window group is retrieved.
Parameters • formname – The technical name of the form for which the window group is
being created or retrieved.
Return value A boolean. The value true indicates that the window group did not exist
and was created. The value false indicates that the window group already
existed.
Examples The following example is the trigger processing procedure that runs in
response to the SetupWindowGroup procedure for the
RM_Customer_Maintenance form. The trigger processing procedure
retrieves the window group for the Customer Maintenance window. It adds
the Contact History window to the end of the window group.
local long windowGroupId;
local integer tag;
{Get the tag for the command that runs when the new tab is clicked.}
tag = Command_GetTag(command 'IG_Contact_History_Tab' of form
➥ 'Command_IG_Sample');
250 F U N C T I O N L I B R A R Y R E F E R E N C E
Import function library
Use the functions in this library to read, or import text records (lines) as
large as 2048 characters, with fields as large as 255 characters, from a tab- or
comma-delimited text file. These functions will not write to a text file. This
library contains the following functions:
• Import_CloseFile()
• Import_GetNextField()
• Import_GetNextRecord()
• Import_OpenFile()
Import_CloseFile()
Description The Import_CloseFile() function closes the text file opened by
Import_OpenFile() and releases the file_ID.
Syntax Import_CloseFile(file_ID)
Return value An integer indicating the result of the file close. If 0 is returned, the function
closed the file successfully. If the file_ID is returned, the function couldn’t
close the file successfully.
Comments Always close a text file once you’ve completed reading it, or if you receive
an error condition while opening it using Import_OpenFile().
252 F U N C T I O N L I B R A R Y R E F E R E N C E
I M P O R T _ G E T N E X T F I E L D ()
Import_GetNextField()
Description The Import_GetNextField() function returns the value of the current field,
and advances to the next field in the record. A field is a set of characters
separated from other characters in the record by a comma or a tab.
Syntax Import_GetNextField(file_ID)
Return value A string representing the text in the current field (not the field you’re
advancing to). The maximum return value is 255 characters.
If you need to read more than 255 characters for a given field, use the
TextFile_ReadText() function to read the field, instead.
Comments This function moves to the next field in a text record. The following
illustration shows how the Import_GetNextField() function interprets a
comma-delimited text file:
Execute this function multiple times for the same record to return values for
each field in the record. You ascertain the number of fields in
the record using the num_fields parameter of the Import_OpenFile()
function. Once you’ve read all the fields in the record, use
Import_GetNextRecord() to advance to the next record. Then continue by
using Import_GetNextField().
Examples The following example opens a text file for importing. It returns a
pathname using the getfile() function, then opens the file for that pathname
using the Import_OpenFile() function. The script then loops through each
record in the file using Import_GetNextRecord(), and returns field values
for each record using Import_GetNextField(). Once processing reaches the
end of the file, or if the script encounters an error, the script closes the text
file using Import_CloseFile().
254 F U N C T I O N L I B R A R Y R E F E R E N C E
I M P O R T _ G E T N E X T R E C O R D ()
Import_GetNextRecord()
Description The Import_GetNextRecord() advances to the next record, or “line” in the
text file. A record is made up of all the fields between carriage returns in a
text file.
Syntax Import_GetNextRecord(file_ID)
Return value A boolean representing an end of file (EOF) error. If false, there are
additional records in the file. If true, processing reached the end of the file.
Comments This function moves to the next record in a text file. The following
illustration shows how the Import_GetNextRecord() function interprets a
comma-delimited text file:
A record is made up of
fields that are separated
by a delimeter.
A carriage return
indicates the end of a
record.
Import_OpenFile()
Description The Import_OpenFile() function opens a specified text file and reserves a
file ID. This file ID must be used with the remainder of the functions in the
Import library.
• pathname – A string specifying the full generic path and file name for the
text file.
Constant Description
COMMAFILE Comma delimiter
TABFILE Tab delimiter
Return value An integer representing a unique file ID. This file ID must be used in the
remainder of the functions in the Import library. If this value is 0, an open
error occurred.
Comments Each record in the import file is limited to 2047 total characters (including
the CR/LF combination at the end of the record). If the imported line
exceeds this length, the remainder of the line will be truncated.
256 F U N C T I O N L I B R A R Y R E F E R E N C E
Help pane function library
Use the functions in this library to implement a docked HTML Help pane in
an application. This library contains the following functions:
• HelpPane_Create()
• HelpPane_Destroy()
• HelpPane_DisplayTopic()
• HelpPane_GetWidth()
• HelpPane_SetTitle()
• HelpPane_SetWidth()
• HelpPane_Show()
HelpPane_Create()
Description The HelpPane_Create() function creates a docked HTML Help pane on the
right side of the application’s display area. This pane can be used to display
topics from a compiled HTML Help (.chm) file.
Syntax HelpPane_Create()
Parameters • None
Return value A boolean. The value true indicates the help pane was created, while false
indicates it was not.
Comments The HelpPane_Create() function creates the help pane, but does not display
it. Use the HelpPane_Show() function to display the help pane.
Examples The following example is a command script that creates a docked help pane
in the Real Estate Sales Manager sample application.
path = Path_GetForApp(2);
tag = Command_GetTag(command CMD_HelpPane of form 'Main Menu');
258 F U N C T I O N L I B R A R Y R E F E R E N C E
H E L P P A N E _ D E S T R O Y ()
HelpPane_Destroy()
Description The HelpPane_Destroy() function removes the docked HTML Help pane
from the right side of the application’s display area.
Syntax HelpPane_Destroy()
Parameters • None
Return value A boolean. The value true indicates the help pane was removed, while false
indicates it was not.
Examples The following example saves the width of the docked HTML Help pane,
and then uses the HelpPane_Destroy() function to remove it from the
application.
pane_width = HelpPane_GetWidth();
result = Defaults_Write("HelpPaneWidth", str(pane_width));
HelpPane_DisplayTopic()
Description The HelpPane_DisplayTopic() function displays the specified topic from
an compiled HTML Help file in the docked help pane.
Parameters • help_file – A string specifying the complete path (in generic format) to the
compiled HTML Help file (.chm) from which a topic will be displayed.
• topic – A string or long integer that specifies the help topic to display. If a
string value is used, supply the HTML filename of the topic to be displayed
from the compiled help file. If a long integer value is used, supply the
context number for the topic to be displayed from the compiled help file.
• error_code – An optional long integer returned from the HTML Help engine
that indicates what specific HTML Help error occurred. The value 0
indicates that no error was detected.
No error code is returned if you specify an invalid HTML filename for the topic to
be displayed in the compiled help file.
• error_string – An optional string returned from the HTML Help engine that
describes the specific HTML Help error that occurred. If no error was
detected, the empty string ("") is returned.
Return value A boolean. The value true indicates the command to display the topic was
successful, while false indicates it was not.
260 F U N C T I O N L I B R A R Y R E F E R E N C E
H E L P P A N E _ D I S P L A Y T O P I C ()
The following example is a portion of the help processing script for the Real
Estate Sales Manager sample application. If the docked help pane has been
created, the HelpPane_DisplayTopic() function is used to display the help
topic for the currently-active window in it. Notice how the optional return
values from the function are used to display any error returned from the
HTML Help engine.
help_path = Dict_GetPathname(2);
help_path_and_file = help_path + "RESM.chm";
HelpPane_GetWidth()
Description The HelpPane_GetWidth() function retrieves the width of the docked
HTML Help pane in the application.
Syntax HelpPane_GetWidth()
Parameters • None
Comments If the help pane hasn’t been created, this function returns the value 0 (zero).
The default width for the help pane is 250 pixels. The minimum width is 20
pixels.
pane_width = HelpPane_GetWidth();
result = Defaults_Write("HelpPaneWidth", str(pane_width));
262 F U N C T I O N L I B R A R Y R E F E R E N C E
H E L P P A N E _ S E T T I T L E ()
HelpPane_SetTitle()
Description The HelpPane_SetTitle() function specifies the title that will appear at the
top of the docked HTML Help pane on the right side of the application’s
display area.
Syntax HelpPane_SetTitle(title)
Return value A boolean. The value true indicates the title was set, while false indicates it
was not.
Examples The following example uses the HelpPane_SetTitle() function to set the
title of the help pane, and then displays the help pane.
HelpPane_SetWidth()
Description The HelpPane_SetWidth() function specifies the width of the docked
HTML Help pane on the right side of the application area.
Syntax HelpPane_SetWidth(width)
Parameters • width – An integer specifying the width of the docked help pane.
Return value A boolean. The value true indicates the width was set, while false indicates
it was not.
Comments The default width for the docked help pane is 250 pixels.
Return value A boolean. The value true indicates the width of the help pane was set,
while false indicates it was not.
Examples The following example reads the help pane width from the Dex.ini file and
then uses the HelpPane_SetWidth() function to set the width of the docked
help pane.
pane_width = value(Defaults_Read("HelpPaneWidth"));
if pane_width > 20 then
result = HelpPane_SetWidth(pane_width);
end if;
result = HelpPane_Show(true);
264 F U N C T I O N L I B R A R Y R E F E R E N C E
H E L P P A N E _ S H O W ()
HelpPane_Show()
Description The HelpPane_Show() function causes the docked HTML Help pane to be
shown or hidden in the application.
Syntax HelpPane_Show(action)
Parameters • action – A boolean. The value true specifies that the help pane should be
shown, while false specifies it should be hidden.
Return value A boolean. The value true indicates the action was completed successfully,
while false indicates it was not.
Comments You must use the HelpPane_Create() function to create the help pane
before you can show it.
Examples The following example uses the HelpPane_Show() function to hide the
help pane in the application.
result = HelpPane_Show(false);
IP_GetIPName()
Description The IP_GetIPName() function returns the host name of the current
workstation.
Syntax IP_GetIPName()
Parameters • None
Examples This example displays a warning message with the host name of the current
workstation:
268 F U N C T I O N L I B R A R Y R E F E R E N C E
I P _ G E T I PN U M B E R ()
IP_GetIPNumber()
Description The IP_GetIPNumber() function returns the IP address of the current
workstation.
Syntax IP_GetIPNumber()
Parameters • None
Examples This example displays a warning message with the IP address of the current
workstation:
IP_PingDPS()
Description The IP_PingDPS() function “pings” a Process Server workstation to find
out whether the Process Server is running. The “ping” procedure sends a
small piece of data from one computer to another to test connectivity
between the two.
Parameters • address – The IP address of the Process Server you want to ping. This can be
the IP number, or if name resolution exists for your system (such as a
domain names server or a hosts file), the IP name.
Return value A boolean indicating the status: if true, the ping was successful and the
connection between sending and receiving workstations is valid. If false,
the ping wasn’t successful and no connection between the sending and
receiving workstations exists.
Examples This example checks to determine whether a server is currently active at the
IP address JAX.GPS.COM.
270 F U N C T I O N L I B R A R Y R E F E R E N C E
Launch file function library
Refer to Chapter 58, Use the functions in this library when working with launch files in your
“Using Launch Files,” application. This library contains the following functions:
in Volume 1 of the
Dexterity • Launch_CountProds()
Programmer’s Guide • Launch_FillListWithProds()
for more information. • Launch_GetFileInfo()
• Launch_GetFileName()
• Launch_GetProdID()
• Launch_GetProdName()
• Launch_GetProdPosition()
• Launch_ParseFileFromPath()
• Launch_ReadDictPath()
• Launch_SelectDict()
• Launch_SelectFile()
• Launch_WriteDictPath()
Launch_CountProds()
Description The Launch_CountProds() function counts the number of products listed in
the launch file. This function will work only when your application is
opened with the runtime engine.
Syntax Launch_CountProds()
Parameters • None
Examples The following example returns the number of products listed in the launch
file.
272 F U N C T I O N L I B R A R Y R E F E R E N C E
L A U N C H _ F I L L L I S T W I T H P R O D S ()
Launch_FillListWithProds()
Description The Launch_FillListWithProds() function fills a list field (a field that uses a
list box, combo box, drop-down list, or button drop list data type) with
product names listed in the current launch file. This function will work only
when your application is opened with the runtime engine.
Syntax Launch_FillListWithProds(list_field)
Parameters • list_field – A list field filled with product names returned by this function.
Comments If you access the application in test mode, this function fills list_field with
the dictionary name, not the product name.
Examples The following example fills a list field named Product List with products in
the current launch file.
Launch_GetFileInfo()
Description The Launch_GetFileInfo() function fills list fields (fields that use a drop-
down list, list box, non-native list or button drop list data type) with
product names, product IDs and dictionary location IDs from the launch
file. This function will work only when your application is opened with the
runtime engine.
Comments Product IDs, product names and dictionary location IDs are required
parameters when you read a dictionary pathname using
Launch_ReadDictPath() or change a dictionary pathname using
Launch_WriteDictPath().
if Launch_SelectFile(l_pathname) then
l_result = Launch_GetFileInfo(l_pathname, 'Product IDs',
➥ 'Products', 'Dictionary Location IDs');
end if;
274 F U N C T I O N L I B R A R Y R E F E R E N C E
L A U N C H _ G E T F I L E N A M E ()
Launch_GetFileName()
Description The Launch_GetFileName() function returns the full generic path and
name of the launch file for the current application. This function will work
only when your application is opened with the runtime engine.
Syntax Launch_GetFileName()
Parameters • None
Comments Use this function to perform operations on the launch file used by the
currently running application. This is in contrast to Launch_SelectFile(),
which opens a dialog box that allows you to select any launch file.
Examples This example returns the location of the launch file for the current
application. Using this location, the Launch_GetFileInfo() function fills list
fields with product names, product IDs and dictionary location IDs from
the current launch file:
l_launch_file_location = Launch_GetFileName();
l_result = Launch_GetFileInfo(l_launch_file_location,
➥ 'Product IDs', 'Products', 'Dictionary Location IDs');
Launch_GetProdID()
Description The Launch_GetProdID() function returns a product ID based upon a
product’s position in the launch file. This function will work only when
your application is opened with the runtime engine.
Syntax Launch_GetProdID(index)
Comments You can ascertain the index by referencing the position of a product in a list
field. Use the Launch_FillListWithProds() function to fill a list field with
product names. The position of each name in the list then corresponds to
the position of the product in the launch file.
Examples This example uses the selected product’s position in the list as the index. The
Launch_GetProdID() function uses this position to return the
corresponding product ID:
276 F U N C T I O N L I B R A R Y R E F E R E N C E
L A U N C H _ G E T P R O D N A M E ()
Launch_GetProdName()
Description The Launch_GetProdName() function returns a product’s name from the
launch file based upon its product ID. This function will work only when
your application is opened with the runtime engine.
Syntax Launch_GetProdName(product_ID)
Parameters • product_ID – An integer designating the product ID. You can return a
product ID using Launch_GetProdID().
Examples The following example returns the product name “Lead Maintenance” from
the launch file. In the launch file, the Lead Maintenance application’s ID is
4549.
Launch_GetProdPosition()
Description The Launch_GetProdPosition() function returns the position of a product
in the launch file. This function will work only when your application is
opened with the runtime engine.
Syntax Launch_GetProdPosition(product_ID)
Parameters • product_ID – An integer designating the product ID. You can return a
product ID using Launch_GetProdID().
l_position = Launch_GetProdPosition(4549);
278 F U N C T I O N L I B R A R Y R E F E R E N C E
L A U N C H _ P A R S E F I L E F R O M P A T H ()
Launch_ParseFileFromPath()
Description The Launch_ParseFileFromPath() function parses a file’s operating system
name from a generic pathname.
Syntax Launch_ParseFileFromPath(file_path)
Comments The file_path must be in a generic format prior to parsing the file name from
it using this function. All Dexterity commands that return pathnames will
do so in generic format. The following illustration shows a generic path and
the resulting operating system name that’s parsed:
A generic pathname
:C:DEXAPPS/SYSTEM/SYSTEM.DIC
Examples This example parses a launch file’s operating system name from a generic
path returned by the getfile() function.
Launch_ReadDictPath()
Description The Launch_ReadDictPath() function returns the location of an
application, forms, or reports dictionary from the launch file. This function
will work only when your application is opened with the runtime engine.
Parameters • launch_file_location – A string containing the full generic path to the launch
file, including the file name. Both Launch_SelectFile() and
Launch_GetFileName() return the full path and name of a launch file.
Value Description
0 Application dictionary
1 Forms dictionary
2 Reports dictionary
Comments Once you read a dictionary location using this function, you can then
modify the location, and write changes to the launch file using
Launch_WriteDictPath().
Examples This example retrieves the forms dictionary path for a product whose
launch file information is already displayed in a window:
'Form Dict Path' = Launch_ReadDictPath('Launch File', 'Product ID',
➥ 1, 'Dictionary Location ID');
280 F U N C T I O N L I B R A R Y R E F E R E N C E
L A U N C H _ S E L E C T D I C T ()
Launch_SelectDict()
Description The Launch_SelectDict() function displays an operating system dialog box,
from which you can select a dictionary location.
Parameters • dictionary_name – The name of the dictionary as it will appear in the File
Name field within the dialog box.
• pathname – A returned string for the generic path. The dictionary_name will
appear at the end of this path.
Return value A boolean indicating the result; true if the user selected a launch file, false if
the user clicked Cancel.
Comments The dialog box displays the dictionary_name in the File Name field. This
name appears as a reference only and shouldn’t be modified. The dialog
box is shown in the following illustration:
Once a location is specified and the user clicks OK, the returned pathname
includes the dictionary_name that initially appeared in the file dialog box.
You can add the pathname returned by this function to a launch file using
the Launch_WriteDictPath() function. This pathname is in a generic format
and must remain in this format when added to the launch file.
Examples The following example displays a file dialog box, allowing the user to
choose a location for a dictionary. The new location is then saved to the
launch file using the Launch_WriteDictPath() function.
282 F U N C T I O N L I B R A R Y R E F E R E N C E
L A U N C H _ S E L E C T F I L E ()
Launch_SelectFile()
Description The Launch_SelectFile() function displays an operating system dialog, in
which you can select a launch file.
Syntax Launch_SelectFile(pathname)
Return value A boolean indicating the result; true if the user selected a launch file, false if
the user clicked Cancel.
Comments The *.SET will appear in the File of type field, and all launch files in the
current directory will be displayed in the dialog box.
Examples This example uses Launch_SelectFile() to display a dialog box. The launch
file returned by this function is then used in the Launch_GetFileInfo()
function to fill list fields:
if Launch_SelectFile(l_pathname) then
{The user chose a launch file.}
l_result = Launch_GetFileInfo(l_pathname, 'Product IDs',
➥ 'Products', 'Dictionary Location IDs');
end if;
Launch_WriteDictPath()
Description The Launch_WriteDictPath() function writes the location of an application,
forms or reports dictionary to the launch file.
Parameters • launch_file_location – A string containing the full generic path to the launch
file, including the file name. Both the Launch_SelectFile() and
Launch_GetFileName() functions return the full path and name of a launch
file.
Value Description
0 Application dictionary
1 Forms dictionary
2 Reports dictionary
284 F U N C T I O N L I B R A R Y R E F E R E N C E
L A U N C H _ W R I T E D I C T P A T H ()
Comments If you choose to modify dictionary pathnames in the launch file, be aware
of the following:
• Modified pathnames written to the launch file will take effect only after
you restart the application.
Examples This example displays a dialog box using the Launch_SelectDict() function.
The pathname returned by this function is then written to the launch file
using the Launch_WriteDictPath() function.
288 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ C O L U M N A D D ()
ListView_ColumnAdd()
Description The ListView_ColumnAdd() function adds a column to the list view field,
based on the data for the specified subitem.
Parameters • list_view_field – The list view field to which a column is being added.
• alignment – An optional integer specifying how the data in the column will
be aligned. The value corresponds to one of the following constants:
Constant Description
LV_ALIGN_LEFT Items will be left-aligned.
LV_ALIGN_CENTER Items will be center-aligned.
LV_ALIGN_RIGHT Items will be right-aligned.
Return value An integer containing the index of the new column. The value 1 indicates
the first column that was added to the list, 2 indicates the second column
that was added, and so on.
Comments If the list view field is shown in report view mode, add all of the items and
subitems before adding columns. This prevents the list view field from
flashing as items are added, because the items are shown only after
columns are added.
290 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ C O L U M N C O U N T ()
ListView_ColumnCount()
Description The ListView_ColumnCount() function retrieves the total number of
columns that have been added to a list view field.
Syntax ListView_ColumnCount(list_view_field)
Parameters • list_view_field – The list view field whose columns will be counted.
Return value An integer containing the total number of columns that have been added to
the list view field.
for i = 1 to column_count do
{Resize the column.}
previous_width = ListView_ColumnSetWidth('Explorer List', i,
➥ LV_AUTO_SIZE);
end for;
ListView_ColumnGetAlignment()
Description The ListView_ColumnGetAlignment() function retrieves the alignment of
the specified column of a list view field.
Parameters • list_view_field – The list view field containing the specified column.
Dragging a column to a different position in the list view does not affect the column
index.
Constant Description
LV_ALIGN_LEFT Items will be left-aligned.
LV_ALIGN_CENTER Items will be center-aligned.
LV_ALIGN_RIGHT Items will be right-aligned.
292 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _C O L U M N G E T L A B E L ()
ListView_ColumnGetLabel()
Description The ListView_ColumnGetLabel() function retrieves the label of the
specified column of a list view field.
Parameters • list_view_field – The list view field containing the specified column.
Dragging a column to a different position in the list view does not affect the column
index.
ListView_ColumnGetPosition()
Description The ListView_ColumnGetPosition() function retrieves the position of the
specified column of a list view field.
Parameters • list_view_field – The list view field containing the specified column.
Dragging a column to a different position in the list view does not affect the column
index.
Return value An integer containing the column position. The value 1 indicates the first
column in the list.
294 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ C O L U M N G E T S U B I T E M ()
ListView_ColumnGetSubitem()
Description The ListView_ColumnGetSubitem() function retrieves the number of the
subitem associated with the column.
Parameters • list_view_field – The list view field containing the specified column.
Dragging a column to a different position in the list view does not affect the column
index.
Return value An integer indicating the subitem associated with the column.
Comments You can specify the subitem associated with a column only when you add
the column to the list view field. If you want to change the subitem
associated with a column, you must remove the column and then re-add it
based on the new subitem.
ListView_ColumnGetWidth()
Description The ListView_ColumnGetWidth() function retrieves the width, in pixels,
of the specified column.
Parameters • list_view_field – The list view field containing the specified column.
Dragging a column to a different position in the list view does not affect the column
index.
296 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ C O L U M N R E M O V E ()
ListView_ColumnRemove()
Description The ListView_ColumnRemove() function removes the specified column
from a list view field.
Parameters • list_view_field – The list view field from which a column is being removed.
Dragging a column to a different position in the list view does not affect the column
index.
Return value A boolean indicating whether the column was removed. True indicates the
column was removed, while false indicates it was not.
Comments When you remove a column, the column indexes for the remaining
columns may change. The column indexes greater than that of the column
removed will decrease by one. For example, the list view field in the
following illustration has six columns. Column four is removed.
Column index: 1 2 3 4 5 6
This column is
being removed.
The column whose column index was 5 now has the column index 4.
Likewise, the column whose index was 6 now has the column index 5.
Column index: 1 2 3 4 5
298 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _C O L U M N S E T A L I G N M E N T ()
ListView_ColumnSetAlignment()
Description The ListView_ColumnSetAlignment() function specifies the alignment of
a column in a list view field.
Parameters • list_view_field – The list view field containing the specified column.
Dragging a column to a different position in the list view does not affect the column
index.
Constant Description
LV_ALIGN_LEFT Items will be left-aligned.
LV_ALIGN_CENTER Items will be center-aligned.
LV_ALIGN_RIGHT Items will be right-aligned.
Return value An integer value indicating the previous alignment of the column. The
value corresponds to one of the constants listed for the alignment parameter.
for i = 1 to column_count do
{Set the column alignment.}
previous_alignment = ListView_ColumnSetAlignment('Explorer List',
➥ i, LV_ALIGN_CENTER);
end for;
ListView_ColumnSetLabel()
Description The ListView_ColumnSetLabel() function sets the label of the specified
column of a list view field.
Parameters • list_view_field – The list view field containing the specified column.
Dragging a column to a different position in the list view does not affect the column
index.
Return value A boolean indicating whether the column label was changed. True indicates
the label was changed, while false indicates it was not.
300 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ C O L U M N S E T P O S I T I O N ()
ListView_ColumnSetPosition()
Description The ListView_ColumnSetPosition() function sets the position of the
specified column of a list view field.
Parameters • list_view_field – The list view field containing the specified column.
Dragging a column to a different position in the list view does not affect the column
index.
• position – An integer specifying the position for the column. The value 1
indicates the first column in the list.
ListView_ColumnSetWidth()
Description The ListView_ColumnSetWidth() function sets the width of the specified
column.
Parameters • list_view_field – The list view field containing the specified column.
Dragging a column to a different position in the list view does not affect the column
index.
• width – An integer specifying the column width in pixels. If you are setting
the width of a column that contains the icon image or state image for the
item, include the constant LV_ICON_WIDTH to account for the width of
the image.
To automatically set the width of the column, use one of the following
constants:
Constant Description
LV_AUTO_SIZE Sets the width of the column so that the widest item in
the column will be fully displayed.
LV_AUTO_FIT This constant can be used only for the last column.
The column will be resized to fill the remaining space
in the list view field.
302 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ C O L U M N S E T W I D T H ()
for i = 1 to (column_count - 1) do
{Resize the column.}
previous_width = ListView_ColumnSetWidth('Explorer List', i,
➥ LV_AUTO_SIZE);
end for;
ListView_GetClickItem()
Description The ListView_GetClickItem() function returns the index of the item that
was most recently clicked.
Parameters • list_view_field – The list view field containing the item that was clicked.
Return value A long integer containing the index of the item that was clicked. The value
LV_INVALID is returned if no item was clicked.
Comments This function is typically used only in the state click script or double-click
script for a list view field. In those scripts, it retrieves the item index and
column index indicating where the user clicked.
Examples The following example is the state click script for the Explorer List list view
field. It uses the ListView_GetClickItem() function to find out which
item’s state image was clicked. The script then toggles the state image
between the checked and unchecked icons.
304 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ G E T S O R T C O L U M N ()
ListView_GetSortColumn()
Description The ListView_GetSortColumn() function returns the index of the column
by which the list view field is being sorted. It also returns whether items in
the column are sorted in ascending or descending order.
Parameters • list_view_field – The list view field from which sorting information is being
retrieved.
Constant Description
LV_SORT_ASCENDING The column items are sorted in ascending order.
LV_SORT_DESCENDING The column items are sorted in descending order.
Return value An integer containing the index of the column by which the list view field is
being sorted.
ListView_GetStringWidth()
Description The ListView_GetStringWidth() function returns the number of pixels
required to fully display a string in the current font of a specified list view
field.
Parameters • list_view_field – The list view field in which the string will be displayed.
Return value An integer containing the number of pixels required to fully display the
string.
Comments This function is typically used to find out whether a specific string will fit in
a column of a list view field. If necessary, use the
ListView_ColumnSetWidth() function to change the width of a column to
display the string without truncating.
306 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ G E T V I E W ()
ListView_GetView()
Description The ListView_GetView() function retrieves the current view mode for the
specified list view field.
Syntax ListView_GetView(list_view_field)
Parameters • list_view_field – The list view field for which the view mode is being
returned.
Constant Description
LV_SMICON_VIEW Small icon view
LV_LGICON_VIEW Large icon view
LV_LIST_VIEW List view
LV_REPORT_VIEW Report view
ListView_ItemAdd()
Description The ListView_ItemAdd() function adds an item to a list view field.
Parameters • list_view_field – The list view field to which a new item is being added.
• label – A string specifying the text that will appear with the item.
• data – A long integer specifying the data value to associate with the item.
• image – An optional integer specifying the picture to display with the item.
The value corresponds to the item number of an item image listed in the
ListView Images window.
Return value A long integer containing the index of the new list view item.
Comments Be aware that the index of an item may change. For example, when the list
is re-sorted, a list view item may appear in a different location in the list.
Thus, its index value will have changed.
Each new item is added to the bottom of the list, regardless of the sorting
option specified for the list view field. After adding new list view items,
you can use the ListView_Sort() function to re-sort the entire list.
Examples The following example uses the ListView_ItemAdd() function to add items
from the Seller Data table to the Explorer List list view field. Then the
ListView_ItemSetSubitem() function is used to set the subitems for the
new list view item. Finally, the ListView_ColumnAdd() function is used to
add the columns to the list.
308 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ I T E M A D D ()
ListView_ItemCount()
Description The ListView_ItemCount() function retrieves the number of items
currently in a list view field.
Syntax ListView_ItemCount(list_view_field)
Parameters • list_view_field – The list view field whose items are being counted.
Return value A long integer containing the number of items in the list view field.
310 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ I T E M G E T C U R R E N C Y S U B I T E M ()
ListView_ItemGetCurrencySubitem()
Description The ListView_ItemGetCurrencySubitem() function retrieves a currency or
variable currency value from the additional component of a subitem.
• item_index – A long integer specifying the list view item from which a
currency subitem is being retrieved.
ListView_ItemGetData()
Description The ListView_ItemGetData() function retrieves the long integer data item
associated with the specified list view item.
Parameters • list_view_field – The list view field containing the specified item.
• item_index – A long integer specifying the list view item whose data item is
being retrieved.
Return value A long integer containing the data item for the specified list view item.
312 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ I T E M G E T D A T E S U B I T E M ()
ListView_ItemGetDateSubitem()
Description The ListView_ItemGetDateSubitem() function retrieves a date value from
the additional component of a subitem.
• item_index – A long integer specifying the list view item from which a date
subitem is being retrieved.
ListView_ItemGetImage()
Description The ListView_ItemGetImage() function retrieves the item numbers of the
images associated with the specified list view item.
Parameters • list_view_field – The list view field containing the specified item.
• item_index – A long integer specifying the list view item whose image item
number is being retrieved.
Return value An integer indicating the image. This value corresponds to the item number
of an item image listed in the ListView Images window. If no image is
associated with the item, the LV_NOIMAGE constant is returned.
314 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ I T E M G E T I N T S U B I T E M ()
ListView_ItemGetIntSubitem()
Description The ListView_ItemGetIntSubitem() function retrieves an integer or long
integer value from the additional component of a subitem.
• item_index – A long integer specifying the list view item from which an
integer or long integer subitem is being retrieved.
ListView_ItemGetLabel()
Description The ListView_ItemGetLabel() function retrieves the label of the specified
list view item.
Parameters • list_view_field – The list view field containing the specified item.
• item_index – A long integer specifying the list view item whose label is
being retrieved.
316 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _I T E M G E T S T A T E I M A G E ()
ListView_ItemGetStateImage()
Description The ListView_ItemGetStateImage() function retrieves the item number of
the state image associated with the specified list view item.
Parameters • list_view_field – The list view field containing the specified item.
• item_index – A long integer specifying the list view item whose state image
item number is being retrieved.
Return value An integer indicating the image. This value corresponds to the item number
of a state image listed in the ListView Images window. If no state image is
associated with the item, the LV_NOIMAGE constant is returned.
Examples The following example is the state click script for the Explorer List list view
field. It uses the ListView_GetStateImage() function to find out which state
image is displayed for the item the user clicked. Then the state image is
toggled between the checked and unchecked icon.
ListView_ItemGetSubitem()
Description The ListView_ItemGetSubitem() function retrieves a subitem from the
specified list view item.
Parameters • list_view_field – The list view field containing the specified item.
• item_index – A long integer specifying the list view item from which a
subitem is being retrieved.
Comments You can use the ListView_ItemGetSubitem() function to retrieve the label
of a list view item by specifying 0 or the constant LV_ITEM_LABEL as the
subitem to retrieve.
318 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ I T E M G E T T I M E S U B I T E M ()
ListView_ItemGetTimeSubitem()
Description The ListView_ItemGetTimeSubitem() function retrieves a time value from
the additional component of a subitem.
• item_index – A long integer specifying the list view item from which a time
subitem is being retrieved.
ListView_ItemMakeVisible()
Description The ListView_ItemMakeVisible() function makes the specified item in a
list view field visible. If necessary, the contents of the list view field will be
scrolled to make the specified item visible.
Parameters • list_view_field – The list view field containing the specified item.
• item_index – A long integer specifying the list view item to make visible.
Return value A boolean indicating whether the item was made visible. True indicates the
item was made visible, while false indicates it was not.
Comments Making an item visible does not select the item. To select the item, use
ListView_SelectionSet().
320 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ I T E M R E M O V E ()
ListView_ItemRemove()
Description The ListView_ItemRemove() function removes the specified item from a
list view field.
Parameters • list_view_field – The list view field containing the specified item.
Return value A boolean indicating whether the item was removed. True indicates the
item was removed, while false indicates it was not.
Comments When an item is removed from a list view field, all of its subitems are
removed as well.
ListView_ItemSetCurrencySubitem()
Description The ListView_ItemSetCurrencySubitem() function sets the value of the
additional component of a subitem to a currency or variable currency value.
• item_index – A long integer specifying the list view item for which a
currency or variable currency subitem is being set.
• subitem – An integer specifying the subitem to set. You can set the
additional component for the label of a list view item by by specifying 0 as
the subitem to set.
Return value A boolean indicating whether the subitem was set. True indicates the
subitem was set, while false indicates it was not.
Comments Each subitem of a list view item can have a string , which is shown when
the list view is displayed in report view mode. A subitem can also have a
currency, integer, date, or time component that stores a value to be used for
sorting the contents of the list.
By default, a list view will use the string component of a subitem when
sorting a column in the list view. The list view items will be sorted in ASCII
order, which may not be appropriate if the column contains currency,
integer, date or time values. If the subitems in the column have currency,
integer, date or time components, those will be used to sort the list, rather
than the string values.
322 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ I T E M S E T C U R R E N C Y S U B I T E M ()
{Find out how wide the items are that were added.}
for j = 1 to 6 do
item_width = ListView_GetStringWidth(Explorer_List of window
➥ RESM_Explorer, ListView_ItemGetSubitem(Explorer_List of
➥ window RESM_Explorer, item_index, j-1));
if item_width > column_width[j] then
column_width[j] = item_width;
end if;
end for;
{Find out whether the house has been sold. If so, set the
➥ appropriate state image.}
if Sold of table House_Data = true then
prev_image = ListView_ItemSetImage(Explorer_List of window
➥ RESM_Explorer of form RESM_Explorer, item_index, 3, 4);
end if;
324 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ I T E M S E T C U R R E N C Y S U B I T E M ()
ListView_ItemSetData()
Description The ListView_ItemSetData() function sets the data item associated with
the specified list view item.
Parameters • list_view_field – The list view field containing the specified item.
• item_index – A long integer specifying the list view item whose data item is
being set.
Return value A long integer containing the previous data item for the specified list view
item.
Examples The following example uses the ListView_ItemSetData() function to set the
data item of every item in the Explorer List list view field to -1.
for i = 1 to item_count do
{Set the data value to -1.}
previous_value = ListView_ItemSetData('Explorer List', i, -1);
end for;
326 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ I T E M S E T D A T E S U B I T E M ()
ListView_ItemSetDateSubitem()
Description The ListView_ItemSetDateSubitem() function sets the value of the
additional component of a subitem to a date value.
• item_index – A long integer specifying the list view item for which a date
subitem is being set.
• subitem – An integer specifying the subitem to set. You can set the
additional component for the label of a list view item by by specifying 0 as
the subitem to set.
Return value A boolean indicating whether the subitem was set. True indicates the
subitem was set, while false indicates it was not.
Comments Each subitem of a list view item can have a string , which is shown when
the list view is displayed in report view mode. A subitem can also have a
currency, integer, date, or time component that stores a value to be used for
sorting the contents of the list.
By default, a list view will use the string component of a subitem when
sorting a column in the list view. The list view items will be sorted in ASCII
order, which may not be appropriate if the column contains currency,
integer, date or time values. If the subitems in the column have currency,
integer, date or time components, those will be used to sort the list, rather
than the string values.
ListView_ItemSetImage()
Description The ListView_ItemSetImage() function sets the item image associated with
the specified list view item.
Parameters • list_view_field – The list view field containing the specified item.
• item_index – A long integer specifying the list view item whose item image
is being set.
Return value An integer containing the item number of the previous item image for the
specified list view item. If no item image was associated with the list view
item, the constant LV_NOIMAGE is returned.
for i = 1 to item_count do
{Set the image to LV_NOIMAGE.}
previous_image = ListView_ItemSetImage('Explorer List', i,
➥ LV_NOIMAGE);
end for;
328 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ I T E M S E T I N T S U B I T E M ()
ListView_ItemSetIntSubitem()
Description The ListView_ItemSetIntSubitem() function sets the value of the
additional component of a subitem to an integer or long integer value.
• item_index – A long integer specifying the list view item for which an
integer or long integer subitem is being set.
• subitem – An integer specifying the subitem to set. You can set the
additional component for the label of a list view item by by specifying 0 as
the subitem to set.
Return value A boolean indicating whether the subitem was set. True indicates the
subitem was set, while false indicates it was not.
Comments Each subitem of a list view item can have a string , which is shown when
the list view is displayed in report view mode. A subitem can also have a
currency, integer, date, or time component that stores a value to be used for
sorting the contents of the list.
By default, a list view will use the string component of a subitem when
sorting a column in the list view. The list view items will be sorted in ASCII
order, which may not be appropriate if the column contains currency,
integer, date or time values. If the subitems in the column have currency,
integer, date or time components, those will be used to sort the list, rather
than the string values.
ListView_ItemSetLabel()
Description The ListView_ItemSetLabel() function sets the label of the specified list
view item.
Parameters • list_view_field – The list view field containing the specified item.
• item_index – A long integer specifying the list view item whose label is
being set.
Return value A boolean indicating whether the item label was changed. True indicates
the label was changed, while false indicates it was not.
330 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ I T E M S E T S T A T E I M A G E ()
ListView_ItemSetStateImage()
Description The ListView_ItemSetStateImage() function sets the state image associated
with the specified list view item.
Parameters • list_view_field – The list view field containing the specified item.
• item_index – A long integer specifying the list view item whose state image
is being set.
Return value An integer containing the item number of the previous state image for the
specified list view item. If no state image was associated with the list view
item, the constant LV_NOIMAGE is returned.
Examples The following example is the state click script for the Explorer List list view
field. The ListView_ItemSetStateImage() function toggles the state image
between the checked and unchecked icon.
ListView_ItemSetSubitem()
Description The ListView_ItemSetSubitem() function sets the value of a subitem for
the specified list view item.
Parameters • list_view_field – The list view field containing the specified item.
• item_index – A long integer specifying the list view item for which a subitem
is being set.
Return value A boolean indicating whether the subitem was set. True indicates the
subitem was set, while false indicates it was not.
Comments You can use the ListView_ItemSetSubitem() function to set the label of a
list view item by specifying 0 or the constant LV_ITEM_LABEL as the
subitem to set.
332 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ I T E M S E T T I M E S U B I T E M ()
ListView_ItemSetTimeSubitem()
Description The ListView_ItemSetTimeSubitem() function sets the value of the
additional component of a subitem to a time value.
• item_index – A long integer specifying the list view item for which a time
subitem is being set.
• subitem – An integer specifying the subitem to set. You can set the
additional component for the label of a list view item by by specifying 0 as
the subitem to set.
Return value A boolean indicating whether the subitem was set. True indicates the
subitem was set, while false indicates it was not.
Comments Each subitem of a list view item can have a string , which is shown when
the list view is displayed in report view mode. A subitem can also have a
currency, integer, date, or time component that stores a value to be used for
sorting the contents of the list.
By default, a list view will use the string component of a subitem when
sorting a column in the list view. The list view items will be sorted in ASCII
order, which may not be appropriate if the column contains currency,
integer, date or time values. If the subitems in the column have currency,
integer, date or time components, those will be used to sort the list, rather
than the string values.
ListView_SelectionCount()
Description The ListView_SelectionCount() function retrieves the number of items
currently selected in a list view field.
Syntax ListView_SelectionCount(list_view_field)
Parameters • list_view_field – The list view field for which the selection count is being
returned.
Return value A long integer containing the number of items that are selected.
334 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ S E L E C T I O N G E T ()
ListView_SelectionGet()
Description The ListView_SelectionGet() function retrieves the item index of the
specified item in the selection.
Parameters • list_view_field – The list view field for which the selection count is being
returned.
• offset – An optional long integer that specifies which item in the selection
will be returned. The value 1 indicates the first item in the selection, 2 the
second item, and so on. If this parameter is not included, the first item in the
selection is returned.
This parameter should be used only for list view fields that have the MultiSel
property set to true.
Return value A long integer containing the item index of the specified item in the
selection.
ListView_SelectionSet()
Description The ListView_SelectionSet() function changes the selection in a list view
field.
Parameters • list_view_field – The list view field whose selection is being changed.
• item_index – A long integer specifying the item that is being selected, added
to the selection or removed from the selection. You can also use one of the
following constants:
Constant Description
LV_ALL Specifies that all items will be selected.
LV_NONE Specifies that no items will be selected.
• mode – An optional integer parameter that is used for list view fields that
allow multiple selections. The value corresponds to one of the following
constants:
Constant Description
LV_SELECTION_ADD Adds the specified item to the current selection.
LV_SELECTION_REMOVE Removes the specified item from the current selection.
If this parameter isn’t included, the selection is changed to include only the
specified item.
Return value A boolean indicating whether the selection was set. True indicates the
selection was set, while false indicates it was not.
Examples The following example selects the first item in the Explorer List list view
field.
336 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _S E L E C T I O N S E T ()
The following example adds the third item of the Explorer List list view
field to the current selection.
The following example selects all items in the Explorer List list view field.
The following example clears the selection of the Explorer List list view
field.
ListView_SetEmptyMessage()
Description The ListView_SetEmptyMessage() function specifies the message to
display when the list view doesn’t contain any items.
Parameters • list_view_field – The list view field for which the empty message is being set.
• message – A string containing the message to display when the list view
contains no items.
Return value A boolean indicating whether the message was set. True indicates the
message was set, while false indicates it was not.
338 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ S E T S O R T C O L U M N ()
ListView_SetSortColumn()
Description The ListView_SetSortColumn() function specifies the column by which a
list view field is sorted.
Parameters • list_view_field – The list view field for which sorting is being specified.
Dragging a column to a different position in the list view does not affect the column
index.
Constant Description
LV_SORT_ASCENDING The column will be sorted in ascending order.
LV_SORT_DESCENDING The column will be sorted in descending order.
• refresh – An optional boolean. If set to true, the list view field is re-sorted
immediately. If set to false, the list view field must be updated manually
using the ListView_Sort() function.
Return value An integer containing the column index of the column by which the list was
previously sorted.
sort_column = value(Defaults_Read("ExpSortCol"));
sort_mode = value(Defaults_Read("ExpSortMode"));
340 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ S E T V I E W ()
ListView_SetView()
Description The ListView_SetView() function sets the view mode for the specified list
view field.
Parameters • list_view_field – The list view field for which the view mode is being set.
Constant Description
LV_SMICON_VIEW Small icon view
LV_LGICON_VIEW Large icon view
LV_LIST_VIEW List view
LV_REPORT_VIEW Report view
Return value An integer containing the previous view mode for the list view field. The
value corresponds to one of the constants listed for the view_mode
parameter.
Examples The following example uses the ListView_SetView() function to set the
view mode of the Explorer List list view field, based on a defaults file
setting.
defaults_value = Defaults_Read("ExpMode");
ListView_Sort()
Description The ListView_Sort() function sorts the items in a list view field.
Constant Description
LV_SORT_ASCENDING Items are sorted in ascending order based on the item
label.
LV_SORT_DESCENDING Items are sorted in descending order based on the
item label.
LV_SORT_COLUMN Items are sorted based on a column in the list.
LV_SORT_NONE Items are not sorted.
LV_SORT_DEFAULT Items are sorted using the method specified by the
SortMethod property.
If this parameter isn’t included, the list view field will be re-sorted based on
the current sorting method.
Return value A boolean indicating whether the list view field was sorted. True indicates
the list view was sorted, while false indicates it was not.
When items are added to a list view field, they are added at the bottom of
the list, regardless of how the list is currently being sorted. You can use the
ListView_Sort() function after adding items to re-sort the list.
Examples The following example uses the ListView_Sort() function to sort the
Explorer List list view field. The items in the list will be sorted in
descending order.
342 F U N C T I O N L I B R A R Y R E F E R E N C E
L I S T V I E W _ S O R T ()
The following example re-sorts the Explorer List list view field using the
sorting method specified by the SortMethod property of the field.
Login_AlterLogin() SQL
Parameters • data_source – A string specifying the data source to use to connect to the
SQL server.
• user_ID – A string specifying the ID of the user login that is being altered.
• login_options – A long integer that specifying the option settings to use for
the SQL login. This is a bitmask value. The following table lists the options
and their corresponding hexadecimal values:
Option Value
Enforce password policy 0x01000000
Enforce password expiration 0x02000000
Change password on next login 0x00800000
These options apply only to logins for SQL Server 2005. They are ignored for SQL
Server 2000.
346 F U N C T I O N L I B R A R Y R E F E R E N C E
L O G I N _ A L T E R L O G I N ()
Return value An integer specifying the status of the operation. The following table lists
the constants that correspond to the values that can be returned.
Constant Description
STATUS_SUCCESS Operation was successful.
STATUS_MEMORY_ERROR A memory error occurred.
STATUS_TOO_MANY_CONNECTIONS Too many SQL connection in use to
perform the operation.
STATUS_DATASOURCE_REJ The SQL server rejected the operation.
STATUS_UNABLE_TO_CONNECT Unable to connect to the data source.
STATUS_LOGIN_LOCKED Login is locked.
STATUS_LOGIN_PASSWORD_HISTORY Password supplied violates password
history.
STATUS_LOGIN_PASSWORD_SHORT Password specified is too short.
STATUS_LOGIN_PASSWORD_LONG Password specified is too long.
STATUS_LOGIN_PASSWORD_SIMPLE Password specified is too simple.
STATUS_LOGIN_PASSWORD_UNKNOWN Password is unknown.
STATUS_LOGIN_PASSWORD_POLICY The password specified violates the
password policy.
STATUS_LOGIN_INVALID The login is not valid to perform the
operation.
STATUS_INVALID_PERMISSIONS The login had invalid permissions to
perform the operation.
STATUS_NOT_LOGGED_IN No user is logged in to perform the
operation.
Comments A SQL administrator can use this command to change any specific user’s
password or login options. A user can use this command to change only
their own password.
Examples The following example shows how a SQL administrator can set the login
options for a specific login on SQL Server 2005. The options are set to
enforce the password policy and password expiration.
case status
in [STATUS_SUCCESS]
warning "Login successfully updated.";
in [STATUS_MEMORY_ERROR]
warning "Memory error.";
in [STATUS_LOGIN_FAILED]
warning "Login failed.";
in [STATUS_TOO_MANY_CONNECTIONS]
warning "Too many connections.";
in [STATUS_DATASOURCE_REJ]
warning "Datasource rejection.";
in [STATUS_UNABLE_TO_CONNECT]
warning "Unable to connect.";
in [STATUS_LOGIN_INVALID]
warning "Login invalid.";
in [STATUS_INVALID_PERMISSIONS]
warning "Invalid permissions.";
in [STATUS_NOT_LOGGED_IN]
warning "Not logged in.";
end case;
The following example shows how a SQL administrator can set the
password for a specific login. In this case, the password for the login
“STEVE” is changed to “GreenRoutine5”.
local integer status;
local long retcode;
local long login_options;
348 F U N C T I O N L I B R A R Y R E F E R E N C E
L O G I N _ A L T E R L O G I N ()
case status
in [STATUS_SUCCESS]
warning "Login successfully updated.";
in [STATUS_MEMORY_ERROR]
warning "Memory error.";
in [STATUS_LOGIN_FAILED]
warning "Login failed.";
in [STATUS_TOO_MANY_CONNECTIONS]
warning "Too many connections.";
in [STATUS_DATASOURCE_REJ]
warning "Datasource rejection.";
in [STATUS_UNABLE_TO_CONNECT]
warning "Unable to connect.";
in [STATUS_LOGIN_INVALID]
warning "Login invalid.";
in [STATUS_INVALID_PERMISSIONS]
warning "Invalid permissions.";
in [STATUS_NOT_LOGGED_IN]
warning "Not logged in.";
in [STATUS_LOGIN_PASSWORD_SIMPLE]
warning "Password is too simple.";
in [STATUS_LOGIN_PASSWORD_SHORT]
warning "Password is too short.";
in [STATUS_LOGIN_PASSWORD_LONG]
warning "Password is too long.";
in [STATUS_LOGIN_PASSWORD_HISTORY]
warning "Password violates password history.";
end case;
The following example shows how a user can change their own password.
In this case, the password for the user “STEVE” is being changed from
“GreenRoutine5” to “PolarJoy8”.
case status
in [STATUS_SUCCESS]
warning "Login successfully updated.";
in [STATUS_MEMORY_ERROR]
warning "Memory error.";
in [STATUS_LOGIN_FAILED]
warning "Login failed.";
in [STATUS_TOO_MANY_CONNECTIONS]
warning "Too many connections.";
in [STATUS_DATASOURCE_REJ]
warning "Datasource rejection.";
in [STATUS_UNABLE_TO_CONNECT]
warning "Unable to connect.";
in [STATUS_LOGIN_INVALID]
warning "Login invalid.";
in [STATUS_INVALID_PERMISSIONS]
warning "Invalid permissions.";
in [STATUS_NOT_LOGGED_IN]
warning "Not logged in.";
in [STATUS_LOGIN_PASSWORD_SIMPLE]
warning "Password is too simple.";
in [STATUS_LOGIN_PASSWORD_SHORT]
warning "Password is too short.";
in [STATUS_LOGIN_PASSWORD_LONG]
warning "Password is too long.";
in [STATUS_LOGIN_PASSWORD_HISTORY]
warning "Password violates password history.";
end case;
350 F U N C T I O N L I B R A R Y R E F E R E N C E
L O G I N _ C R E A T E L O G I N ()
Login_CreateLogin() SQL
Parameters • data_source – A string specifying the data source to use to connect to the
SQL server.
• user_ID – A string specifying the ID of the user login that is being created.
• password – An string that specifies the password to use for the SQL login.
• login_options – A long integer that specifying the option settings to use for
the SQL login. This is a bitmask value. The following table lists the options
and their corresponding hexadecimal values:
Option Value
Enforce password policy 0x01000000
Enforce password expiration 0x02000000
Change password on next login 0x00800000
These options apply only to logins for SQL Server 2005. They are ignored for SQL
Server 2000.
Return value An integer specifying the status of the operation. The following table lists
the constants that correspond to the values that can be returned.
Constant Description
STATUS_SUCCESS Operation was successful.
STATUS_MEMORY_ERROR A memory error occurred.
STATUS_TOO_MANY_CONNECTIONS Too many SQL connection in use to
perform the operation.
STATUS_DATASOURCE_REJ The SQL server rejected the operation.
STATUS_UNABLE_TO_CONNECT Unable to connect to the data source.
STATUS_LOGIN_LOCKED Login is locked.
STATUS_LOGIN_PASSWORD_HISTORY Password supplied violates password
history.
STATUS_LOGIN_PASSWORD_SHORT Password specified is too short.
STATUS_LOGIN_PASSWORD_LONG Password specified is too long.
STATUS_LOGIN_PASSWORD_SIMPLE Password specified is too simple.
STATUS_LOGIN_PASSWORD_UNKNOWN Password is unknown.
STATUS_LOGIN_EXISTS The login already exists.
STATUS_LOGIN_PASSWORD_POLICY The password specified violates the
password policy.
STATUS_LOGIN_INVALID The login is not valid to perform the
operation.
STATUS_INVALID_PERMISSIONS The login had invalid permissions to
perform the operation.
STATUS_NOT_LOGGED_IN No user is logged in to perform the
operation.
Comments The current user must have SQL administrative privileges to create a new
login.
Examples The following example creates a new SQL login for the GPSDK data source.
The SQL options specify that the password for the new login must be
changed when the login is first used.
local integer status;
local long retcode;
local long login_options;
352 F U N C T I O N L I B R A R Y R E F E R E N C E
L O G I N _ C R E A T E L O G I N ()
case status
in [STATUS_SUCCESS]
warning "Login successfully created.";
in [STATUS_MEMORY_ERROR]
warning "Memory error.";
in [STATUS_LOGIN_FAILED]
warning "Login failed.";
in [STATUS_TOO_MANY_CONNECTIONS]
warning "Too many connections.";
in [STATUS_DATASOURCE_REJ]
warning "Datasource rejection.";
in [STATUS_UNABLE_TO_CONNECT]
warning "Unable to connect.";
in [STATUS_LOGIN_LOCKED]
warning "Login locked.";
in [STATUS_LOGIN_PASSWORD_HISTORY]
warning "Login violated password history.";
in [STATUS_LOGIN_PASSWORD_SHORT]
warning "Password too short.";
in [STATUS_LOGIN_PASSWORD_LONG]
warning "Password too long.";
in [STATUS_LOGIN_PASSWORD_SIMPLE]
warning "Password too simple.";
in [STATUS_LOGIN_PASSWORD_UNKNOWN]
warning "Password unknown.";
in [STATUS_LOGIN_PASSWORD_EXPIRED]
warning "Password expired.";
in [STATUS_LOGIN_PASSWORD_MUST_CHANGE]
warning "Password must change.";
in [STATUS_LOGIN_EXISTS]
warning "Login already exists.";
in [STATUS_LOGIN_PASSWORD_POLICY]
warning "Password violates password policy.";
in [STATUS_LOGIN_INVALID]
warning "Login invalid.";
in [STATUS_INVALID_PERMISSIONS]
warning "Invalid permissions to create login.";
in [STATUS_NOT_LOGGED_IN]
warning "Not logged in.";
end case;
Login_DropLogin() SQL
Syntax Login_DropLogin(user_ID)
Parameters • user_ID – A string specifying the ID of the user login that is being dropped.
Return value An integer specifying the status of the operation. The following table lists
the constants that correspond to the values that can be returned.
Constant Description
STATUS_SUCCESS Operation was successful.
STATUS_MEMORY_ERROR A memory error occurred.
STATUS_TOO_MANY_CONNECTIONS Too many SQL connection in use to
perform the operation.
STATUS_DATASOURCE_REJ The SQL server rejected the operation.
STATUS_UNABLE_TO_CONNECT Unable to connect to the data source.
STATUS_LOGIN_LOCKED Login is locked.
STATUS_LOGIN_INVALID The login is not valid to perform the
operation.
STATUS_INVALID_PERMISSIONS The login had invalid permissions to
perform the operation.
STATUS_NOT_LOGGED_IN No user is logged in to perform the
operation.
Comments The current user must have SQL administrative privileges to drop a login.
Examples The following example drops the login “STEVE” from the current data
source.
status = Login_DropLogin("STEVE");
354 F U N C T I O N L I B R A R Y R E F E R E N C E
L O G I N _ E X I T D A T A S O U R C E ()
Login_ExitDataSource() SQL
Syntax Login_ExitDataSource()
Parameters • None
Constant Description
STATUS_SUCCESS The user logout was successful.
STATUS_ERROR An unknown error occurred.
STATUS_CANT_LOGOUT There are still open connections associated with this
user.
STATUS_NOT_LOGGED_IN The user isn’t logged into a data source.
Comments A user must log into a data source before his or her first connection can be
established. Subsequent connections to that data source for that user are
associated with the initial login. If one of those connections is being used to
access a table, Dexterity won’t allow the user to log out until the table is
closed and the connection is released.
Login_GetDataSources() SQL
Description The Login_GetDataSources() function fills a list box or drop-down list with
the names of all available data sources.
Syntax Login_GetDataSources(listbox)
Parameters • listbox – The name of the list box or drop-down list to be filled with a list of
available data source names.
Constant Description
STATUS_SUCCESS The list box was filled successfully.
STATUS_ERROR The list box wasn’t filled, due to an error.
Comments The data sources that are included in the list will vary from client to client.
Only the data sources that have been set up using a computer’s ODBC
driver manager will be included in the list displayed at that computer.
Examples The following example uses this function to fill the Data_Source_LB list
box, from which a user can select a data source to log into.
status = Login_GetDataSources(Data_Source_LB);
if status <> STATUS_SUCCESS then
{Display a message.}
warning "Unable to fill the data source list.";
end if;
356 F U N C T I O N L I B R A R Y R E F E R E N C E
L O G I N _ G E T D BM SI N F O ()
Login_GetDBMSInfo() SQL
Return value An integer indicating whether information was retrieved. The constant
STATUS_SUCCESS indicates information was retrieved. Any other value
indicates information could not be retrieved.
Comments You must be logged into a SQL data source for the Login_GetDBMSInfo()
function to retrieve information.
Login_GetInfo() SQL
Description The Login_GetInfo() function returns the name of the data source, the user
ID and session ID associated with the current session.
Parameters • data_source – A returned string containing the data source the current client
is logged into.
Constant Description
STATUS_SUCCESS The login information was successfully retrieved.
STATUS_NOT_LOGGED_IN A user isn’t logged in.
STATUS_ERROR An unknown error occurred.
358 F U N C T I O N L I B R A R Y R E F E R E N C E
L O G I N _ G E T L O G I N S E T T I N G S ()
Login_GetLoginSettings() SQL
Parameters • user_ID – A string specifying the ID of the user login for which settings are
being retrieved.
• login_options – A long integer that specifying the option settings to use for
the SQL login. This is a bitmask value. The following table lists the options
and their corresponding hexadecimal values:
Option Value
Enforce password policy 0x01000000
Enforce password expiration 0x02000000
Change password on next login 0x00800000
These options apply only to logins for SQL Server 2005. They are ignored for SQL
Server 2000.
Return value An integer specifying the status of the operation. The following table lists
the constants that correspond to the values that can be returned.
Constant Description
STATUS_SUCCESS Operation was successful.
STATUS_MEMORY_ERROR A memory error occurred.
STATUS_TOO_MANY_CONNECTIONS Too many SQL connection in use to
perform the operation.
STATUS_DATASOURCE_REJ The SQL server rejected the operation.
STATUS_UNABLE_TO_CONNECT Unable to connect to the data source.
STATUS_LOGIN_INVALID The login is not valid.
STATUS_INVALID_PERMISSIONS The login had invalid permissions to
perform the operation.
STATUS_NOT_LOGGED_IN No user is logged in to perform the
operation.
Examples The following example shows how a SQL administrator can set the
password for a specific login. In this case, the login options are retrieved so
that the same values will be used when the login is updated.
360 F U N C T I O N L I B R A R Y R E F E R E N C E
L O G I N _ L O G I N T O D A T A S O U R C E ()
Login_LogIntoDataSource() SQL
Description The Login_LogIntoDataSource() function logs the user into the named
data source using the specified user ID and password.
• user_ID – A string specifying the user ID to use when logging into the data
source.
• password – A string specifying the password to use when logging into the
named data source.
Constant Description
STATUS_SUCCESS The login was successful.
STATUS_ERROR An unknown error occurred.
STATUS_ALREADY_LOGGED_IN That user is already logged in.
STATUS_LOGIN_FAILED The login information was invalid.
STATUS_LOGIN_LOCKED Login is locked.
STATUS_TOO_MANY_CONNECTIONS The maximum number of connections to
the database was reached.
STATUS_DATASOURCE_REJ The server acknowledged the connection
attempt, but rejected it. The problem was
server-based.
STATUS_UNABLE_TO_CONNECT The client computer’s ODBC drivers were
unable to establish a connection to the
server. The problem was client-based.
STATUS_LOGIN_PASSWORD_EXPIRED Password has expired.
STATUS_LOGIN_PASSWORD_MUST_ The password must be changed before the
CHANGE user can log in.
Comments This command allows you to use your own login window, rather than the
predefined login window the Login_OpenDexDialog() function opens.
Examples The following example uses this function in a change script attached to the
OK button of a login window. The user selects a data source from a drop-
down list named Data_Source_DDL and enters a user ID and password.
362 F U N C T I O N L I B R A R Y R E F E R E N C E
L O G I N _ L O G I N T O D A T A S O U R C E E X ()
Login_LogIntoDataSourceEx() SQL
Description The Login_LogIntoDataSourceEx() function logs the user into the named
data source using the specified user ID and password. It also supports the
additional password features available for SQL Server 2005.
• user_ID – A string specifying the user ID to use when logging into the data
source.
• password – A string specifying the password to use when logging into the
named data source.
Constant Description
STATUS_SUCCESS The login was successful.
STATUS_ERROR An unknown error occurred.
STATUS_ALREADY_LOGGED_IN That user is already logged in.
STATUS_LOGIN_FAILED The login information was invalid.
STATUS_LOGIN_LOCKED Login is locked.
STATUS_TOO_MANY_CONNECTIONS The maximum number of connections to
the database was reached.
STATUS_DATASOURCE_REJ The server acknowledged the connection
attempt, but rejected it. The problem was
server-based.
STATUS_UNABLE_TO_CONNECT The client computer’s ODBC drivers were
unable to establish a connection to the
server. The problem was client-based.
STATUS_LOGIN_PASSWORD_EXPIRED Password has expired.
STATUS_LOGIN_PASSWORD_MUST_ The password must be changed before the
CHANGE user can log in.
Comments To support all of the login features in SQL Server 2005, you must be using
the SQL Native Client driver for your ODBC connection.
Examples The following example is the change script for the Login button on a
custom login window. It attempts to connect to the specified data source. If
the password must be changed on the initial login, the
Login_LogIntoDataSourceEx() function is used to specify the new
password and connect to the data source.
364 F U N C T I O N L I B R A R Y R E F E R E N C E
L O G I N _ L O G I N T O D A T A S O U R C E E X ()
in [STATUS_LOGIN_FAILED]
warning "Your user ID or password was invalid. Try again.";
in [STATUS_TOO_MANY_CONNECTIONS]
warning "No connections are available. Try later.";
in [STATUS_LOGIN_PASSWORD_MUST_CHANGE]
warning "Password must be changed.";
in [STATUS_LOGIN_PASSWORD_MUST_CHANGE]
warning "Password must be changed.";
in [STATUS_LOGIN_PASSWORD_POLICY]
warning "New password violates policy.";
in [STATUS_LOGIN_INVALID]
warning "Login invalid.";
in [STATUS_INVALID_PERMISSIONS]
warning "Invalid permissions.";
end case;
else
{Login and password change were successful, so
close the Login form}
close form Login;
end if;
end if;
end if;
else
{A status denoting a problem was returned.}
warning "An error has occurred.";
warning "Error: " + str(status);
end case;
else
{Login was successful, so close the login form.}
close form Login;
end if;
366 F U N C T I O N L I B R A R Y R E F E R E N C E
L O G I N _ O P E N D E X D I A L O G ()
Login_OpenDexDialog() SQL
Description The Login_OpenDexDialog() function allows the user to log into the
named data source using Dexterity’s predefined Login window.
Syntax Login_OpenDexDialog()
Parameters • None
Constant Description
STATUS_SUCCESS The login was successful.
STATUS_ERROR An unknown error occurred.
STATUS_ALREADY_LOGGED_IN That user is already logged in.
STATUS_LOGIN_FAILED The login information was invalid.
STATUS_CANCEL The user pressed the Cancel button.
STATUS_TOO_MANY_CONNECTIONS The maximum number of connections to the
database was reached.
STATUS_DATASOURCE_REJ The server acknowledged the connection
attempt, but rejected it. The problem was
server-based.
STATUS_UNABLE_TO_CONNECT The client computer’s ODBC drivers were
unable to establish a connection to the server.
The problem was client-based.
Comments This function opens a predefined Login window that prompts the user for a
data source, user ID and password. To use a login window you’ve created,
use the Login_LogIntoDataSource() function.
To assure your application’s security and data integrity, we recommend that you
don’t use the SQLPassword defaults file setting.
Examples The following example, which could be used in a pre script attached to an
application’s Main Menu, uses this function to log a user into a server using
the Dexterity’s predefined Login window.
status = Login_OpenDexDialog();
if status <> STATUS_SUCCESS then
case status
in [STATUS_ALREADY_LOGGED_IN]
warning "You're already logged in.";
in [STATUS_LOGIN_FAILED]
warning "Your user ID or password was invalid.";
in [STATUS_TOO_MANY_CONNECTIONS]
warning "No connections are available. Try later.";
else
{A status denoting a problem was returned.}
warning "An error has occurred.";
end case;
end if;
368 F U N C T I O N L I B R A R Y R E F E R E N C E
L O G I N _ V E R I F Y I N F O ()
Login_VerifyInfo() SQL
Description The Login_VerifyInfo() function verifies whether the specified user ID and
password are a valid combination for access to the named data source.
Parameters • data_source – A string specifying the data source to verify access for.
• user_ID – A string specifying the user ID for which access to the data source
should be verified.
Constant Description
STATUS_SUCCESS The login was successful.
STATUS_ERROR An unknown error occurred.
STATUS_LOGIN_FAILED The login information was invalid.
STATUS_TOO_MANY_CONNECTIONS The maximum number of connections to the
database was reached.
STATUS_DATASOURCE_REJ The server acknowledged the connection
attempt, but rejected it. The problem was
server-based.
STATUS_UNABLE_TO_CONNECT The client computer’s ODBC drivers were
unable to establish a connection to the
server. The problem was client-based.
STATUS_LOGIN_PASSWORD_EXPIRED Password has expired.
STATUS_LOGIN_PASSWORD_MUST_ The password must be changed before the
CHANGE user can log in.
Comments This function is intended to simplify the process of switching a user’s login
from one data source to another. Using this function, you can verify
whether the specified user is able to log into another data source before
logging the user out of the data source he or she is currently connected to. If
you’re developing an application that integrates with Microsoft Dynamics
GP, this function will be useful when switching users between companies,
where the information for each company is stored in different data sources.
Examples The following example verifies whether a user has access to a data source
other than the one he or she is currently logged into. If the user has access to
the named data source, the user is logged out of the current data source and
logged into the new one. If the user is unable to access the named data
source, he or she remains logged into the current data source.
370 F U N C T I O N L I B R A R Y R E F E R E N C E
Mail function library
Use the functions in this library when adding mail support to your
application. The functions in the Mail function library can send mail
through Exchange Web Services (EWS). EWS uses a web service interface to
communicate directly with a Microsoft Exchange or Office 365 server to
send mail. No e-mail client is required.
• Mail_AddressListAdd()
• Mail_AddressListCount()
• Mail_AddressListCreate()
• Mail_AddressListDestroy()
• Mail_AddressListGet()
• Mail_AddressListRemove()
• Mail_DisplayAddressDialog()
• Mail_DisplayReplyToDialog()
• Mail_GetServerType()
• Mail_GetSessionAddress()
• Mail_IsLoggedOn()
• Mail_LogOff()
• Mail_LogOn()
• Mail_ResolveAddress()
• Mail_Send()
• Mail_SendDialog()
• Mail_SetServerType()
Mail_AddressListAdd()
Description The Mail_AddressListAdd() function adds an address to the specified
address list.
Constant Description
MAIL_TO Send the message directly to the recipient.
MAIL_CC Send the message to the recipient as a carbon copy.
MAIL_BCC Send the message to the recipient as a blind carbon copy.
MAIL_REPLY_TO Send the message reply to the recipient.
• recipient_name – A string specifying the name of the recipient. The name can
be up to 80 characters.
• address – A string specifying the e-mail address of the recipient. The address
can be up to 255 characters.
Return value A boolean. True indicates the address was added to the list, while false
indicates it was not.
372 F U N C T I O N L I B R A R Y R E F E R E N C E
M A I L _ A D D R E S S L I S T C O U N T ()
Mail_AddressListCount()
Description The Mail_AddressListCount() function returns the number of addresses in
the specified address list.
Syntax Mail_AddressListCount(address_list_ID)
Parameters • address_list_ID – The ID of the address list whose addresses will be counted.
Return value An integer containing the number of addresses in the address list.
Mail_AddressListCreate()
Description The Mail_AddressListCreate() function creates a list that will contain
addresses to which a mail message will be sent or replies returned to.
Syntax Mail_AddressListCreate()
Parameters • None
374 F U N C T I O N L I B R A R Y R E F E R E N C E
M A I L _ A D D R E S S L I S T D E S T R O Y ()
Mail_AddressListDestroy()
Description The Mail_AddressListDestroy() function removes the specified address list
from memory.
Syntax Mail_AddressListDestroy(address_list_ID)
Return value A boolean. True indicates the address list was removed from memory,
while false indicates it was not.
Comments After you are done using an address list, be sure to use the
Mail_AddressListDestroy() function to release memory used by the list.
Mail_AddressListGet()
Description The Mail_AddressListGet() function retrieves an address from the
specified address list.
Parameters • address_list_ID – The ID of the address list from which an address will be
retrieved.
Constant Description
MAIL_TO Send the message directly to the recipient.
MAIL_CC Send the message to the recipient as a carbon copy.
MAIL_BCC Send the message to the recipient as a blind carbon copy.
MAIL_REPLY_TO Send the message reply to the recipient.
Constant Description
MAIL_ADDRESS_EXCHANGE The Exchange e-mail address is returned.
MAIL_ADDRESS_SMTP The SMTP e-mail address is returned.
MAIL_ADDRESS_DEFAULT The default format of the e-mail address is returned.
The value of the address_type parameter will be set
to the constant indicating the address type returned.
Return value A boolean. True indicates an address was retrieved, while false indicates it
was not.
376 F U N C T I O N L I B R A R Y R E F E R E N C E
M A I L _ A D D R E S S L I S T G E T ()
Mail_AddressListRemove()
Description The Mail_AddressListRemove() function removes an address from the
specified address list.
Parameters • address_list_ID – The ID of the address list from which an address will be
removed.
Return value A boolean. True indicates an address was removed, while false indicates it
was not.
for i = 1 to address_count do
{Remove the address.}
result = Mail_AddressListRemove('Address List', i);
end for;
378 F U N C T I O N L I B R A R Y R E F E R E N C E
M A I L _ D I S P L A Y A D D R E S S D I A L O G ()
Mail_DisplayAddressDialog()
Description The Mail_DisplayAddressDialog() function displays the mail message
addressing dialog that allows a user to specify who a message will be sent
to. An existing address list can be displayed in this dialog.
• dialog_title – A string specifying the title that appears at the top of the
addressing dialog.
• focus – An optional integer field that specifies the field that is focused when
the addressing dialog is displayed. The value corresponds to one of the
following constants:
Constant Description
MAIL_TO Focus in the To field.
MAIL_CC Focus in the CC field.
MAIL_BCC Focus in the BCC field.
Return value A boolean that is returned when the user clicks Close. The value true
indicates no error occurred, while false indicates that an error occurred.
Examples The following example creates a new address list. Then the
Mail_DisplayAddressDialog() function displays the mail addressing
dialog, allowing the user to specify the recipients.
380 F U N C T I O N L I B R A R Y R E F E R E N C E
M A I L _D I S P L A Y R E P L Y T O D I A L O G ()
Mail_DisplayReplyToDialog()
Description The Mail_DisplayReplyToDialog() function displays the mail message
addressing dialog that allows the user to select who message replies will be
sent to. An existing address list can be displayed in this dialog.
• dialog_title – A string specifying the title that appears at the top of the
addressing dialog.
Return value A boolean that is returned when the user clicks Close. The value true
indicates no error occurred, while false indicates that an error occurred.
Examples The following example creates a new address list that replies to a message
will be sent to. Then the Mail_DisplayReplyToDialog() function displays
the mail addressing dialog, allowing the user to specify the recipients the
reply will be sent to.
382 F U N C T I O N L I B R A R Y R E F E R E N C E
M A I L _ G E T S E R V E R T Y P E ()
Mail_GetServerType()
Description The Mail_GetServerType() function retrieves the type of server that is
being used for the current session.
Syntax Mail_GetServerType()
Parameters • None
Constant Description
MAIL_SERVER_SIMPLE_MAPI A simple MAPI mail server
MAIL_SERVER_EXTENDED_MAPI An extended MAPI mail server
MAIL_SERVER_EWS An Exchange mail server through Exchange Web
Services
MAIL_SERVER_SMTP An SMTP mail server
Mail_GetSessionAddress()
Description The Mail_GetSessionAddress() function retrieves the address from the
current mail profile.
Parameters • name – A returned string containing the display name for the profile
address. The name can be up to 255 characters.
• address – A returned string containing the e-mail address for the profile
address. The address can be up to 255 characters.
Constant Description
MAIL_ADDRESS_EXCHANGE The Exchange e-mail address is returned.
MAIL_ADDRESS_SMTP The SMTP e-mail address is returned.
MAIL_ADDRESS_DEFAULT The default format of the e-mail address is returned.
The value of the address_type parameter will be set
to the constant indicating the address type returned.
Return value A boolean. True indicates the address was retrieved, while false indicates it
was not.
384 F U N C T I O N L I B R A R Y R E F E R E N C E
M A I L _ I S L O G G E D O N ()
Mail_IsLoggedOn()
Description The Mail_IsLoggedOn() function indicates whether the application is
currently logged on to a mail session.
Syntax Mail_IsLoggedOn()
Parameters • None
Return value A boolean. True indicates the application is logged on to a mail session,
while false indicates it is not.
Mail_LogOff()
Description The Mail_LogOff() function closes the mail session on the current
workstation.
Syntax Mail_LogOff()
Parameters • None
Examples The following example uses the Mail_LogOff() function to close the current
Mail session.
Mail_LogOff();
386 F U N C T I O N L I B R A R Y R E F E R E N C E
M A I L _ L O G O N ()
Mail_LogOn()
Description The Mail_LogOn() function creates a mail session on the current
workstation.
https://computername.domain.contoso.com/EWS/Exchange.asmx
Return value A boolean. True indicates the mail session was successfully created, while
false indicates it was not.
Comments You must call the Mail_SetServerType() function before you use the
Mail_LogOn() function. Any existing mail session is automatically closed
before the new session is created.
If you are connecting to a MAPI mail server and don’t specify a profile, a
dialog box is automatically displayed that allows the user to choose a
profile to use. If you are connecting to an Exchange server through the
Exchange Web Service and don’t specify the URL or the auto-discovery
parameters, a dialog box is automatically displayed that allows the user to
supply their credentials.
Examples The following script example checks whether a mail session is currently
active. If one is not, the Mail_LogOn() function is used to create a
connection through the Exchange Web Service.
388 F U N C T I O N L I B R A R Y R E F E R E N C E
M A I L _ R E S O L V E A D D R E S S ()
Mail_ResolveAddress()
Description The Mail_ResolveAddress() function attempts to match a search string to
an e-mail address in the address book.
Parameters • search_name – A string containing the name or e-mail address to search for.
• name – A returned string containing the display name for the e-mail address
that was found. If the search name could not be resolved, the empty string
is returned.
• email – A returned string containing the e-mail address that was found. If
the search name could not be resolved, the empty string is returned.
Constant Description
MAIL_ADDRESS_EXCHANGE The Exchange e-mail address is returned.
MAIL_ADDRESS_SMTP The SMTP e-mail address is returned.
MAIL_ADDRESS_DEFAULT The default format of the e-mail address is returned.
The value of the address_type parameter will be set
to the constant indicating the address type returned.
Return value A boolean. True indicates that a search result was found and returned,
while false indicates that no result was found.
Examples The following example attempts to resolve the search name “Steve K” to
find the corresponding e-mail address and display name. If no result can be
found, the resolve dialog will be displayed.
390 F U N C T I O N L I B R A R Y R E F E R E N C E
M A I L _ S E N D ()
Mail_Send()
Description The Mail_Send() function sends a message to the members of a specified
address list.
Parameters • address_list_ID – The ID of the address list to which the message will be
sent.
• message_text – A text field or variable containing the text for the message.
This parameter can also be an integer specifying which attachment in the
attachment list to use for the message text. The value 1 indicates the first
attachment.
These properties are set using the Property functions from the MAPI function
library.
MAIL_SUCCESS MAIL_LOGIN_FAILURE
MAIL_AMBIGUOUS_RECIPIENT MAIL_TEXT_TOO_LARGE
MAIL_ATTACHMENT_NOT_FOUND MAIL_TOO_MANY_FILES
MAIL_ATTACHMENT_OPEN_FAILURE MAIL_TOO_MANY_RECIPIENTS
MAIL_BAD_RECIPTYPE MAIL_UNKNOWN_RECIPIENT
MAIL_INSUFFICIENT_MEMORY MAIL_USER_ABORTED
MAIL_INVALID_RECIPS MAIL_BAD_MAPI_PROPERTIES
MAIL_BODY_INDEX_OUT_OF_RANGE MAIL_UNKNOWN
Comments When using an attachment for the message body, the file attachment will
typically be in text, HTML, or RTF format. The attachment used for the
message text will not appear as an attachment for the message.
Examples The following example uses the Mail_Send() function to send a message to
the members of the specified address list.
392 F U N C T I O N L I B R A R Y R E F E R E N C E
M A I L _ S E N D D I A L O G ()
Mail_SendDialog()
Description The Mail_SendDialog() function opens the Compose window that allows a
message to be composed and sent.
Parameters • address_list_ID – The ID of the address list to which the message will be
sent.
These properties are set using the Property functions from the MAPI function
library.
MAIL_SUCCESS MAIL_LOGIN_FAILURE
MAIL_AMBIGUOUS_RECIPIENT MAIL_TEXT_TOO_LARGE
MAIL_ATTACHMENT_NOT_FOUND MAIL_TOO_MANY_FILES
MAIL_ATTACHMENT_OPEN_FAILURE MAIL_TOO_MANY_RECIPIENTS
MAIL_BAD_RECIPTYPE MAIL_UNKNOWN_RECIPIENT
MAIL_INSUFFICIENT_MEMORY MAIL_USER_ABORTED
MAIL_INVALID_RECIPS MAIL_BAD_MAPI_PROPERTIES
MAIL_BODY_INDEX_OUT_OF_RANGE MAIL_UNKNOWN
Comments If any of the address list, reply to list, subject, message text, or attachments
parameters are supplied with values, those values will appear in the
Compose window when it is displayed.
When using an attachment for the message body, the file attachment will
typically be in text, HTML, or RTF format. The attachment used for the
message text will not appear as an attachment for the message.
394 F U N C T I O N L I B R A R Y R E F E R E N C E
M A I L _ S E T S E R V E R T Y P E ()
Mail_SetServerType()
Description The Mail_SetServerType() function specifies the type of connection to use
for the mail server. This function must be used before you use the
Mail_LogOn() function.
Syntax Mail_SetServerType(type)
Constant Description
MAIL_SERVER_SIMPLE_MAPI A simple MAPI mail server
MAIL_SERVER_EXTENDED_MAPI An extended MAPI mail server
MAIL_SERVER_EWS An Exchange mail server through Exchange Web
Services
Examples The following script example checks whether a mail session is currently
active. If one is not, Mail_SetServerType() is used to specify the connection
type and then the Mail_LogOn() function is used to create a connection.
396 F U N C T I O N L I B R A R Y R E F E R E N C E
MAPI function library
Use the functions in this library when adding MAPI support to your
application. To send mail, these functions require a 32-bit compatible MAPI
mail client on the current workstation.
We recommend that you use the functions in the Mail function library when
implementing mail support for your application. The functions in the Mail
function library can send mail through Exchange Web Services (EWS). EWS
uses a web service interface to communicate directly with a Microsoft
Exchange or Office 365 server to send mail. No e-mail client is required.
• MAPI_AddAddress()
• MAPI_CountAddresses()
• MAPI_CreateAddressList()
• MAPI_DestroyAddressList()
• MAPI_DisplayDialog()
• MAPI_DisplayReplyToDialog()
• MAPI_GetAddress()
• MAPI_IsLoggedOn()
• MAPI_IsMailEnabled()
• MAPI_LogOff()
• MAPI_LogOn()
• MAPI_ProfileGetAddress()
• MAPI_PropertyListCount()
• MAPI_PropertyListCreate()
• MAPI_PropertyListDestroy()
• MAPI_PropertyListGetValue()
• MAPI_PropertyListGetValueByIndex()
• MAPI_PropertyListSetValue()
• MAPI_RemoveAddress()
• MAPI_ResolveAddress()
• MAPI_Send()
• MAPI_SendDialog()
MAPI_AddAddress()
Description The MAPI_AddAddress() function adds an address to the specified
address list.
Constant Description
MAIL_TO Send the message directly to the recipient.
MAIL_CC Send the message to the recipient as a carbon copy.
MAIL_BCC Send the message to the recipient as a blind carbon copy.
MAIL_REPLY_TO Send the message reply to the recipient.
• recipient_name – A string specifying the name of the recipient. The name can
be up to 80 characters.
• address – A string specifying the e-mail address of the recipient. The address
can be up to 255 characters. The address should also specify the transport
protocol to use for the message, such as SMTP (Simple Mail Transport
Protocol). Refer to the example for more information.
Return value A boolean. True indicates the address was added to the list, while false
indicates it was not.
398 F U N C T I O N L I B R A R Y R E F E R E N C E
MA PI _C O U N T A D D R E S S E S ()
MAPI_CountAddresses()
Description The MAPI_CountAddresses() function returns the number of addresses in
the specified address list.
Syntax MAPI_CountAddresses(address_list_ID)
Parameters • address_list_ID – The ID of the address list whose addresses will be counted.
Return value An integer containing the number of addresses in the address list.
MAPI_CreateAddressList()
Description The MAPI_CreateAddressList() function creates a list that will contain
addresses to which a mail message will be sent or replies returned to.
Syntax MAPI_CreateAddressList()
Parameters • None
400 F U N C T I O N L I B R A R Y R E F E R E N C E
M A PI _ D E S T R O Y A D D R E S S L I S T ()
MAPI_DestroyAddressList()
Description The MAPI_DestroyAddressList() function removes the specified address
list from memory.
Syntax MAPI_DestroyAddressList(address_list_ID)
Return value A boolean. True indicates the address list was removed from memory, while
false indicates it was not.
Comments After you are done using an address list, be sure to use the
MAPI_DestroyAddressList() function to release memory used by the list.
MAPI_DisplayDialog()
Description The MAPI_DisplayDialog() function displays the MAPI message
addressing dialog that allows a user to specify who a message will be sent
to. An existing address list can be displayed in this dialog.
Parameters • address_list_ID – The ID of the address list that contains addresses to display
and to which an address list will be returned.
• dialog_title – A string specifying the title that appears at the top of the
addressing dialog.
Return value A boolean. True indicates that the user clicked OK and no error occurred.
False indicates that either the user clicked Cancel or an error occurred.
Examples The following example creates a new address list. Then the
MAPI_DisplayDialog() function displays the MAPI addressing dialog,
allowing the user to specify the recipients.
402 F U N C T I O N L I B R A R Y R E F E R E N C E
M A P I _D I S P L A Y R E P L Y T O D I A L O G ()
MAPI_DisplayReplyToDialog()
Description The MAPI_DisplayReplyToDialog() function displays the MAPI message
addressing dialog that allows the user to select who message replies will be
sent to. An existing address list can be displayed in this dialog.
• dialog_title – A string specifying the title that appears at the top of the
addressing dialog.
Return value A boolean. True indicates that the user clicked OK and no error occurred.
False indicates that either the user clicked Cancel or an error occurred.
Examples Thlle following example creates a new address list that replies to a message
will be sent to. Then the MAPI_DisplayReplyToDialog() function displays
the MAPI addressing dialog, allowing the user to specify the recipients the
reply will be sent to.
404 F U N C T I O N L I B R A R Y R E F E R E N C E
M A P I_ G E T A D D R E S S ()
MAPI_GetAddress()
Description The MAPI_GetAddress() function retrieves an address from the specified
address list.
Parameters • address_list_ID – The ID of the address list from which an address will be
retrieved.
Constant Description
MAIL_TO Send the message directly to the recipient.
MAIL_CC Send the message to the recipient as a carbon copy.
MAIL_BCC Send the message to the recipient as a blind carbon copy.
MAIL_REPLY_TO Send the message reply to the recipient.
Constant Description
MAPI_ADDRESS_EXCHANGE The Exchange e-mail address is returned.
MAPI_ADDRESS_SMTP The SMTP e-mail address is returned.
MAPI_DEFAULT_ADDRESS The default format of the e-mail address is returned.
The value of the address_type parameter will be set
to the constant indicating the address type returned.
Return value A boolean. True indicates an address was retrieved, while false indicates it
was not.
406 F U N C T I O N L I B R A R Y R E F E R E N C E
M A P I_ I S L O G G E D O N ()
MAPI_IsLoggedOn()
Description The MAPI_IsLoggedOn() function indicates whether the application is
currently logged on to a MAPI session.
Syntax MAPI_IsLoggedOn()
Parameters • None
Return value A boolean. True indicates the application is logged on to a MAPI session,
while false indicates it is not.
MAPI_IsMailEnabled()
Description The MAPI_IsMailEnabled() function indicates whether the current
workstation supports MAPI. It can also be used to find out what level of
MAPI support is available.
Syntax MAPI_IsMailEnabled({level})
Parameters • level – An optional integer parameter that specifies what level of MAPI
support to check. The value corresponds to one of the following constants:
Constant Description
MAPI_SIMPLE Simple MAPI
MAPI_EXTENDED Extended MAPI
If this parameter is not supplied, the function will return true if either
simple or extended MAPI is supported.
Return value A boolean. True indicates the specified level of MAPI is supported, while
false indicates it is not.
Comments Before you use features of extended MAPI, you should explicitly check
whether extended MAPI is supported.
408 F U N C T I O N L I B R A R Y R E F E R E N C E
M A P I_ L O G O F F ()
MAPI_LogOff()
Description The MAPI_LogOff() function closes the MAPI session on the current
workstation.
Syntax MAPI_LogOff()
Parameters • None
Examples The following example uses the MAPI_LogOff() function to close the
current MAPI session.
MAPI_LogOff();
MAPI_LogOn()
Description The MAPI_LogOn() function creates a MAPI session on the current
workstation.
Syntax MAPI_LogOn({profile})
Parameters • profile – An optional string parameter that specifies the profile to use for the
MAPI session. An error message will be displayed if you supply the name
of a profile name that does not exist.
Return value A boolean. True indicates the MAPI session was successfully created, while
false indicates it was not.
Comments Any existing MAPI session is automatically closed before the new session is
created. If you don’t specify a profile, a dialog box is automatically
displayed that allows the user to choose a profile to use.
Examples The following script example checks whether a MAPI session is currently
active. If one is not, the MAPI_LogOn() function is used to create one.
410 F U N C T I O N L I B R A R Y R E F E R E N C E
M A P I_ P R O F I L E G E T A D D R E S S ()
MAPI_ProfileGetAddress()
Description The MAPI_ProfileGetAddress() function retrieves the name and e-mail
address from the profile for the current user.
Parameters • name – A returned string containing the display name for the e-mail address
of the current user.
• email – A returned string containing the e-mail address of the current user.
Constant Description
MAPI_ADDRESS_EXCHANGE The Exchange e-mail address is returned.
MAPI_ADDRESS_SMTP The SMTP e-mail address is returned.
MAPI_DEFAULT_ADDRESS The default format of the e-mail address is returned.
The value of the address_type parameter will be set
to the constant indicating the address type returned.
Return value A boolean. True indicates the display name and e-mail address were
successfully returned, while false indicates they were not.
Examples The following example retrieves the e-mail address and display name for
the current user.
{Get the e-mail address and display name for the current user.}
result = MAPI_ProfileGetAddress(display_name, email);
MAPI_PropertyListCount()
Description The MAPI_PropertyListCount() function retrieves the number of
properties in a property list.
Syntax MAPI_PropertyListCount(property_list_ID)
Parameters • property_list_ID – A long integer specifying the property list for which the
number of properties is being returned.
Examples The following global procedure example counts the number of properties in
the property list passed into the script.
in long property_list_ID;
count = MAPI_PropertyListCount(property_list_ID);
412 F U N C T I O N L I B R A R Y R E F E R E N C E
MA PI _P R O P E R T Y L I S T C R E A T E ()
MAPI_PropertyListCreate()
Description The MAPI_PropertyListCreate() function creates a list that will contain
properties that specify characteristics of an e-mail message.
Syntax MAPI_PropertyListCreate()
Parameters • None
MAPI_PropertyListDestroy()
Description The MAPI_PropertyListDestroy() function removes the specified property
list from memory.
Syntax MAPI_PropertyListDestroy(property_list_ID)
Parameters • property_list_ID – A long integer specifying the property list to remove from
memory.
Return value A boolean. True indicates the property list was removed from memory,
while false indicates it was not.
414 F U N C T I O N L I B R A R Y R E F E R E N C E
M A PI _ P R O P E R T Y L I S T G E T V A L U E ()
MAPI_PropertyListGetValue()
Description The MAPI_PropertyListGetValue() function retrieves the value of a
property from the specified property list.
Parameters • property_list_ID – A long integer specifying the property list from which a
value is being retrieved.
Return value A boolean. True indicates the property value was successfully returned,
while false indicates it was not.
Examples The following example retrieves the value of the PR_SUBJECT property.
This is a string property with value 0x0037 (55 decimal).
MAPI_PropertyListGetValueByIndex()
Description The MAPI_PropertyListGetValueByIndex() function retrieves the value of
a property from the specified property list, based on the index.
Parameters • property_list_ID – A long integer specifying the property list from which a
value is being retrieved.
Return value A boolean. True indicates the property value was successfully returned,
while false indicates it was not.
Examples The following example counts the number of properties in a MAPI property
list, and then retrieves the ID and value of each property. The list of
properties is displayed in a warning message.
416 F U N C T I O N L I B R A R Y R E F E R E N C E
M A P I _ P R O P E R T Y L I S T G E T V A L U E B Y I N D E X ()
{Count the number of items in the property list. The ID of the list}
{is stored by a local long integer window field.}
count = MAPI_PropertyListCount('(L) MAPI_Properties');
for i = 1 to count do
{String type}
result = MAPI_PropertyListGetValueByIndex('(L) MAPI_Properties',
➥ i, property_ID, string_property_value);
if result = true then
message = message + "Property ID: " + str(property_ID) +
➥ " Value: " + str(string_property_value) + char(13);
continue for;
end if;
{Integer type}
result = MAPI_PropertyListGetValueByIndex('(L) MAPI_Properties',
➥ i, property_ID, integer_property_value);
if result = true then
message = message + "Property ID: " + str(property_ID) +
➥ " Value: " + str(integer_property_value) + char(13);
continue for;
end if;
{Long type}
result = MAPI_PropertyListGetValueByIndex('(L) MAPI_Properties',
➥ i, property_ID, long_property_value);
if result = true then
message = message + "Property ID: " + str(property_ID) +
➥ " Value: " + str(long_property_value) + char(13);
continue for;
end if;
{Boolean type}
result = MAPI_PropertyListGetValueByIndex('(L) MAPI_Properties',
➥ i, property_ID, boolean_property_value);
if result = true then
message = message + "Property ID: " + str(property_ID) +
➥ " Value: " + str(boolean_property_value) + char(13);
continue for;
end if;
{Datetime type}
result = MAPI_PropertyListGetValueByIndex('(L) MAPI_Properties',
➥ i, property_ID, datetime_property_value);
if result = true then
message = message + "Property ID: " + str(property_ID) +
➥ " Value: " + str(datetime_property_value) + char(13);
continue for;
end if;
end for;
418 F U N C T I O N L I B R A R Y R E F E R E N C E
MA PI _P R O P E R T Y L I S T S E T V A L U E ()
MAPI_PropertyListSetValue()
Description The MAPI_PropertyListSetValue() function sets the value of a property in
the specified property list.
Return value A boolean. True indicates the property value was successfully set, while
false indicates it was not.
Examples The following example sends an e-mail message to the current user. A
property list is included with the message so that the message can be
flagged as important and a read receipt requested.
After the message is successfully sent, the address list and property list are
removed from memory.
{Get the e-mail address and display name for the current user.}
result = MAPI_ProfileGetAddress(display_name, email);
420 F U N C T I O N L I B R A R Y R E F E R E N C E
MA PI _P R O P E R T Y L I S T S E T V A L U E ()
MAPI_RemoveAddress()
Description The MAPI_RemoveAddress() function removes an address from the
specified address list.
Parameters • address_list_ID – The ID of the address list from which an address will be
removed.
Return value A boolean. True indicates an address was removed, while false indicates it
was not.
for i = 1 to address_count do
{Remove the address.}
result = MAPI_RemoveAddress('Address List', i);
end for;
422 F U N C T I O N L I B R A R Y R E F E R E N C E
MA PI _R E S O L V E A D D R E S S ()
MAPI_ResolveAddress()
Description The MAPI_ResolveAddress() function attempts to match a search string to
an e-mail address in the address book.
Parameters • search_name – A string containing the name or e-mail address to search for.
• name – A returned string containing the display name for the e-mail address
that was found. If the search name could not be resolved, the empty string
is returned.
• email – A returned string containing the e-mail address that was found. If
the search name could not be resolved, the empty string is returned.
Constant Description
MAPI_ADDRESS_EXCHANGE The Exchange e-mail address is returned.
MAPI_ADDRESS_SMTP The SMTP e-mail address is returned.
MAPI_DEFAULT_ADDRESS The default format of the e-mail address is returned.
The value of the address_type parameter will be set
to the constant indicating the address type returned.
Return value A boolean. True indicates that a search result was found and returned,
while false indicates that no result was found.
Examples The following example attempts to resolve the search name “Steve K” to
find the corresponding e-mail address and display name. If no result can be
found, the resolve dialog will be displayed.
424 F U N C T I O N L I B R A R Y R E F E R E N C E
M A P I_ S E N D ()
MAPI_Send()
Description The MAPI_Send() function sends a message to the members of a specified
address list.
Parameters • address_list_ID – The ID of the address list to which the message will be
sent.
• message_text – A text field or variable containing the text for the message.
This parameter can also be an integer specifying which attachment in the
attachment list to use for the message text. The value 1 indicates the first
attachment.
MAPI_SUCCESS MAPI_LOGIN_FAILURE
MAPI_AMBIGUOUS_RECIPIENT MAPI_TEXT_TOO_LARGE
MAPI_ATTACHMENT_NOT_FOUND MAPI_TOO_MANY_FILES
MAPI_ATTACHMENT_OPEN_FAILURE MAPI_TOO_MANY_RECIPIENTS
MAPI_BAD_RECIPTYPE MAPI_UNKNOWN_RECIPIENT
MAPI_INSUFFICIENT_MEMORY MAPI_USER_ABORTED
MAPI_INVALID_RECIPS MAPI_BAD_MAPI_PROPERTIES
MAPI_BODY_INDEX_OUT_OF_RANGE MAPI_UNKNOWN
Comments When using an attachment for the message body, the file attachment will
typically be in text, HTML, or RTF format. The attachment used for the
message text will not appear as an attachment for the message.
Examples The following example uses the MAPI_Send() function to send a message
to the members of the specified address list.
426 F U N C T I O N L I B R A R Y R E F E R E N C E
M A P I_ S E N D D I A L O G ()
MAPI_SendDialog()
Description The MAPI_SendDialog() function sends a message to the members of a
specified address list. A mail dialog will be displayed for each message
sent.
Parameters • address_list_ID – The ID of the address list to which the message will be
sent.
MAPI_SUCCESS MAPI_LOGIN_FAILURE
MAPI_AMBIGUOUS_RECIPIENT MAPI_TEXT_TOO_LARGE
MAPI_ATTACHMENT_NOT_FOUND MAPI_TOO_MANY_FILES
MAPI_ATTACHMENT_OPEN_FAILURE MAPI_TOO_MANY_RECIPIENTS
MAPI_BAD_RECIPTYPE MAPI_UNKNOWN_RECIPIENT
MAPI_INSUFFICIENT_MEMORY MAPI_USER_ABORTED
MAPI_INVALID_RECIPS MAPI_BAD_MAPI_PROPERTIES
MAPI_BODY_INDEX_OUT_OF_RANGE MAPI_UNKNOWN
Comments When using an attachment for the message body, the file attachment will
typically be in text, HTML, or RTF format. The attachment used for the
message text will not appear as an attachment for the message.
428 F U N C T I O N L I B R A R Y R E F E R E N C E
Menu bar function library
Refer to Chapter 16, Use the functions in this library to work with command-based menus for an
“Command-based application. This library contains the following functions:
Menus,” in Volume 1 of
the Dexterity Program- • MenuBar_AddMenu()
mer’s Guide for more • MenuBar_RemoveAllMenus()
information. • MenuBar_RemoveMenu()
MenuBar_AddMenu()
Description The MenuBar_AddMenu() function adds a command list to the menu bar.
Parameters • command_list_tag – The integer tag value specifying the command list to
add to the menu bar.
• position – An optional integer that specifies the location of the menu. The
value 1 indicates the left-most position. The value 0 specifies the menu will
be added on the right end of the menu bar.
Return value An integer indicating whether the menu was added. The value 1 indicates
the menu was added, while the value 0 indicates it was not.
Comments When a menu is added at a specified position, any menus already added
are shifted one position to the right to make room for the new menu.
Examples The following example adds the Windows menu to the menu bar in the
fourth position. The command list added is the built-in command list for
the list of open windows in the application.
430 F U N C T I O N L I B R A R Y R E F E R E N C E
M E N U B A R _ R E M O V E A L L M E N U S ()
MenuBar_RemoveAllMenus()
Description The MenuBar_RemoveAllMenus() function removes all menus from the
menu bar.
Syntax MenuBar_RemoveAllMenus()
Parameters • None
Return value A boolean. The value false indicates the menus were removed, while the
value true indicates they were not.
Examples The following example removes all of the menus for the application.
result = MenuBar_RemoveAllMenus();
MenuBar_RemoveMenu()
Description The MenuBar_RemoveMenu() function removes the specified menu from
the menu bar.
Syntax MenuBar_RemoveMenu(command_list_tag)
Parameters • command_list_tag – The integer tag value specifying the command list used
for the menu that is to be removed from the menu bar.
Return value A boolean. The value false indicates the menu was successfully removed.
The value true indicates the menu was not removed.
Examples The following example removes the View menu from the menu bar. The
menu was defined using the command list CL_View on the Main Menu
form.
432 F U N C T I O N L I B R A R Y R E F E R E N C E
Menu function library
Use the functions in this library when working with menus. This library
contains the following function:
• Menu_Invoke()
Menu_Invoke()
Description The Menu_Invoke() function causes a menu item to be invoked, just as if it
had been selected by the user.
Syntax Menu_Invoke(action)
Parameters • action – An integer that specifies the action to perform. Use one of the
following constants:
Constant Description
MENU_ACTION_PRINT Print menu item
MENU_ACTION_PRINTSETUP Print Setup menu item
MENU_ACTION_HELPCONTENTS Help Contents menu item
MENU_ACTION_HELPSEARCH Help Search menu item
MENU_ACTION_HELPFIELD Field Help menu item
MENU_ACTION_HELPWINDOW Window Help menu item
MENU_ACTION_HELPABOUT About menu item
MENU_ACTION_HELPONHELP Help on Help menu item
MENU_ACTION_SHOWREQUIRED Show Required menu item
MENU_ACTION_UNDO Undo menu item
MENU_ACTION_CUT Cut menu item
MENU_ACTION_COPY Copy menu item
MENU_ACTION_PASTE Paste menu item
MENU_ACTION_CLEAR Clear menu item
MENU_ACTION_SELECTALL Select All menu item
MENU_ACTION_DELETEROW Delete Row menu item
MENU_ACTION_INSERTROW Insert Row menu item
Return value A boolean indicating whether the menu item was invoked. True indicates it
was invoked, while false indicates it was not.
Comments The menu item to be invoked must be in the set of menu items for the
application. You can’t invoke a menu item that isn’t included in a menu.
Menu items will be invoked, regardless of whether they are enabled or
disabled in the menu.
Examples The following example displays the contents of the current help file.
local boolean result;
result = Menu_Invoke(MENU_ACTION_HELPCONTENTS);
434 F U N C T I O N L I B R A R Y R E F E R E N C E
OLE function library
Refer to Appendix C, Use the functions in this library when implementing OLE container support
“OLE Container,”, in in your application. This library contains the following functions:
the Stand-alone Appli-
cation Guide for more • OLE_CloseNote()
information about • OLE_DeleteNote()
implenting OLE con- • OLE_Exit()
tainer support. • OLE_IsNoteEnabled()
• OLE_OpenNote()
• OLE_SaveNote()
OLE_CloseNote()
Description The OLE_CloseNote() function closes the specified OLE container file. The
OLE container application will remain open.
Parameters • OLE_doc_path – The complete path of the OLE container file you want to
close. The path is in generic format.
• save_flag – A string specifying whether the objects in the OLE container file
should be saved when the file is closed. Passing the string “true” indicates
the objects should be saved, while “false” indicates the objects should not
be saved.
Examples The following example closes the OLE container file ID1001.OLE, saving
any changes to the objects stored in the file.
result = OLE_CloseNote(":C:RESM/OLE/ID1001.OLE","true");
436 F U N C T I O N L I B R A R Y R E F E R E N C E
O L E _ D E L E T E N O T E ()
OLE_DeleteNote()
Description The OLE_DeleteNote() function closes the specified OLE container file (if it
is open) and deletes the file. The OLE container application will remain
open.
Syntax OLE_DeleteNote(OLE_doc_path)
Parameters • OLE_doc_path – The complete path of the OLE container file you want to
delete. The path is in generic format.
Examples The following example deletes the OLE container file ID1001.OLE.
result = OLE_DeleteNote(":C:RESM/OLE/ID1001.OLE");
OLE_Exit()
Description The OLE_Exit() function closes the OLE container application.
Syntax OLE_Exit()
Parameters • None
result = OLE_Exit();
438 F U N C T I O N L I B R A R Y R E F E R E N C E
O L E _ I S N O T E E N A B L E D ()
OLE_IsNoteEnabled()
Description The OLE_IsNoteEnabled() function ascertains whether the current
operating environment can support the OLE container application.
Syntax OLE_IsNoteEnabled()
Parameters • None
Return value A boolean value indicating whether the OLE container application can be
supported; true if the container application can be supported, false if it
can’t.
Examples The following example ascertains whether the OLE container application
can be supported. If it can be, the Picture button is enabled.
result = OLE_IsNoteEnabled();
if result = true then
enable field Picture;
else
disable field Picture;
end if;
OLE_OpenNote()
Description The OLE_OpenNote() function opens the specified OLE container file and
sets the window title of the OLE container application. If the OLE container
application wasn’t already open, it will be opened.
Parameters • OLE_doc_path – The complete path of the OLE container file to open. The
path is in generic format.
• window_title – A string containing the text that will appear in the title bar of
the OLE container application.
Comments The OLE container application opens the container file for exclusive use.
This means that only one user at a time can access a specific OLE container
file.
Examples The following example opens the OLE container file ID1001.OLE,
specifying “House ID 1001” as the window title to display.
440 F U N C T I O N L I B R A R Y R E F E R E N C E
O L E _ S A V E N O T E ()
OLE_SaveNote()
Description The OLE_SaveNote() function saves the specified OLE container file. The
OLE container file and OLE container application will remain open.
Syntax OLE_SaveNote(OLE_doc_path)
Parameters • OLE_doc_path – The complete path of the OLE container file to save. The
path is in generic format.
Examples The following example saves the OLE container file ID1001.OLE.
result = OLE_SaveNote(":C:RESM/OLE/ID1001.OLE");
Path_ChangeDefault()
Description The Path_ChangeDefault() function changes the default location for tables
with a Pathname table series.
Syntax Path_ChangeDefault(pathname)
Comments By default, tables in the Pathname series are stored in the same location as
the application dictionary. Some Dexterity applications use the defaults file
to store the path to tables in the Pathname series and use the
Path_ChangeDefault() function to specify the location. The
Defaults_Write() and Defaults_Read() functions are used to store a
pathname in the Dexterity defaults file.
444 F U N C T I O N L I B R A R Y R E F E R E N C E
P A T H _ C R E A T E F O L D E R ()
Path_CreateFolder()
Description The Path_CreateFolder() function creates a new folder or directory. When
used with the savefile() function, a dialog box will appear, allowing the
location and name of the new directory or folder to be specified by the user.
Syntax Path_CreateFolder(pathname)
Parameters • pathname – A string containing the entire path and name of the new
directory or folder. This path must exist at the operating system, or the
directory or folder won’t be created. When the savefile() function is used,
the folder/directory location and name should be returned to pathname.
Return value An integer that returns the value 0 if the directory was created successfully,
or the value 1 if an error occurred.
Comments To open a dialog box and allow the user to specify a default location, use the
savefile() function. Normally, this function will display a dialog box used to
specify a file name and location; however, when used with the
Path_CreateFolder() function, a folder or directory can be created instead.
If you use the savefile() function, ignore the file format selection in the dialog box.
It doesn’t apply when creating a folder.
Examples The following example displays a dialog box, prompting the user to enter
the name of a new folder. The pathname (l_location) is returned to the
Path_CreateFolder() function, and the folder is created at that location.
Path_DoesExist()
Description The Path_DoesExist() function indicates whether the specified path exists.
Syntax Path_DoesExist(path)
Parameters • path – A string containing the path to verify. The path must be in native
format.
Return value A boolean. True indicates the path exists, while false indicates it does not.
Examples The following example uses the Path_DoesExist() function to verify that
the path to the RESM directory exists.
result = Path_DoesExist("C:\RESM\");
446 F U N C T I O N L I B R A R Y R E F E R E N C E
P A T H _ G E T F O R A P P ()
Path_GetForApp()
Description The Path_GetForApp() function returns the generic path of various
components of the current installation, such as the runtime engine or
launch file.
Syntax Path_GetForApp(option)
Comments The path that’s returned is in a generic format. Generic pathnames use a
colon (:) before and after DOS drive letters. The characters that separate
folders and directories are forward slashes (/).
Examples In the following example, the local string variable is used to store the
pathname of the folder containing the runtime engine.
local string pathname;
pathname = Path_GetForApp(PATH_EXEFOLDER);
'(L) Dictionary Location' of window 'Dictionary Maintenance' =
➥ pathname;
448 F U N C T I O N L I B R A R Y R E F E R E N C E
P A T H _ M A K E G E N E R I C ()
Path_MakeGeneric()
Description The Path_MakeGeneric() function converts a native pathname to a generic
pathname.
Syntax Path_MakeGeneric(pathname)
Comments Generic pathnames have been designed to allow several different operating
environments access to the same set of data in a Dexterity application.
Generic pathnames use a colon (:) before and after DOS drive letters. The
characters that separate folders and directories are forward slashes (/).
Path_MakeNative()
Description The Path_MakeNative() function converts a generic pathname to a native
pathname.
Syntax Path_MakeNative(pathname)
Return value A string containing the pathname in a format native to the operating
system.
Comments Generic pathnames have been designed to allow several different operating
environments access to the same set of data in a Dexterity application.
Generic pathnames use a colon (:) before and after DOS drive letters. The
characters that separate folders and directories are forward slashes (/).
{Open the file dialog box and return the generic pathname.}
result = Path_SelectPathname(l_Path);
if result = true then
'(L) Pathname' = Path_MakeNative(l_Path);
end if;
450 F U N C T I O N L I B R A R Y R E F E R E N C E
P A T H _ P A R S E F I L E F R O M P A T H ()
Path_ParseFileFromPath()
Description The Path_ParseFileFromPath() function parses a file’s operating system
name from a generic path.
Syntax Path_ParseFileFromPath(file_path)
Parameters • file_path – A string containing the generic pathname from which the file
name will be parsed.
Return value A string containing the operating system name of the file.
A generic pathname
:C:DEXAPPS/SYSTEM/SYSTEM.DIC
Examples This example parses the operating system name from a generic path
returned by the getfile() function.
Path_ParsePathFromPath()
Description The Path_ParsePathFromPath() function parses the path name from a
generic path.
Syntax Path_ParsePathFromPath(file_path)
Parameters • file_path – A string containing the generic pathname from which the path
will be parsed.
Return value A string containing the path where the file is located.
A generic pathname
:C:DEXAPPS/SYSTEM/SYSTEM.DIC
The path
returned by this
function.
Examples This example parses the path from a generic path returned by the getfile()
function.
452 F U N C T I O N L I B R A R Y R E F E R E N C E
P A T H _ S E L E C T P A T H N A M E ()
Path_SelectPathname()
Description The Path_SelectPathname() function displays a file dialog box, allowing a
user to indicate the location of a file, and returns a generic pathname to that
location.
Syntax Path_SelectPathname(pathname)
Parameters • pathname – A string variable to which the pathname selected by the user.
The pathname is returned in generic format. You can set the value of this
variable before calling the Path_SelectPathname() function to specify the
default location that will appear in the dialog box. You supply the path in
native format. Be sure to end the path with the trailing slash (\).
Value Description
false Cancel was clicked.
true OK was clicked.
The getfile() function allows a user to return a pathname for a particular file by
selecting that file from a list of files with specific file type extensions, such as .DIC
or .MAC.
Examples The following example shows how a pathname can be set to indicate the
location of a file. Note that the returned generic pathname is converted to a
native pathname using the Path_MakeNative() function.
local boolean result;
local string l_Path;
result = Path_SelectPathname(l_Path);
if result = true then
{Convert the pathname to a native format.}
'Data Pathname' = Path_MakeNative(l_Path);
end if;
The following example displays a dialog allowing the user to select a path.
The default location displayed in the dialog is set before the dialog is
opened.
result = Path_SelectPathname(l_Path);
if result = true then
{Convert the pathname to a native format.}
'Data Pathname' = Path_MakeNative(l_Path);
end if;
454 F U N C T I O N L I B R A R Y R E F E R E N C E
Printer function library
Use the functions in this library when implementing named printer support
for your application. This library contains the following functions:
• Printer_Define()
• Printer_GetName()
• Printer_SetDestination()
Printer_Define()
Description The Printer_Define() function allows a user to define a new named printer
destination. This function opens the Print Setup dialog box in which the
user can select a printer, the print orientation, paper size and other printer
options.
Syntax Printer_Define(printer_settings)
Parameters • printer_settings – A text field into which all the printer-related options
selected by the user are stored. The text field must have a keyable length of
at least 5004 characters. The stored data includes information such as the
printer’s name, the desired paper orientation, and whether to use a header
page.
While the printer_settings field must be a text field, the data is stored in it will be
unreadable if displayed.
Return value A boolean value that is set depending upon which button was clicked to
close the Print Setup window. True indicates the OK button was clicked.
False indicates the Cancel button was clicked.
Comments The data stored in the printer_settings parameter is typically saved in a table
for use in the printer clause of the run report and run report with name
statements.
456 F U N C T I O N L I B R A R Y R E F E R E N C E
P R I N T E R _ G E T N A M E ()
Printer_GetName()
Description The Printer_GetName() function returns the name of a named printer
defined using the Printer_Define() function.
Syntax Printer_GetName(printer_settings)
While the printer_settings field must be a text field, the data is stored in it will be
unreadable if displayed.
Return value A string containing the name of the printer associated with the specified
printer_settings parameter.
Examples The following example uses the Printer_Define() function to open the Print
Setup window and allow a user to define a named printer. If the user clicks
OK to close the Print Setup window, the Printer_GetName() function is
used to retrieve the name of the printer. Then, the printer’s name and the
text field containing all of the defined printer options are saved in the
Printer_Options table.
Printer_SetDestination()
Description The Printer_SetDestination() function changes the default printer for the
current application to the one specified in the printer_settings parameter.
Syntax Printer_SetDestination(printer_settings)
Return value A boolean value indicating whether the current printer was changed. True
indicates the current printer was changed. False indicates it wasn’t.
Comments This function can be useful if you are creating a custom application for
which the reports must always be printed to a specific printer.
Use this function with caution. It changes the default printer setting for the current
application, not just the current report.
458 F U N C T I O N L I B R A R Y R E F E R E N C E
Registry function library
Use the functions in this library when working with data in the Windows
registry. This library contains the following functions:
• Registry_DeleteKey()
• Registry_DeleteValue()
• Registry_GetProtectedString()
• Registry_GetValue()
• Registry_SetKeyValue()
• Registry_SetProtectedKeyString()
Registry_DeleteKey()
Description The Registry_DeleteKey() function deletes the specified key from the
registry.
Parameters • subtree – An integer specifying the registry subtree. The value corresponds
to one of the following constants:
Constant Description
REGKEY_CLASSES_ROOT HKEY_CLASSES_ROOT subtree
REGKEY_CURRENT_USER HKEY_CURRENT_USER subtree
REGKEY_LOCAL_MACHINE HKEY_LOCAL_MACHINE subtree
REGKEY_CURRENT_CONFIG HKEY_CURRENT_CONFIG subtree
• key – A string specifying the path of the key to delete from the registry. The
key cannot have any subkeys. If it does, you must delete the subkeys first.
• error_code – An optional returned long integer that contains the error code
that was returned. The error codes are defined in the WinError.h file of the
Windows SDK.
Return value A boolean indicating the result. The value true indicates the function
succeeded, while false indicates it did not.
Examples The following example deletes the “LicenseTerms” subkey for the specified
path in the registry.
result = Registry_DeleteKey(REGKEY_LOCAL_MACHINE,
➥ "SOFTWARE\Microsoft\Dynamics\4.0\Setup\LicenseTerms\", error_code);
460 F U N C T I O N L I B R A R Y R E F E R E N C E
R E G I S T R Y _ D E L E T E V A L U E ()
Registry_DeleteValue()
Description The Registry_DeleteValue() function deletes the specified value from the
registry.
Parameters • subtree – An integer specifying the registry subtree. The value corresponds
to one of the following constants:
Constant Description
REGKEY_CLASSES_ROOT HKEY_CLASSES_ROOT subtree
REGKEY_CURRENT_USER HKEY_CURRENT_USER subtree
REGKEY_LOCAL_MACHINE HKEY_LOCAL_MACHINE subtree
REGKEY_CURRENT_CONFIG HKEY_CURRENT_CONFIG subtree
• key – A string specifying the path of the key that contains the value to
delete. The path value begins with the key name followed by the subkey
names. The values in the path are separated by backslash (\) characters.
• error_code – An optional returned long integer that contains the error code
that was returned. The error codes are defined in the WinError.h file of the
Windows SDK.
Return value A boolean indicating the result. The value true indicates the function
succeeded, while false indicates it did not.
Examples The following example deletes the value “LicenseTermsVersion” from the
specified path in the registry.
local boolean result;
local long error_code;
result = Registry_DeleteValue(REGKEY_LOCAL_MACHINE,
➥ "SOFTWARE\Microsoft\Dynamics\4.0\Setup\LicenseTerms\",
➥ "LicenseTermsVersion", error_code);
Registry_GetProtectedString()
Description The Registry_GetProtectedString() function retrieves and decrypts the
specified value from the HKEY_CURRENT_USER subtree and key.
Parameters • key – A string specifying the path of the key that contains the value to
retrieve. The path value begins with the key name followed by the subkey
names. The values in the path are separated by backslash (\) characters.
• error_code – An optional returned long integer that contains the error code
that was returned. The error codes are defined in the WinError.h file of the
Windows SDK.
Return value A boolean indicating the result. The value true indicates the function
succeeded, while false indicates it did not.
Examples The following example retrieves the “Password” value of the specified key
in the HKEY_CURRENT_USER subtree of the registry. The entropy value
“12345” was used when the key was written, so this same entropy value is
used when the key is retrieved. If the password is retrieved, it is displayed
in a warning dialog.
result = Registry_GetProtectedString(
➥ "SOFTWARE\Microsoft\Dynamics GP\", "Password", string_value,
➥ "12345", error_code);
462 F U N C T I O N L I B R A R Y R E F E R E N C E
R E G I S T R Y _ G E T P R O T E C T E D S T R I N G ()
Registry_GetValue()
Description The Registry_GetValue() function retrieves the specified value from the
registry.
Parameters • subtree – An integer specifying the registry subtree. The value corresponds
to one of the following constants:
Constant Description
REGKEY_CLASSES_ROOT HKEY_CLASSES_ROOT subtree
REGKEY_CURRENT_USER HKEY_CURRENT_USER subtree
REGKEY_LOCAL_MACHINE HKEY_LOCAL_MACHINE subtree
REGKEY_CURRENT_CONFIG HKEY_CURRENT_CONFIG subtree
• key – A string specifying the path of the key that contains the value to
retrieve. The path value begins with the key name followed by the subkey
names. The values in the path are separated by backslash (\) characters.
• value – The value returned from the registry. The data type depends on the
type of value being retrieved from the registry.
• error_code – An optional returned long integer that contains the error code
that was returned. The error codes are defined in the WinError.h file of the
Windows SDK.
Return value A boolean indicating the result. The value true indicates the function
succeeded, while false indicates it did not.
Examples The following example retrieves a string value from the registry that
contains the location of the default instance of Dexterity. The complete path
of the value is:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dexterity\1033\
DEFAULT\SETUP\AppPath
464 F U N C T I O N L I B R A R Y R E F E R E N C E
R E G I S T R Y _ G E T V A L U E ()
Registry_SetKeyValue()
Description The Registry_SetKeyValue() function sets the specified value in the
registry.
Parameters • subtree – An integer specifying the registry subtree. The value corresponds
to one of the following constants:
Constant Description
REGKEY_CLASSES_ROOT HKEY_CLASSES_ROOT subtree
REGKEY_CURRENT_USER HKEY_CURRENT_USER subtree
REGKEY_LOCAL_MACHINE HKEY_LOCAL_MACHINE subtree
REGKEY_CURRENT_CONFIG HKEY_CURRENT_CONFIG subtree
• key – A string specifying the path of the key that contains the value to set.
The path value begins with the key name followed by the subkey names.
The values in the path are separated by backslash (\) characters. If the path
doesn’t exist in the registry, it will be created.
• value – The value to set. The data type depends on the type of value being
set in the registry.
• error_code – An optional returned long integer that contains the error code
that was returned. The error codes are defined in the WinError.h file of the
Windows SDK.
Return value A boolean indicating the result. The value true indicates the function
succeeded, while false indicates it did not.
Examples The following example sets the UserName value of the specified registry
key to “Steve”.
result = Registry_SetKeyValue(REGKEY_LOCAL_MACHINE,
➥ "SOFTWARE\Microsoft\Dynamics\4.0\Application\", "UserName",
➥ "Steve", error_code);
466 F U N C T I O N L I B R A R Y R E F E R E N C E
R E G I S T R Y _ S E T K E Y V A L U E ()
Registry_SetProtectedKeyString()
Description The Registry_SetProtectedKeyString() function encrypts and sets the
specified string value for the HKEY_CURRENT_USER subtree and key.
Parameters • key – A string specifying the path of the key that contains the value to set.
The path value begins with the key name followed by the subkey names.
The values in the path are separated by backslash (\) characters. If the path
doesn’t exist in the registry, it will be created.
• error_code – An optional returned long integer that contains the error code
that was returned. The error codes are defined in the WinError.h file of the
Windows SDK.
Return value A boolean indicating the result. The value true indicates the function
succeeded, while false indicates it did not.
Examples The following example sets the “Password” value of the specified key in the
HKEY_CURRENT_USER subtree of the registry. The entropy value “12345”
is used, so this same entropy value must be used when the key is retrieved.
local boolean result;
local long error_code;
result = Registry_SetProtectedKeyString(
➥ "SOFTWARE\Microsoft\Dynamics GP\", "Password", Password of globals,
➥ "12345", error_code);
468 F U N C T I O N L I B R A R Y R E F E R E N C E
Report function library
Use the functions in this library to create Quick Reports for your
application. Quick Reports are generated completely from sanScript,
making them flexible and fast. They are typically used for reports that must
be produced quickly and won’t require user modifications.
The first band of the report always starts in the upper left corner and
extends the width of the page. You specify the band’s height. Once a band is
created, you add text items to it. Typically, you will add only one text item
to the band, but you can add several items if necessary. When you have
finished adding text to the current band, you create a new one. The new
band starts immediately below the previous band, extends the width of the
page, and has the height you specify.
When you have added enough bands to fill the page, you must start a new
page and continue the process until the report is complete.
• Report_Begin()
• Report_DoubleLine()
• Report_End()
• Report_GetPageRemaining()
• Report_GetPageSize()
• Report_GetStringWidth()
• Report_NewBand()
• Report_NewPage()
• Report_ReadyToRun()
• Report_SetFont()
• Report_SingleLine()
• Report_WriteText()
When you create a Quick Report, you will typically use these functions in
the following manner:
470 F U N C T I O N L I B R A R Y R E F E R E N C E
R E P O R T _ B E G I N ()
Report_Begin()
Description The Report_Begin() function starts a Quick Report. This function must be
run before any other functions from the Reports function library.
Value Description
true Sends the report to the screen.
false Prevents the report from being sent to the screen.
Value Description
true Sends the report to the printer.
false Prevents the report from being sent to the printer.
Return value A boolean indicating whether the report was started; false if it could be
started, true if it could not.
Comments You must execute the Report_Begin() function before you use any other
functions from the Reports function library.
Reports can be sent to both the screen and the printer by setting the
screen_boolean and printer_boolean variables to true.
Examples This procedure script creates a Quick Report that lists all of the current
sellers in Seller_Data file of the Real Estate Sales Manager sample
application. The procedure is called to run in the background.
472 F U N C T I O N L I B R A R Y R E F E R E N C E
R E P O R T _ B E G I N ()
Report_DoubleLine()
Description The Report_DoubleLine() function draws a double line in the current
band. The double line is three points thick. It consists of a one-point line, a
one-point space and another one-point line.
Parameters • left_pos – The location of the left end of the double line, relative to the left
edge of the current band, measured in points.
• vertical_pos – The location of the top of the double line, relative to the top of
the current band, measured in points.
Examples This example draws a double line 100 points wide in the current band. The
line starts at the left edge and 5 points below the top of the band.
474 F U N C T I O N L I B R A R Y R E F E R E N C E
R E P O R T _ E N D ()
Report_End()
Description The Report_End() function completes the processing of a Quick Report.
Syntax Report_End()
Parameters • None
Report_GetPageRemaining()
Description The Report_GetPageRemaining() function returns how much vertical area
of the page remains, not including the current band. The value is measured
in points.
Syntax Report_GetPageRemaining()
Parameters • None
Return value An integer containing a measurement of the vertical area of the page that
remains, measured in points.
Comments Use this function to find out how much of the page remains when you want
to insert a new band. If there is not enough vertical space for an item to fit,
you can start a new page with the Report_NewPage() function, then insert
the new band.
This function should be used only for reports that you print to the screen or to the
printer. It does not return consistent results when you send a report only to a file.
Examples This example adds a band that is 24 points tall to the current report. The
Report_GetPageRemaining() function is used to verify that enough space
remains on the page for the band. If there is not enough space, a new page is
started.
476 F U N C T I O N L I B R A R Y R E F E R E N C E
R E P O R T _ G E T P A G E S I Z E ()
Report_GetPageSize()
Description The Report_GetPageSize() function returns the printable width and height
of the page, based on the settings for the currently-selected printer.
Parameters • width – An integer containing the printable width of the page. The width is
measured in points.
• height – An integer containing the printable height of the page. The height is
measured in points.
Comments You can use this function to calculate how many lines of text will fit on a
page. The page height in points divided by the number of points in each
line of text results in the number of lines per page.
Report_GetStringWidth()
Description The Report_GetStringWidth() returns the width of a string using the font,
font size and font style specified.
Parameters • font – An integer specifying the font to use for the text. The value
corresponds to one of the following constants:
Constant Description
FONT_COURIER Courier font
FONT_HELVETICA Helvetica font
FONT_TIMES Times font
• font_style – An integer specifying the style to use for the font. The values
correspond to the following constants:
Constant Description
FONT_STYLE_PLAIN Plain text
FONT_STYLE_BOLD Boldface text
FONT_STYLE_UNDERLINE Underlined text
FONT_STYLE_ITALIC Italicized text
You can add these constants together to apply multiple style characteristics.
For example, FONT_STYLE_BOLD+FONT_STYLE_UNDERLINE causes
the text to be boldfaced and underlined.
Return value An integer containing the width of the string, measured in points.
Comments You can use the Report_GetStringWidth() function to verify that a string
will fit on a page.
Examples This example calculates the width of the specified string when it is
displayed in Courier 12 point bold type.
local integer string_size;
478 F U N C T I O N L I B R A R Y R E F E R E N C E
R E P O R T _ N E W B A N D ()
Report_NewBand()
Description The Report_NewBand() creates a new band in the report.
Syntax Report_NewBand(height)
Parameters • height – An integer specifying the height of the band. The height is
measured in points.
Comments The first band for a report starts in the upper left corner of the report,
extends the width of the page, and has the height you specify. Any
additional band you add starts immediately below the previous band.
Report_NewPage()
Description The Report_NewPage() function creates a new page for the report.
Syntax Report_NewPage()
Parameters • None
480 F U N C T I O N L I B R A R Y R E F E R E N C E
R E P O R T _ R E A D Y T O R U N ()
Report_ReadyToRun()
Description The Report_ReadyToRun() function verifies that a new Quick Report can
be run. A Quick Report can’t be started if any type of report is being
displayed on the screen.
Syntax Report_ReadyToRun()
Parameters • None
Return value A boolean value indicating whether the new report can begin; true
indicates the report can begin running, false indicates it can’t.
Examples This example uses a repeat loop to delay processing until the Quick Report
can be started. This example should be used in a script that runs only in the
background.
repeat
result = Report_ReadyToRun();
until result = true;
Report_SetFont()
Description The Report_SetFont() function specifies the characteristics of the font to use
for the Quick Report.
Parameters • font – An integer specifying the font to use for the text. The value
corresponds to one of the following constants:
Constant Description
FONT_COURIER Courier font
FONT_HELVETICA Helvetica font
FONT_TIMES Times font
• font_style – An integer specifying the style to use for the font. The values
correspond to the following constants:
Constant Description
FONT_STYLE_PLAIN Plain text
FONT_STYLE_BOLD Boldface text
FONT_STYLE_UNDERLINE Underlined text
FONT_STYLE_ITALIC Italicized text
You can add these constants together to apply multiple style characteristics.
For example, FONT_STYLE_BOLD+FONT_STYLE_UNDERLINE causes
the text to be boldfaced and underlined.
482 F U N C T I O N L I B R A R Y R E F E R E N C E
R E P O R T _ S I N G L E L I N E ()
Report_SingleLine()
Description The Report_SingleLine() function draws a single line in the current band.
The line is one point thick.
Parameters • left_pos – The location of the left end of the line, relative to the left edge of
the current band, measured in points.
• vertical_pos – The location of the top of the line, relative to the top of the
current band, measured in points.
Examples This example draws a line 100 points wide in the current band. The line
starts at the left edge and 5 points below the top of the band.
Report_WriteText()
Description The Report_WriteText() function adds a text string to the current band.
Parameters • left_pos – The location of the left edge of the text rectangle, relative to the left
edge of the current band, measured in points.
• top_pos – The location of the top edge of the text rectangle, relative to the top
of the current band, measured in points.
Constant Description
ALIGN_LEFT Left aligned
ALIGN_CENTER Center aligned
ALIGN_RIGHT Right aligned
Comments When specifying the width and height of the text rectangle, keep in mind
that the text in the rectangle will be positioned at the top of the text
rectangle, allowing appropriate space for accented characters. If the
text rectangle is not large enough, the text will but cut off on the right and
bottom.
484 F U N C T I O N L I B R A R Y R E F E R E N C E
Resource function library
Use the functions in this library when you are working with lists of
resources in an application. This library contains the following functions:
• Resource_EndSeriesFill()
• Resource_FillSeriesList()
• Resource_GetDisplayName()
• Resource_GetID()
• Resource_GetInfo()
• Resource_GetNthResource()
• Resource_GetResourceName()
• Resource_GetSubResourceName()
• Resource_StartSeriesFill()
Refer to Chapter 5, Some of the functions in this library work together to perform certain
“Security,” in the operations. The functions in the following list read the list of forms, reports,
Stand-alone tables and table groups from the application dictionary. They are typically
Application Guide for used in the implementation of application security.
more information
about application • Resource_StartSeriesFill()
security. • Resource_GetInfo()
• Resource_EndSeriesFill()
Resource_EndSeriesFill()
Description The Resource_EndSeriesFill() function releases resources that have been
read into memory by the Resource_StartSeriesFill() function.
Syntax Resource_EndSeriesFill()
Parameters • None
Comments When you are finished working with the resources, the
Resource_EndSeriesFill() function should be used to release the resources
that were read into memory by the Resource_StartSeriesFill() function.
This frees up memory used to store information about the resources.
486 F U N C T I O N L I B R A R Y R E F E R E N C E
R E S O U R C E _ F I L L S E R I E S L I S T ()
Resource_FillSeriesList()
Description The Resource_FillSeriesList() function fills two list fields (fields that use a
list box or drop-down list control type) with the display names and
technical names of resources of a specified resource type and series.
• type – An integer specifying the type of resource whose names will fill the
list fields dnames_list and tnames_list. The types, and their corresponding
integer values, are shown in the following table.
Value Description
40 Forms
43 Tables
44 Table Groups
45 Reports
• series – An integer specifying the series of the forms, reports, tables and
table groups whose names will fill the list fields dnames_list and tnames_list.
The following table lists all the series and their corresponding integer
values.
• dnames_list – A window list field that displays the returned display names
of the specified resources.
• tnames_list – A window field that displays the internal technical names for
the specified resources. Names in this list must be used when referring to
resource names in scripts.
If there is no main window for a form, the display name for the form will be
“Main Window Missing”.
Be sure the series resource lists are up to date before you use this function. You can
use the Series Resources utility in Dexterity Utilities to update series resources.
Examples The following example returns the names of forms (ID=40) from the third-
party series (ID=10) to two list box window fields. The Display Names field
contains display names, while the Technical Names field contains technical
names. The product ID is represented by the constant INVENT_PRODID.
Additional information
Updating series resources on page 50 of the Dexterity Utilities manual.
488 F U N C T I O N L I B R A R Y R E F E R E N C E
R E S O U R C E _ G E T D I S P L A Y N A M E ()
Resource_GetDisplayName()
Description The Resource_GetDisplayName() function returns a string containing the
display name of a specified resource in an application dictionary.
Constant Description
FORMTYPE Indicates a form.
TABLETYPE Indicates a table.
GROUPTYPE Indicates a table group.
REPORTTYPE Indicates a report.
Return value A string containing the display name of the resource. If there is no main
window for the form, the string “[No Display Name]” is returned.
Comments If you implement activity tracking in your application, you can use this
function in conjunction with the Security procedure to retrieve the display
name of a selected resource. The Security procedure runs each time a form,
report, or table is accessed. A dictionary ID, resource type and a resource ID
for the resource being accessed are automatically passed as in parameters
for the Security procedure. With this information,
Resource_GetDisplayName() can ascertain the resource’s display name,
then store the name in an activity table (see the following example).
Examples The following Security procedure returns the dictionary ID, resource type
and resource ID of the currently active form, report or table group. It passes
these values to a procedure that updates the Activity Master table.
490 F U N C T I O N L I B R A R Y R E F E R E N C E
R E S O U R C E _ G E T ID ()
Resource_GetID()
Description The Resource_GetID() function returns the resource ID for a specified
resource type and name.
Return value An integer containing the resource ID for the specified resource. If the
resource can’t be located, 0 is returned.
Examples The following example returns the resource ID of the Inventory Data Table
to a local variable. The product ID is represented by the constant
INVENT_PRODID.
Resource_GetInfo()
Description The Resource_GetInfo() function returns the resource ID and resource
name for a form, report, table or table group for a specified series.
Value Description
40 Forms
43 Tables
44 Table Groups
45 Reports
You should consider setting up constants for each of these integer values if you plan
to use this function frequently.
• index – An integer specifying the position in the series resource list from
which information is returned. This number must be between 1 and the
number of resources of the specified type and series returned by
Resource_StartSeriesFill(). Typically, the counter variable for a for loop is
used to increment the index parameter from 1 to the number of resources
returned by Resource_StartSeriesFill(). For each iteration of the loop, the
name and resource ID are read for the resource indicated by the counter
variable.
• name – A returned string containing the resource’s display name. Form and
table names returned here aren’t technical names as you’ve defined them in
your dictionary. Rather, the display name of the main window in the form is
returned for forms and the display name of the table is returned for tables.
Return value An integer containing the resource ID of the resource. If the resource can’t
be found, the value 0 is returned.
492 F U N C T I O N L I B R A R Y R E F E R E N C E
R E S O U R C E _ G E T I N F O ()
Be sure the series resource lists are up to date before you use this function. You can
use the Series Resources utility in Dexterity Utilities to update series resources.
Additional information
Updating series resources on page 50 of the Dexterity Utilities manual.
Resource_GetNthResource()
Description The Resource_GetNthResource() function returns the resource ID, name,
and series of the specified resource.
• series – An integer indicating the series the resource is assigned to. The
possible values are shown in the following list:
Series
1 – Financial
2 – Sales
3 – Purchasing
4 – Inventory
5 – Payroll
6 – Project
7 – System
494 F U N C T I O N L I B R A R Y R E F E R E N C E
R E S O U R C E _ G E T N T H R E S O U R C E ()
Return value An integer containing the resource ID of the specified resource. If the
resource doesn’t exist, the value 0 is returned.
i = 1;
repeat
resource_ID = Resource_GetNthResource(PROD_ID, 6, i,
➥ resource_name, resource_series);
if resource_ID <> 0 then
add item resource_name to '(L) Resources';
end if;
i = i + 1;
until resource_ID = 0;
redraw field '(L) Resources';
Resource_GetResourceName()
Description The Resource_GetResourceName() function returns the technical name for
a specified resource type and ID. This is not the display name.
Return value A string containing the resource’s technical name. If the resource can’t be
found, the string [Not Found] is returned.
Examples The following example returns the name of the field whose resource ID is
22000. The product ID is represented by the constant RESM_PRODID.
496 F U N C T I O N L I B R A R Y R E F E R E N C E
R E S O U R C E _ G E T S U B R E S O U R C E N A M E ()
Resource_GetSubResourceName()
Description The Resource_GetSubResourceName() function returns the name for a
specified subresource of a primary resource.
Return value A string containing the resource name. If the resource can’t be found, the
string [Not Found] is returned.
Examples The following example returns the names of the commands in the the
CL_Reports command list.
for i = 1 to CommandList_NumCommands(command_list_tag) do
item_tag = CommandList_GetCommandByPosition(command_list_tag, i);
result = Command_GetIDs(item_tag, dict_ID, form_ID, res_ID);
command_name = Resource_GetSubResourceName(dict_ID, MT_FORM,
➥ form_ID, DT_COMMAND, res_ID);
498 F U N C T I O N L I B R A R Y R E F E R E N C E
R E S O U R C E _ S T A R T S E R I E S F I L L ()
Resource_StartSeriesFill()
Description The Resource_StartSeriesFill() function returns the number of resources of
a specific type (forms, reports, tables or table groups) for a specified series.
• type – An integer specifying the type of resource. Use the following integer
values for resource types:
Value Description
40 Forms
43 Tables
44 Table Groups
45 Reports
You should consider setting up constants for each of these integer values if you plan
to use this function frequently.
• series – An integer specifying the series of the forms, reports, tables, or table
groups for which the count will be returned. The
Resource_StartSeriesFill() function will count only resources of the
specified type from the series you indicate here.
The following table lists the series that can be applied to forms and reports
and the series’ corresponding integer values. You apply a series to a form
using the Form Definition window or to a report using the Report
Definition window.
The following table lists the series that can be applied to tables and table
groups and the series’ corresponding integer values. You can apply a series
to a table in the Table Definition window. You apply a series to a Table
Group when you create it using Dexterity Utilities.
Return value An integer containing the number of the forms, reports, tables or table
groups in the specified series.
Be sure the series resource lists are up to date before you use this function. You can
use the Series Resources utility in Dexterity Utilities to update series resources.
500 F U N C T I O N L I B R A R Y R E F E R E N C E
R E S O U R C E _ S T A R T S E R I E S F I L L ()
{Count number of forms in the Sales series. The count variable will
return the number of forms. The product ID is 0.}
count = Resource_StartSeriesFill(0, restype, l_Series);
Additional information
Updating series resources on page 50 of the Dexterity Utilities manual.
• Runtime_GetClientType()
• Runtime_GetCPUType()
• Runtime_GetCurrentProductID()
• Runtime_GetModuleInfo()
• Runtime_GetOSBuildInfo()
• Runtime_GetOSInfo()
• Runtime_GetVersionNum()
• Runtime_GetWebClientTrustLevel()
• Runtime_SetAboutMenu()
• Runtime_SetFieldEnterMode()
• Runtime_SetIcon()
Runtime_GetClientType()
Description The Runtime_GetClientType() function returns information about the
runtime engine that is processing the application.
Syntax Runtime_GetClientType()
Parameters • None
Return value An integer. The value corresponds to one of the following constants.
Constant Description
DEX_CLIENT_TYPE_STANDARD The standard runtime engine for Windows.
DEX_CLIENT_TYPE_WEB The runtime engine for the web client.
DEX_CLIENT_TYPE_NO_UI The runtime engine that does not directly present a
user interface, such as the Process Server.
Comments This function is typically used when writing code that can be performed
only for a specific client type.
Examples The following code is a portion of a form procedure script that registers a
third-party workflow for Microsoft Dynamics GP. Because workflow is
supported only on the standard client, the Runtime_GetClientType()
function is used to find out whether the code should be run.
local string assembly_path;
local long delay;
504 F U N C T I O N L I B R A R Y R E F E R E N C E
R U N T I M E _ G E T C P U T Y P E ()
Runtime_GetCPUType()
Description The Runtime_GetCPUType() function returns information about the
central processing unit (CPU) on which the application is being run.
Syntax Runtime_GetCPUType(specific_class)
Constant Description
DEX_CPU_I486 Intel 486
DEX_CPU_PENTIUM Intel Pentium
DEX_CPU_PENTIUM_II Intel Pentium II
DEX_CPU_PENTIUM_III Intel Pentium III
Constant Description
DEX_CPU_UNKNOWN Unknown CPU
DEX_CPU_Ix86 Intel X86
general_CPU_class = Runtime_GetCPUType(specific_CPU_class);
if general_CPU_class <> 0 then
case general_CPU_class
in [DEX_CPU_Ix86]
CPU_description = "Intel 80X86";
else
CPU_description = "Unknown CPU type";
end case;
else
CPU_description = "Unknown CPU type";
end if;
warning CPU_description;
Runtime_GetCurrentProductID()
Syntax Runtime_GetCurrentProductID()
Parameters • None
product_ID = Runtime_GetCurrentProductID();
506 F U N C T I O N L I B R A R Y R E F E R E N C E
R U N T I M E _ G E T M O D U L E I N F O ()
Runtime_GetModuleInfo()
Description The Runtime_GetModuleInfo() function retrieves the major and minor
version and the build number from the application dictionary. The values
returned correspond to the selections made in one of the following
locations:
• module – An integer indicating the module for which version numbers are
being retrieved.
Return value An integer indicating the major version of the specified module.
Comments When you use the Create Chunk Dictionary window or the Auto-Chunk
window in Dexterity Utilities to create a chunk dictionary, you specify a
module and the major and minor version numbers and build number
associated with that module. When the chunk dictionary is “unchunked,”
the major and minor version numbers and build number for the specified
accounting module are written to the application dictionary. Typically, the
version numbers are retrieved from the application dictionary and
displayed in the application’s About Box.
For example, assume the chunk dictionary used to install the first version of
an application had a major version number of 1, a minor version number of
0 (Version 1.0), and a build number of 1. When the application is updated,
the chunk dictionary for the update could be assigned a major version
number of 1, a minor version number of 1 (Version 1.1), and a build number
of 2.
508 F U N C T I O N L I B R A R Y R E F E R E N C E
R U N T I M E _ G E T O SB U I L D I N F O ()
Runtime_GetOSBuildInfo()
Parameters • build_number – A returned long integer indicating the build number of the
current operating system.
Runtime_GetOSInfo()
Description The Runtime_GetOSInfo() function returns information about the
operating system on which the application is being run.
Return value An integer indicating the specific type of operating system being used:
Constant Description
DEX_OS_UNKNOWN Unknown operating system
DEX_OS_WINDOWS_NT Windows NT®
DEX_OS_WINDOWS_95 Windows 95
DEX_OS_WINDOWS_98 Windows 98
DEX_OS_WINDOWS_MILLENNIUM Windows ME
DEX_OS_WINDOWS_2000 Windows 2000
DEX_OS_WINDOWS_XP Windows XP
DEX_OS_WINDOWS_VISTA Windows Vista
DEX_OS_WINDOWS_SERVER_2003 Windows Server® 2003
DEX_OS_WINDOWS_SERVER_2008 Windows Server 2008
DEX_OS_WINDOWS_SERVER_2008R2 Windows Server 2008 R2
DEX_OS_WINDOWS_SERVER_2012 Windows Server 2012
DEX_OS_WINDOWS_7 Windows 7
DEX_OS_WINDOWS_8 Windows 8
510 F U N C T I O N L I B R A R Y R E F E R E N C E
R U N T I M E _ G E T O SI N F O ()
Runtime_GetVersionNum()
Description The Runtime_GetVersionNum() function returns a string describing the
current version of the runtime engine.
Syntax Runtime_GetVersionNum()
Parameters • None
Return value A string containing the version number of the runtime engine.
Comments The string that the version number is returned to should be 255 characters
long. This ensures that string overflow errors won’t occur when the version
string is returned.
Examples In the following example, the current version of the runtime engine is
returned to the Version field in the window named About_Box.
512 F U N C T I O N L I B R A R Y R E F E R E N C E
R U N T I M E _ G E T W E B C L I E N T T R U S T L E V E L ()
Runtime_GetWebClientTrustLevel()
Description The Runtime_GetWebClientTrustLevel() function returns an integer
indicating the trust level of the Silverlight application for the web client.
Syntax Runtime_GetWebClientTrustLevel()
Parameters • None
Constant Description
TRUST_LEVEL_FULL The Silverlight application for the web client is
running in fully-trusted mode.
TRUST_LEVEL_SANDBOXED The Silverlight application for the web client is
running in sandboxed mode.
Comments By default, the Silverlight application for the web client runs in
“sandboxed” mode. This means it has restricted access to local system
resources. When a user attempts to perform an action (such as
downloading a file that was created by a report) the sandboxed mode may
prevent them from doing so. The local system can be configured to run the
Silverlight application for the web client with enhanced trust level,
allowing these formerly restricted actions.
Examples In the following example, the current trust level of the web client
application is examined. If the application is being run in trusted mode, an
export routine is called. Otherwise, a message is displayed to the user.
Runtime_SetAboutMenu()
Description The Runtime_SetAboutMenu() function allows you to change the
application name in the About menu item. This name will also appear on
system dialogs, like those displayed when using the error and warning
statements. This function will change the title of the application in the
runtime engine’s title bar.
Syntax Runtime_SetAboutMenu(application_name)
Parameters • application_name – The string that will appear in the About menu item.
Comments The runtime engine will automatically open any form named “About Box”
when the About menu item is chosen.
Examples In the following example, the string “Time and Billing” is concatenated
with the default text in the About menu to set the menu item to “About
Time and Billing.”
514 F U N C T I O N L I B R A R Y R E F E R E N C E
R U N T I M E _ S E T F I E L D E N T E R M O D E ()
Runtime_SetFieldEnterMode()
Description The Runtime_SetFieldEnterMode() function allows users to press the
ENTERkey instead of the TAB key to move the focus from field to field in a
window.
Syntax Runtime_SetFieldEnterMode(mode)
Value Description
0 Enables the TAB key mode.
1 Disables the TAB key mode.
Comments Dexterity applications use the TAB key as the default method of data entry.
This function allows a user to choose the preferred method of data entry.
When the ENTER key is used to move the focus, SHIFT+RETURN or
SHIFT+ENTER must be used to activate a push button field with the Default
property set to true or a push button currently focused in a window.
Examples The following example disables TAB key mode, allowing the ENTER key to
move the focus from field to field in a tab sequence.
result = Runtime_SetFieldEnterMode(1);
The following example enables TAB key mode, allowing the TAB key to
move the focus from field to field. In this case, the ENTER key will activate a
push button field with the Default property set to true or a push button
currently focused in a window.
result = Runtime_SetFieldEnterMode(0);
Runtime_SetIcon()
Description The Runtime_SetIcon() function allows you to specify which icons will be
displayed in the application.
Parameters • type – An integer specifying which icon type is being specified. Use one of
the following constants:
Constant Description
APPLICATION_ICON This is the icon displayed in the application’s title
bar.
PRIMARY_ICON This is the icon displayed in the title bar of all
primary window.
Constant Description
ICON_GREATPLAINS The logo for Great Plains.
ICON_GRAYFORM A plain “form” icon to be used as an icon in
primary windows.
ICON_GREATPLAINSFORM A “form” icon that contains the logo for Great
Plains.
Return value A boolean. True indicates the icon was set, while false indicates it was not.
Examples The following example is part of the Main Menu form pre script. It sets the
icon to use for the application to be the logo for Great Plains.
516 F U N C T I O N L I B R A R Y R E F E R E N C E
Script log function library
Use the functions in this library to access the script logging capability from
within sanScript. Refer to Chapter 29, “Script Logger,” in Volume 2 of the
Dexterity Programmer’s Guide for information about the Script Logger.
This library contains the following functions:
• ScriptLog_Start()
• ScriptLog_Stop()
ScriptLog_Start()
Description The ScriptLog_Start() function starts logging scripts, writing the script log
to the specified output file.
Syntax ScriptLog_Start(path)
Parameters • path – A string specifying the path and filename for the script log being
written. The path must be in native format.
Return value A boolean. The value true indicates the script log could be written, while
the value false indicates it could not.
Examples The following example writes a script log named ExplorerScripts.log in the
root folder.
local boolean result;
result = ScriptLog_Start("c:\ExporerScripts.log");
if result = false then
error "Script log could not be written.";
end if;
518 F U N C T I O N L I B R A R Y R E F E R E N C E
S C R I P T L O G _ S T O P ()
ScriptLog_Stop()
Description The ScriptLog_Stop() function stops logging scripts, closing the current
output file.
Syntax ScriptLog_Stop()
Parameters • None
result = ScriptLog_Stop();
• ScriptProfile_Clear()
• ScriptProfile_Save()
• ScriptProfile_Start()
• ScriptProfile_Stop()
ScriptProfile_Clear()
Description The ScriptProfile_Clear() function clears the script profile currently in
memory.
Syntax ScriptProfile_Clear()
Parameters • None
Comments The script profile remains in memory until you clear it.
result = ScriptProfile_Clear();
522 F U N C T I O N L I B R A R Y R E F E R E N C E
S C R I P T P R O F I L E _ S A V E ()
ScriptProfile_Save()
Description The ScriptProfile_Save() function saves the script profile currently in
memory to the specified output file.
Parameters • path – A string specifying the path and filename for the script profile being
written. The path must be in native format.
• format – An integer specifying the format to use for the script profile
information. Use one of the following constants:
Constant Description
TEXTFILE Script profile written as plain text.
TABFILE Script profile written with tab characters between
items.
Return value A boolean. The value true is returned if an output path has been specified.
The value false is returned in no output path has been specified.
Examples The following example saves the current script profile to the file named
ExplorerProfile.txt in the root folder.
ScriptProfile_Save("c:\ExplorerProfile.txt", TEXTFILE);
ScriptProfile_Start()
Description The ScriptProfile_Start() function causes the application to start profiling
scripts.
Syntax ScriptProfile_Start()
Parameters • None
Comments You may want to use the ScriptProfile_Clear() function to clear the current
script profile before starting the script profiler. Otherwise, the results will be
included with the current profile information in memory.
result = ScriptProfile_Clear();
result = ScriptProfile_Start();
524 F U N C T I O N L I B R A R Y R E F E R E N C E
S C R I P T P R O F I L E _ S T O P ()
ScriptProfile_Stop()
Description The ScriptProfile_Stop() function causes the application to stop profiling
scripts.
Syntax ScriptProfile_Start()
Parameters • None
Comments This function leaves the profile information in memory. Use the
ScriptProfile_Clear() function to clear the current script profile.
result = ScriptProfile_Stop();
• Shell_DisplayNotification()
Shell_DisplayNotification()
Description The Shell_DisplayNotification() function causes a notification to be
displayed in the lower-right corner of the display. Notifications can be used
only when the SDI shell is being used for the application.
Parameters • style – An integer specifying the style used for the notification. The value
corresponds to one of the following constants:
• subject – A string containing the subject line to display for the notification.
• message – A string or text value containing the text to display for the
notification.
528 F U N C T I O N L I B R A R Y R E F E R E N C E
S H E L L _ D I S P L A Y N O T I F I C A T I O N ()
Return value A boolean. The value true indicates the notification was successfully
displayed, while false indicates it was not.
Comments The following illustration shows a notification displayed for the user.
The string for the link specifies the procedure or form-level procedure to be
run when the user clicks the notification. The following syntax is used to
execute a global procedure when the notification is clicked:
http://dexterity/product=prod_ID/script=procedure/args=arg_val
http://dexterity/product=prod_ID/script=procedure/form=form/
args=arg_val
The prod_ID is the dictionary ID of the product that contains the procedure
to be run. The procedure value specifies the procedure to be run. The form
value is supplied to specify the form the form-level procedure to be run is
defined for. The arg_val is used to pass an integer value or string value to
the procedure being run. If an argument is to be passed from the
notification, the procedure being run must have an “in” parameter of type
integer or string to receive the value. If a string value is passed, the value
must be enclosed in single quotes. (''). If no argument is passed, it can be
omitted from the link string.
Examples The following example displays a notification for the user. No action is
performed when the user clicks the notification.
530 F U N C T I O N L I B R A R Y R E F E R E N C E
S H E L L _ D I S P L A Y N O T I F I C A T I O N ()
in string LeadID;
SQL_Clear() SQL
Description The SQL_Clear() function clears any results sets and errors for the specified
pass-through SQL connection.
Syntax SQL_Clear(SQL_connection)
Return value A long integer indicating the status. The value 0 is returned if the results set
was successfully cleared. Any other value indicates an error occurred.
Comments Use the SQL_Clear() function if you will be executing several sets of SQL
statements using one pass-through SQL connection.
Examples The following example clears the results sets and errors for the pass-
through SQL connection indicated by the SQL_connection variable.
534 F U N C T I O N L I B R A R Y R E F E R E N C E
S Q L _ C O N N E C T ()
SQL_Connect() SQL
Syntax SQL_Connect(SQL_connection)
Parameters • SQL_connection – A returned long integer containing the ID of the new pass-
through SQL connection.
Return value A long integer indicating the status of the pass-through SQL connection.
The value 0 is returned if the connection was successfully created. Any
other value indicates an error occurred.
Comments The pass-through SQL connection is active until you use the
SQL_Terminate() function to terminate it.
SQL_DescribeColumn() SQL
• column – An integer specifying the column in the current results set for
which information will be returned. The value 1 indicates the first column.
DATATYPE_BOOLEAN DATATYPE_LONG_INTEGER
DATATYPE_VCURRENCY DATATYPE_STRING
DATATYPE_DATE DATATYPE_TEXT
DATATYPE_INTEGER DATATYPE_TIME
Return value A long integer indicating whether information was retrieved. The value 0 is
returned if description information was successfully retrieved. Any other
value indicates an error occurred.
536 F U N C T I O N L I B R A R Y R E F E R E N C E
SQ L _ D E S C R I B E C O L U M N ()
Examples The following example retrieves information about the second column in
the current results set for the pass-through SQL connection specified by the
SQL_connection variable.
SQL_Execute() SQL
Description The SQL_Execute() function executes the SQL string using the pass-
through SQL connection specified.
Return value A long integer indicating the status of the SQL execution. The value 0 is
returned if the statements were executed successfully. Any other value
indicates an error occurred.
Comments Use the SQL_GetError() function to retrieve specific information about any
error that occurred while executing SQL statements.
In certain cases, you may need to execute more than 32K of SQL statements
at one time. You can do this using an array of text fields. Copy the first 32K
of SQL statements into the first element of the text array, the next 32K of
statements into the second element, and so on. Then pass the first element
of the array to the SQL_Execute() function. The array elements will
automatically be assembled and the SQL statements will be executed in the
appropriate order. For example, the following statement executes the SQL
statements in the SQL_Statements array field.
status = SQL_Execute(SQL_connection, field SQL_Statements[1]);
If you use the same text field array to execute several sets of SQL statements, be
sure to clear out any unused elements of the array before you execute additional
statements. Otherwise, you may inadvertently run some SQL statements from the
previous set.
Examples The following example uses pass-through SQL to retrieve information from
SQL tables for the Real Estate Sales Manager sample application. First,
a SQL statement is executed to switch to the RESM database. Then two
more SQL statements are executed that retrieve seller and house
information for a specified seller. Two results sets are returned. The first
contains seller information, while the second contains house information.
The retrieved information is formatted and displayed in a warning message
displayed to the user.
538 F U N C T I O N L I B R A R Y R E F E R E N C E
SQ L _ E X E C U T E ()
{Query information}
local string seller_first_name, seller_last_name;
local string house_address, house_city;
540 F U N C T I O N L I B R A R Y R E F E R E N C E
SQ L _ E X E C U T E ()
else
error "Could not switch to the correct database.";
end if;
{Disconnect from the SQL data source.}
status = SQL_Terminate(SQL_connection);
else
{An error occurred creating the pass-through SQL connection.}
warning "An error occurred creating the pass-through SQL
➥ connection: " + str(status);
end if;
SQL_FetchNext() SQL
Description The SQL_FetchNext() function retrieves the next row from the current
results set for the specified pass-through SQL connection.
Syntax SQL_FetchNext(SQL_connection)
Return value A long integer indicating the status of the fetch operation. The value 0
indicates a row was successfully retrieved. The value 31 indicates there is
no more data in the results set. Any other value indicates another error
occurred while retrieving the next row in the results set.
Comments You must execute the SQL_FetchNext() function one time to move to the
first row in the current results set.
Once you have moved to the next row in a results set, you can’t return to
the previous row. If the number of rows in the results set is not known, use
the SQL_FetchNext() function to move to the next row in the results set
until error 31 is returned.
Use the SQL_GetData() function to retrieve data from the current line in
the results set.
542 F U N C T I O N L I B R A R Y R E F E R E N C E
SQ L_G E T D A T A ()
SQL_GetData() SQL
Description The SQL_GetData() function returns the data in the specified column in the
current row of the current results set for the specified pass-through SQL
connection.
• column – A long integer specifying the column in the current results set
from which data will be returned. The value 1 indicates the first column.
• data – The data returned. The storage type of this variable or field must be
compatible with the value returned. When possible, the value returned will
be converted to the storage type of the variable or field.
Return value A long integer indicating the status of the retrieval operation. The value 0
indicates data was successfully retrieved. Any other value indicates an
error occurred.
SQL_GetError() SQL
Description The SQL_GetError() function returns information about the last error that
occurred for the current results set of the specified pass-through SQL
connection.
Value Description
0 No error
41 Can’t find specified column
56 Can’t find specified table
58 Syntax error in SQL statement
• SQL_error_string – A string containing the text for the native SQL Server
error that occurred.
Return value A long integer indicating whether error information was available and
successfully retrieved. If the value is 0, error information was available
and successfully retrieved.
544 F U N C T I O N L I B R A R Y R E F E R E N C E
SQL _ G E T E R R O R ()
Examples The following example retrieves and displays information about the last
error that occurred for the pass-through SQL connection specified by the
SQL_connection variable. The errors are displayed in a series of messages
for the user.
SQL_GetNextResults() SQL
Description The SQL_GetNextResults() function moves to the next results set for the
specified pass-through SQL connection.
Syntax SQL_GetNextResults(SQL_connection)
Return value A long integer indicating whether the operation was successful. The value 0
indicates the next results set was successfully moved to. The value 31
indicates there are no more results sets for the pass-through SQL
connection. Any other value indicates another error occurred.
Comments Once you have moved to the next results set, you can’t return to the
previous results set. If the number of results sets is not known, use the
SQL_GetNextResults() function to move to the next results set until error
31 is returned.
546 F U N C T I O N L I B R A R Y R E F E R E N C E
S Q L _ G E T N U M C O L S ()
SQL_GetNumCols() SQL
Return value A long integer indicating whether the operation was successful. The value 0
indicates the number of columns was successfully retrieved. Any other
value indicates an error occurred.
Examples The following example retrieves the number of columns in the current
results set for the pass-through SQL connection specified by the
SQL_connection variable.
SQL_GetNumRows() SQL
Description The SQL_GetNumRows() function returns the number of rows that were
affected by a write operation for the specified pass-through SQL
connection.
Return value A long integer indicating whether the operation was successful. The value 0
indicates that the number of rows affected was successfully retrieved. Any
other value indicates an error occurred.
Comments The SQL_GetNumRows() function does not return the number of rows in a
results set.
For this function to properly return the number of rows affected, the
“nocount” flag must be turned off for the pass-through SQL connection.
You can turn this flag off by executing the following SQL statement:
After you have finished executing SQL statements and using the
SQL_GetNumRows() function to find out how many rows were affected,
be sure to set the “nocount” flag to on. Do this using the following SQL
statement:
set nocount on
This is the state that Dexterity expects the pass-through SQL connection to
be in.
548 F U N C T I O N L I B R A R Y R E F E R E N C E
S Q L _ G E T N U M R O W S ()
Examples The following example deletes rows from the HOUSEDAT table where the
City is Fargo. The SQL_GetNumRows() function retrieves the number of
rows that were affected.
status = SQL_Connect(SQL_connection);
if status = 0 then
{Be sure the nocount flag is set properly.}
SQL_Statements = "set nocount off";
status = SQL_Execute(SQL_connection, field SQL_Statements);
{Store the SQL statement in hidden window field.}
SQL_Statements = "delete from HOUSEDAT where City = 'Fargo'";
{Execute the SQL statement.}
status = SQL_Execute(SQL_connection, field SQL_Statements);
if status = 0 then
{Display the number of rows affected.}
status = SQL_GetNumRows(SQL_connection, num_rows);
warning "Number of rows affected: " + str(num_rows);
else
error "An error occurred executing the SQL statement.";
end if;
status = SQL_Terminate(SQL_connection);
else
error "Unable to create the pass-through SQL connection.";
end if;
SQL_Terminate() SQL
Syntax SQL_Terminate(SQL_connection)
Return value A long integer indicating whether the terminate operation was successful.
The value 0 indicates the pass-through SQL connection was successfully
terminated. Any other value indicates an error occurred.
Comments Pass-through SQL connections are active until you use the
SQL_Terminate() function to terminate them.
550 F U N C T I O N L I B R A R Y R E F E R E N C E
Table function library
Use the functions in this library when implementing table maintenance
routines or specifying special options for tables. This library contains the
following functions:
• Table_AutoShrink()
• Table_Compare()
• Table_CopyShrinkRecords()
• Table_CreateIndexes()
• Table_CreateProcedures())
• Table_DisableErrorChecks()
• Table_DropProcedures()
• Table_EndConversion()
• Table_EndShrink()
• Table_FillGroupList()
• Table_FillList()
• Table_FlushCache()
• Table_GetAutoShrinkMode()
• Table_GetDisplayName()
• Table_GetFieldList()
• Table_GetGroup()
• Table_GetKeyFieldList()
• Table_GetKeyInfo()
• Table_GetKeyOption()
• Table_GetNumberOfKeys()
• Table_GetOSName()
• Table_GetRangeKey()
• Table_GetSeries()
• Table_GetSQLErrorText()
• Table_IsRangeSet()
• Table_OpenAsTemp()
• Table_OpenNewBuffer()
• Table_RebuildIndexes()
• Table_SetCreateMode()
• Table_SetDBType()
• Table_SetDeleteOptions()
• Table_SetRefreshFlags()
• Table_StartConversion()
• Table_StartShrink()
• Table_Truncate()
• Table_VerifyRecord()
Refer to Chapter 26, These functions list table groups and the tables in table groups:
“Table Groups,” in Vol-
ume 1 of the Dexterity • Table_FillGroupList()
Programmer’s Guide • Table_FillList()
for more information
about table groups. These functions are used for automatically shrinking and rebuilding tables
and indexes:
Refer to Chapter 60, These functions are used to convert data for tables that have had their table
“Updating an Applica- definitions changed:
tion,” in Volume 1 of
the Dexterity • Table_StartConversion()
Programmer’s Guide • Table_EndConversion()
for information about
converting data. These functions are used for SQL tables:
• Table_Compare()
• Table_CreateIndexes()
• Table_CreateProcedures()
• Table_SetDeleteOptions()
• Table_DropProcedures()
• Table_SetRefreshFlags()
• Table_Truncate()
552 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ A U T O S H R I N K ()
Table_AutoShrink()
Description The Table_AutoShrink() function shrinks a data table and rebuilds the
table’s indexes if the current database manager is capable of performing
such operations. The Table_GetAutoShrinkMode() function must be used
prior to this function to ascertain whether the current database manager has
these capabilities.
Parameters • table table_name – The name of the table you want to shrink.
Return value An integer containing the error code returned by the database manager. A
return value of zero indicates no error occurred. Consult your database
manager’s reference manual for a list of error codes.
Comments Since some database managers have provisions for performing table
shrinks, this function transfers the shrink process to the database manager.
Currently, c-tree and Pervasive.SQL tables can be shrunk using
Table_AutoShrink().
The c-tree Plus database manager also rebuilds the table’s indexes during
the shrink. Indexes are stored in the .IDX file with the same name to the left
of the extension as the data table. You can use Table_RebuildIndexes() if
you want to rebuild the indexes without shrinking the table.
We recommend that you shrink data tables frequently as part of periodic application
maintenance. This will help ensure data integrity and optimal
application performance. It will also optimize disk space usage where tables are
stored.
554 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ A U T O S H R I N K ()
Additional information
Chapter 11, “Table Maintenance,” in the Dexterity Stand-alone Application Guide
Table_Compare() SQL
Constant Description
STATUS_SUCCESS The table structure and table definition match.
STATUS_ERROR Discrepancies were found between the table structure
and the table definition, or some other error occurred.
Comments If you create your own tables outside of Dexterity, or are creating a
Dexterity application to access data in an existing SQL table, use the
Table_Compare() function to verify that the application dictionary’s table
definition matches the actual table in the data source.
Examples The following example compares the structure of the Inventory table on the
current data source to the table definition of the Inventory table in the
current application dictionary.
556 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ C O P Y S H R I N K R E C O R D S ()
Table_CopyShrinkRecords()
Description The Table_CopyShrinkRecords() function copies a record from the
original table to the temporary table created using Table_StartShrink().
Return value An integer describing the result of the transfer. The result is 0 if the record
was copied successfully. Any other value indicates a record transfer error.
The following list shows the errors and their corresponding integer values:
Comments This function is used in the table shrinking process. Shrinking is the process
of removing unused space from a data table. The
Table_CopyShrinkRecords() function copies the contents of the original
table to the temporary table created with Table_StartShrink(). This transfer
allows the temporary table to store only records from the original table;
excess space in the original table isn’t transferred to the temporary table.
After all records have been copied, Table_EndShrink() finishes the table
shrink.
Additional information
Chapter 11, “Table Maintenance,” in the Dexterity Stand-alone Application Guide
558 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ C R E A T E I N D E X E S ()
Table_CreateIndexes() SQL
Description The Table_CreateIndexes() function creates the indexes for the specified
table on a data source.
• table table_name – The table for which indexes are being created.
Return value An integer indicating whether indexes were created. The result is 0 if the
indexes were created successfully. Any other value indicates indexes could
not be created.
Comments If you have altered the indexes for tables on the data source, you can use
this function to re-create the indexes for tables in your application.
Before you use the Table_CreateIndexes() function, the table must not have
any indexes (including primary key constraints) that have the same names
as those created by Dexterity. If any indexes with these names exist for the
table, the Table_CreateIndexes() function will fail.
If you will be using bulk copy (bcp) to copy data to your application’s SQL
tables, you may want to drop all indexes for the tables you’re copying data
to. By removing the indexes, the bulk copy operations can be performed
much faster. Once all of the data has been copied, use the
Table_CreateIndexes() function to re-create the indexes for the tables.
Keep in mind that creating indexes for a large data set can take a considerable
amount of time.
Examples The following example creates the indexes for the Seller_Data table. The
product ID is represented by the constant RESM_PRODID.
Table_CreateProcedures() SQL
• table table_name – The table for which stored procedures will be created.
Return value An integer indicating whether stored procedures were created. The result is
0 if the stored procedures were created successfully. Any other value
indicates stored procedures could not be created.
Comments When you use Dexterity to create a table, Dexterity automatically generates
several stored procedures for the table, which are used to optimize database
performance. Typically, Dexterity generates these stored procedures the
first time it opens the table. If you create a table by some means other than
Dexterity, you must use this function to generate the stored procedures for
the table.
Before you use the Table_CreateProcedures() function, the table must not
have any stored procedures that have the same names as those created by
Dexterity. If any stored procedures with these names exist for the table, the
Table_CreateProcedures() function will fail. Names of stored procedures
created by Dexterity have the form zDP_ followed by the table physical
name and a code indicating the purpose of the stored procedure. The
following table lists the various stored procedures created by Dexterity.
560 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ C R E A T E P R O C E D U R E S ()
For example, the Seller_Data table has the physical name SELLDAT. The
table has three keys, one of which is unique. Dexterity creates 13 stored
procedures for this table. The stored procedures are listed in the following
table.
After you’ve created the new stored procedures, be sure to grant privileges to the
appropriate users.
562 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ D I S A B L E E R R O R C H E C K S ()
Table_DisableErrorChecks()
Description The Table_DisableErrorChecks() function allows Dexterity to ignore
automatic error checking for table operations.
Syntax Table_DisableErrorChecks(disable)
Parameters • disable – A boolean that sets the error checking status. The value true
disables error checking; false enables error checking.
Comments If you disable error checking, the Dexterity Data Management Subsystem
will ignore the following errors for table operations:
0 – No error 20 – Transaction in progress
1 – Low on memory 21 – Not a variable length table
2 – Database manager not initialized 22 – No table definition could be found
3 – Database manager not supported 23 – Attempted to lock two records
4 – Too many tables opened 24 – No lock on update
5 – Record length too long 25 – Table doesn’t match definition
6 – Too many keys for database type 26 – The disk is full
7 – Too many segments 27 – Unknown error
8 – Table not registered 28 – A non-modifiable key changed
9 – Table not found 29 – Not a variable length field
10 – Locked record 30 – A record was changed with a passive
lock
11 – Table name error 31 – Deadlocked
12 – Table not open 32 – Path not found
13 – Table not opened exclusive 33 – Buffer error
14 – Invalid command sent to database 34 – Error in creating a P.SQL table
manager
15 – Key number doesn’t exist 35 – Invalid key definition
16 – End of file 36 – Maximum number of SQL connections
reached
17 – Duplicate record 37 – Error accessing SQL data
18 – Table is missing 38 – Error converting SQL data
19 – A set is already active 39 – Error generating SQL data
When you use this function to disable error checking, always enable error checking
before the script is completed.
result = Table_DisableErrorChecks(true);
Table_DropProcedures() SQL
Description The Table_DropProcedures() function drops the stored procedures for the
specified table on a data source.
• table table_name – The table for which stored procedures will be dropped.
Return value An integer indicating whether stored procedures were dropped. The result
is 0 if the stored procedures were dropped successfully. Any other value
indicates stored procedures could not be dropped.
Comments Applications based on Dexterity 4.0 and later don’t require as many auto-
generated stored procedures as applications based on Dexterity 3.X. If you
created auto-generated stored procedures with Dexterity 3.X and executed
the Table_DropProcedures() function from Dexterity 4.0 or later, not all of
the stored procedures will be dropped. These “leftover” stored procedures
from Dexterity 3.X aren’t used by Dexterity 4.0 or later, and will cause no
problems; they simply take a small amount of space in the database.
564 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ E N D C O N V E R S I O N ()
Table_EndConversion()
Description The Table_EndConversion() function finishes a table conversion. If the
table was converted successfully, this function deletes the source table and
renames the destination temporary table to take the place of the source
table. If the table was not converted successfully, the source table is kept
and the destination temporary table is deleted.
Parameters • table source_table – The technical name of the source table. (Note that unlike
Table_StartConversion(), this isn’t a string parameter.)
Return value An integer value indicating whether any table errors occurred while the
source and destination tables were being renamed or deleted. The values
returned correspond to those returned by the err() function.
Comments During the table conversion process, you must monitor whether any
unexpected table errors occurred. If any unexpected errors occur, false
should be passed to the l_converted parameter so the original table won’t be
deleted.
Additional information
Chapter 60, “Updating an Application,” in Volume 1 of the Dexterity Programmer’s
Guide
Table_EndShrink()
Description The Table_EndShrink() function closes the shrink table and finishes the
table shrink.
Return value An integer containing the result of the function. The result is 0 if the shrink
table was successfully closed.
Comments This function is used to complete the table shrinking process. Shrinking is
the process of removing unused space from a data table. The
Table_CopyShrinkRecords() function copies the contents of the original
table to the temporary table created with Table_StartShrink(). This transfer
allows the temporary table to store only records from the original table;
excess space in the original table isn’t transferred to the temporary table.
566 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ E N D S H R I N K ()
Additional information
Chapter 11, “Table Maintenance,” in the Dexterity Stand-alone Application Guide
568 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ F I L L G R O U P L I S T ()
Table_FillGroupList()
Description The Table_FillGroupList() function fills a list field (typically a list box or
drop-down list) with the names of the table groups from a series, providing
the table group contains at least two tables.
• series – An integer indicating the table group series from which table group
names will be read. The following table lists all table and table group series
and their corresponding integer values.
• dname_list – A window list field that displays the returned display names of
the specified table groups.
• tname_list – A window list field that displays the technical names of the
specified table groups.
Comments Table groups are a method of grouping related tables. You can create table
groups using the Table Group Definition window in Dexterity.
Examples The following example returns the names of the table groups in the series
selected in the Table Series field (a list box displaying all available series).
The table group display names are displayed in the LB_Table_Groups list
box and the technical names are displayed in the LB_Tname_List list box.
The countitems() function is used to ascertain if any table groups are
displayed. If not, a warning message is displayed. The product ID for the
dictionary is 0.
Additional information
Chapter 26, “Table Groups,” in Volume 1 of the Dexterity Programmer’s Guide.
570 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ F I L L L I S T ()
Table_FillList()
Description The Table_FillList() function fills a list field (typically a list box or drop-
down list) with the names of tables from the specified table group.
• name_list – A list field that’s filled with the technical names of the tables in
the specified table group.
Return value An integer containing the number of tables in the specified table group.
Comments This function can display the tables that belong to a table group selected
from a list that was filled by the Resource_FillSeriesList() function.
Table groups are a method of grouping related tables. You can create table
groups using the Table Group Definition window in Dexterity.
Examples The following example displays the tables in the table group named
Inventory_Items in the list field named Tables_List. The product ID for the
dictionary is 0.
Additional information
Chapter 26, “Table Groups,” in Volume 1 of the Dexterity Programmer’s Guide.
Table_FlushCache()
Description The Table_FlushCache() function clears the table cache for all closed tables.
Syntax Table_FlushCache()
Parameters • None
Comments The table cache contains information such as the pathname used to access a
table. The cache is created when the application starts. When a table is
closed, the cache information is kept to improve application performance if
the table is reopened. In some cases, you may want a table to be reopened in
another location, but then the information in the table cache will be
incorrect. The Table_FlushCache() function can be used to clear the table
cache before the table is reopened.
Examples The following example is the form pre script for the Login form. It uses the
Table_FlushCache() function to clear the table cache, because the new user
may be accessing tables in different locations than the previous user.
result = Table_FlushCache();
572 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ G E T A U T O S H R I N K M O D E ()
Table_GetAutoShrinkMode()
Description The Table_GetAutoShrinkMode() function indicates whether the current
database manager is capable of conducting a table shrink using
Table_AutoShrink() or rebuilding a table’s indexes using
Table_RebuildIndexes(). Currently, these functions can be used with c-tree
and Pervasive.SQL tables.
Return value An integer indicating whether the automatic shrink can take place.
Comments Shrinking is the process of removing unused space from a data table. The
removal of unused space in this manner is called a “shrink” because the file
will invariably be smaller after the unused space is removed.
If the CTShrink setting is included in the defaults file and is set to FALSE,
the Table_GetAutoShrinkMode() function will always return a non-zero
value, regardless of the database manager used by the named table.
Additional information
Chapter 11, “Table Maintenance,” in the Dexterity Stand-alone Application Guide
Table_GetDisplayName()
Description The Table_GetDisplayName() function returns the display name for a
specified table.
• table_name – A string containing the technical name of the table. This is the
name entered in the Table Name field of the Table Definition window.
Return value A string containing the display name of the table. This is the name entered
in the Display Name field of the Table Definition window.
Examples The following example returns the display name for the Inventory_Data
table to the local variable named l_table_name. The product ID is
represented by the constant INVENT_PRODID.
574 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ G E T F I E L D L I S T ()
Table_GetFieldList()
Description The Table_GetFieldList() function retrieves the names of the fields in the
specified table.
• table_name – A string containing the technical name of the table. This is the
name entered in the Table Name field of the Table Definition window.
• field_list – A list field that will be filled with the names of the fields from the
specified table.
Examples The following example returns the field name for the Inventory_Data table
to the Field List list box field. The product ID is represented by the constant
INVENT_PRODID.
Table_GetGroup()
Description The Table_GetGroup() function returns the resource ID of the table group a
specified table is part of.
• table_name – A string containing the technical name of the table for which
the table group resource ID is being returned.
Return value An integer containing the resource ID of the table group. The value 0 is
returned if the table is not part of a table group.
Examples The following example uses the Table_GetGroup() function to retrieve the
resource ID of the table group the House_Descriptions table is part of. It
then uses the Resource_GetDisplayName() function to retrieve the name
of the table group. The product ID is represented by the constant
RESM_PRODID.
576 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ G E T K E Y F I E L D L I S T ()
Table_GetKeyFieldList()
Description The Table_GetKeyFieldList() function returns the list of fields that are part
of the specified key.
• key_fields_list – A list field that’s filled with the names of the fields in the
specified key.
Table_GetKeyInfo()
Description The Table_GetKeyInfo() function returns information about a key in the
specified table.
Parameters • table_ID – An integer specifying the resource ID of the table for which key
information will be returned.
• primary – A returned boolean indicating whether the key is the primary key
for the table. This applies only to SQL tables.
• unique – A returned boolean indicating whether the key values for each
record in the table must be unique. This applies only to SQL tables.
Comments This function does not work properly when used for third-party
dictionaries that integrate with Microsoft Dynamics GP. It should be used
only in the main product dictionary.
578 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ G E T K E Y I N F O ()
Table_GetKeyOption()
Description The Table_GetKeyOption() function returns information about the key
options for a key in the specified table.
Return value A boolean. The value true indicates the key option is marked, while false
indicates it is not.
580 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ G E T K E Y O P T I O N ()
Table_GetNumberOfKeys()
Description The Table_GetNumberOfKeys() function returns the number of keys that
are defined for the specified table.
Return value An integer containing the number of keys defined for the table.
582 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ G E T O S N A M E ()
Table_GetOSName()
Description The Table_GetOSName() function returns the operating system name and
path (in generic format) for the specified table. The operating system name
is also known as the physical name.
Parameters • table table_name – The name of the table for which the operating system
name is being returned.
Return value A string containing the operating system name and path (in generic format)
of the table. If the path is not available, only the operating system name is
returned.
Comments This function can also return the operating system name being used for
temporary tables. This is especially useful for SQL tables when stored
procedures need to work with data in SQL temporary tables.
Table_GetRangeKey()
Description The Table_GetRangeKey() function retrieves the key used for the range
applied to the specified table.
Parameters • table table_name – The name of the table from which the range key is being
returned.
Return value An integer containing the number corresponding to the key used for the
range. If no range is set for the table, the constant TABLE_NORANGE is
returned.
Examples The following example retrieves the key used for a range on the
Buyer_Data table.
584 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ G E T S E R I E S ()
Table_GetSeries()
Description The Table_GetSeries() function returns an integer corresponding to the
series the specified table is part of.
• table_name – A string containing the technical name of the table for which
the series is being returned.
Return value An integer corresponding to the table series. The following table lists all the
series and their corresponding integer values.
Examples The following example uses the Table_GetSeries() function to retrieve the
series of the House_Data table. The product ID is represented by the
constant RESM_PRODID.
Table_GetSQLErrorText() SQL
Parameters • table_ID – A long integer specifying the table for which SQL error text is
being returned. Use the internal_table_ID value passed into the SQLError
procedure.
Return value An integer indicating whether SQL error text was retrieved. The constant
STATUS_SUCCESS indicates error text was retrieved. Any other value
indicates error text was not retrieved.
Comments When a SQL error occurs, several blocks of SQL error text may result. When
using the Table_GetSQLErrorText() function to retrieve the SQL error text,
be sure to retrieve all of the blocks of error text. Otherwise, other
applications won’t be able to properly retrieve SQL error text.
When using Table_GetSQLErrorText() to retrieve SQL error text, don’t use the
naterr() function. These two functions are not compatible and shouldn’t be used
together.
in long internal_table_ID;
in integer dict_ID;
in integer table_series;
in integer table_ID;
in integer operation;
in string resource_name;
inout integer error_response;
586 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ G E T S Q L E R R O R T E X T ()
{Read each block of SQL error text until all text has been read.}
while status = STATUS_SUCCESS do
{Successfully read an entry in the error text, so log the error.}
'Log Date' of table SQL_Error_Log = sysdate();
'Log Time' of table SQL_Error_Log = systime();
'Resource' of table SQL_Error_Log = resource_name;
'Native Error' of table SQL_Error_Log = native_error_number;
'Error Text' of table SQL_Error_Log = error_text;
save table SQL_Error_Log;
{Use the default behavior to display the SQL error to the user.}
error_response = 0;
Table_IsRangeSet()
Description The Table_IsRangeSet() function ascertains whether a range is currently
set for the specified table.
Return value A boolean. True indicates a range is set, while false indicates no range is set.
Comments This function cannot be used to verify whether the range where statement
was used to specify a range for a table.
Examples The following example ascertains whether a range is set for the Buyer_Data
table. If a range is set, the items in the range are removed.
588 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ O P E N A S T E M P ()
Table_OpenAsTemp()
Description The Table_OpenAsTemp() function creates a “clone” of the table specified.
The clone will be a temporary table with exactly the same structure as the
table supplied. The clone table will contain no data.
Parameters • table table_name – The technical name of the table whose table structure will
be copied and used for the new clone table.
Comments This function can be used when data in a table must be processed, but you
don’t want the original data affected.
Examples The following example creates a clone of the Inventory_Data table. The
range copy statement is used to fill the clone table with data. In this
example, the data in the clone table is displayed, and then the clone table is
closed.
Table_OpenNewBuffer()
Description The Table_OpenNewBuffer() function creates a new table buffer and
reference to the table specified. This allows you to create multiple table
buffers for a table, within a single script.
Parameters • table table_name – The technical name of the table for which a table buffer
will be created and a table reference returned.
Examples The following example creates two table buffers for the Inventory_Data
table. The first table buffer is set to the first record in the table. The second
table buffer is set to the last record in the table. The content of both table
buffers is displayed in a message to the user.
{For the first instance, get the first record in the table}
get first table(InventoryTable1);
{For the second instance, get the last record in the table}
get last table(InventoryTable2);
590 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ R E B U I L D I N D E X E S ()
Table_RebuildIndexes()
Description The Table_RebuildIndexes() function rebuilds the indexes for a table that
stores data using the c-tree Plus database manager. The
Table_GetAutoShrinkMode() function must be used prior to this function
to ascertain whether the database manager used to create the table supports
this capability.
Parameters • table table_name – The table for which indexes are being rebuilt.
Return value An integer indicating the error code returned by the database manager. If
the return value is 0, no error occurred. Consult your c-tree Plus reference
manual for a list of error codes.
Comments Like Table_AutoShrink(), this function removes and then rebuilds the
indexes for an existing c-tree Plus data table. These indexes are stored in the
.IDX file with the same name to the left of the extension as the data table.
For example, the indexes for the INVENT.DAT data table are stored in the
INVENT.IDX index file.
592 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ S E T C R E A T E M O D E ()
Table_SetCreateMode()
Description The Table_SetCreateMode() function allows you to choose whether tables
that don’t already exist will be created automatically when they are
accessed at runtime.
Syntax Table_SetCreateMode(option)
Value Description
true Automatically creates the table if it isn’t found.
false Doesn’t create the table if it isn’t found.
594 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ S E T DBT Y P E ()
Table_SetDBType()
Description The Table_SetDBType() function sets a default database type for an
application.
Syntax Table_SetDBType(type)
Parameters • type – An integer that sets the database type to one of the following:
Value Description
1 c-tree Plus
2 Pervasive.SQL
3 SQL
Comments The default database type you set with this function is used if the database
type is set to Default in the Table Definition window. This command can be
used to force tables to be of a specific database type without indicating a
specific database type in the table’s definition.
Examples The following example sets the default database type to Pervasive.SQL.
result = Table_SetDBType(2);
Table_SetDeleteOptions() SQL
Syntax Table_SetDeleteOptions(option)
Value Description
true Use the drop functionality, which removes the data and the table from
the database. This also removes the auto-generated stored procedures
for the table.
false Use the delete all functionality, which removes all of the data in the
table, leaving the empty table intact in the database.
Comments Drop is the default setting for the Dexterity delete table statement, so if this
function isn’t used in your application, the delete table statement will
always use the drop functionality.
596 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ S E T D E L E T E O P T I O N S ()
{Ensure that the delete table statement will use the delete all
➥ functionality.}
result = Table_SetDeleteOptions(false);
{Open the table. Include the exclusive option so that the delete table
➥ statement can be used.}
open table Current_Years_Purchases, exclusive;
{Retrieve each row in the Current_Years_Purchases table and copy it to
➥ the Old_Purchases table.}
get first table Current_Years_Purchases;
while err() = OKAY do
copy from table Current_Years_Purchases to table Old_Purchases;
save table Old_Purchases;
get next table Current_Years_Purchases;
end while;
{Delete all rows in the Current_Years_Purchases table.}
delete table Current_Years_Purchases;
{Change the delete table statement functionality back to drop.}
result = Table_SetDeleteOptions(true);
Table_SetRefreshFlags() SQL
Description The Table_SetRefreshFlags() function sets the refresh flags for each client
buffer associated with the named table. When this flag is set for a given
client buffer, the next time Dexterity attempts to access that client buffer, the
buffer will be refreshed before it is accessed. Using this function can ensure
that any client buffers associated with the named table will contain the most
current information.
Parameters • table table_name – The name of the table for which the refresh flags are to be
set.
Constant Description
STATUS_SUCCESS The refresh flag was set for each of the table’s client
buffers.
STATUS_ERROR An error occurred, causing the function to be unable to
set the refresh flag for each of the table’s client buffers.
Comments This function should be used after a stored procedure has run. It will ensure
that the data in the client buffers is updated to reflect any changes made to
the table as a result of the stored procedure.
Examples The following example runs a stored procedure named “Supply Statistics,”
which manipulates data in the Inventory table. If the stored procedure was
successful, Table_SetRefreshFlags() is used to set the refresh flag for the
client buffers associated with the Inventory table, so the next time these
buffers are accessed, they will contain updated data.
598 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ S T A R T C O N V E R S I O N ()
Table_StartConversion()
Description The Table_StartConversion() function is used when a table definition has
been modified and existing data must be converted so it can be used with
the modified table definition. This function opens the old and new table
definitions for exclusive use so data can be converted.
Parameters • source_table – A string containing the technical name of the table from which
records will be transferred.
Return value An integer indicating whether the source and destination tables were
opened successfully. The values returned correspond to those returned by
the err() function.
Comments This function opens the source and destination tables for exclusive use. The
destination table is actually a temporary table in the same directory as the
source table being converted. After both tables are open, records can then
be transferred from the source table to the destination table. Then
Table_EndConversion() is used to finish the table conversion.
Before you can use this function, you must have a table definition for the
source table and the destination table. Typically, you will use the Duplicate
Resources utility in Dexterity Utilities to duplicate the source table
definition. The duplicate table definition is saved and becomes the source
table.
Examples In the following example, a procedure script is being used to convert the
existing data in the RM_MSTR table so it can be used with an updated table
definition. The original table definition was duplicated using Dexterity
Utilities. The duplicate table definition was named RM_MSTR_OLD. (This
will become the source table.) The necessary changes were made to the
RM_MSTR table definition. (This will become the destination table.)
l_converted = false;
600 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ S T A R T C O N V E R S I O N ()
Additional information
Chapter 60, “Updating an Application,” in the Dexterity Programmer’s Guide
Table_StartShrink()
Description The Table_StartShrink() function creates a temporary data table that can
be used to store data from an original table that’s being shrunk.
Return value An integer describing the result of the temporary table initialization. The
result is 0 if the temporary table was created successfully. Any other value
indicates an error. The following list shows the errors and their
corresponding integer values:
602 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ S T A R T S H R I N K ()
Comments Shrinking is the process of removing unused space from a data table. The
process is called a “shrink” because the table will invariably be smaller after
the unused space is removed. The Table_CopyShrinkRecords() function
copies the contents of the original table to the temporary table created by
Table_StartShrink(). This transfer allows the temporary table to store only
records from the original table; excess space in the original table isn’t
transferred to the temporary table. After the copy is complete, the
Table_EndShrink() function finishes the table shrink.
Additional information
Chapter 11, “Table Maintenance,” in the Dexterity Stand-alone Application Guide
Table_Truncate() SQL
Description The Table_Truncate() function removes all records from a SQL table,
leaving the table structure intact in the database.
Parameters • table table_name – The name of the table from which the records are to be
removed.
Value Description
0 The records were removed successfully.
1 There wasn’t enough memory to complete the operation.
3 Table not supported.
27 An unknown error occurred.
37 A SQL truncate command was successfully generated by Dexterity, but
it was unable to be completed at the data source.
41 The operation couldn’t be completed because a user wasn’t logged into
the data source.
Comments This function performs the same function as the delete table statement that
uses the delete all functionality, but performs this task differently.
Table_Truncate() removes records faster than the delete table statement.
However, unlike the delete table statement, it ignores any locks another
user may have on records in the table.
If a user executes this function while another user has records from the
named table in a client buffer, the second user will continue to see those
buffered values even after the table’s records have been deleted. Should the
second user save records to the table before this function is successfully
completed, those records will be deleted when the command is completed.
If the second user saves records to the table after the function is successfully
completed, those records will be added to the table.
604 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _ T R U N C A T E ()
Examples The following example removes all records from the Inventory table.
Table_VerifyRecord()
Description The Table_VerifyRecord() function verifies the contents of the fields in a
record for the specified table.
• field_name – A returned string indicating the name of the first field for
which an error was encountered.
Return value An integer specifying the error code for the verify operation. If the value
returned is zero, no error occurred. Any other number indicates that an
error was encountered. The following table lists each error code and its
corresponding description.
Value Description
600 Negative value for a list field
601 Invalid value for check box field
602 Invalid value for boolean field
603 Invalid digits for currency field
604 Invalid length string for combo box field
605 Invalid length for string field
606 Invalid date field
607 Invalid time field
608 Negative length for a text field
609 Negative length for a picture field
610 Invalid digits for a variable currency field
Comments This function is used to rebuild tables. It will check for the following
conditions:
• Negative values for list fields, such as list boxes, drop-down lists, radio
groups and visual switches. Any other checking for values within a
specific range must be completed in a script.
606 F U N C T I O N L I B R A R Y R E F E R E N C E
T A B L E _V E R I F Y R E C O R D ()
• Invalid length bytes for strings and combo box strings. The length byte
for these fields must be less than the combined length of the storage
size and length byte.
• Invalid lengths for text fields and pictures. (Neither can be a negative
value.)
Additional information
Chapter 11, “Table Maintenance,” in the Dexterity Stand-alone Application Guide
• TextFile_Close()
• TextFile_Open()
• TextFile_ReadLine()
• TextFile_ReadText()
• TextFile_WriteDOS()
• TextFile_WriteLine()
• TextFile_WriteText()
TextFile_Close()
Description The TextFile_Close() function closes a text file opened by the
TextFile_Open() function.
Syntax TextFile_Close(file_ID)
610 F U N C T I O N L I B R A R Y R E F E R E N C E
T E X T F I L E _ O P E N ()
TextFile_Open()
Description The TextFile_Open() function opens a specified text file.
Parameters • pathname – A string containing the complete generic pathname to the text
file, including the name of the file. If the file specified by pathname doesn’t
exist, it will be created.
Value Description
0 The file will be opened at the beginning of the text file, allowing you to
overwrite or read existing text.
1 The file will be opened at the end of the text file, allowing you to
append new text to the file.
• access – An integer that sets the following access rights to the file:
Value Description
0 Allows write exclusive access.
1 Allows read-only shared access.
2 Allows write shared access.
Return value An integer returned from the operating system that’s used to uniquely
identify this file. This value is used with the TextFile_Close(),
TextFile_ReadLine(), TextFile_ReadText(), TextFile_WriteDOS(),
TextFile_WriteLine() and TextFile_WriteText() functions.
Comments When you open a text file at the beginning (where the mode parameter is set
to 0), with write access (where the access parameter is set to either 0 or 2)
any text currently in the file will be deleted in preparation for writing new
data. To avoid deleting existing data, open a text file at the end of the file
(using a mode of 1) when using write access.
After you open a text file, the insertion point is determined by the mode
parameter. The following illustration shows a text file and the insertion
points that can be determined by mode:
A carriage return
indicates the end of a
line.
Examples This example opens a text file using the getfile() function. It opens the
selected file at the end of the file, with exclusive access. It then displays the
name of the text file once it’s been parsed using the
Path_ParseFileFromPath() function:
612 F U N C T I O N L I B R A R Y R E F E R E N C E
T E X T F I L E _ R E A D L I N E ()
TextFile_ReadLine()
Description The TextFile_ReadLine() function reads a line from a file opened by the
TextFile_Open() function.
Return value A boolean indicating a file error status; true if a file error occurred, false if
no file error occurred. If an error occurs, typically it will be an end-of-file
error (EOF).
Comments When the file is opened using TextFile_Open(), you must specify that the
file be opened at the beginning. The TextFile_ReadLine() function begins
reading from the current position until 255 characters have been read or the
end of the line is encountered. (The end of a line is indicated by a carriage
return or carriage return/line feed combination of characters.) The
characters read are returned to the return_string parameter. The carriage
return or carriage return/line feed characters are not returned. Then,
depending on whether a complete line was read, the current position is set
to immediately after the end of the line or after the last character read.
To return the entire contents of a text file, you can use a loop to retrieve each
line in the file until the end of the file is encountered.
The TextFile_ReadLine()
function reads characters Item 11-223 (Cement Trowel) is selling
until 255 characters have slowly, so reorder quantities have been
been read or it encounters lowered.
the end of the line.
Additional heavy-labor items have also
been moving slower than expected due to
the building situation in the state.
[End of file]
Examples This example writes the contents of a text file to a text field. The getfile()
function returns a text file location, then TextFile_Open() opens the file at
that location. The TextFile_ReadLine() function is in a loop that reads each
line in the file and appends it to the text field until the end of the file is
reached:
614 F U N C T I O N L I B R A R Y R E F E R E N C E
T E X T F I L E _ R E A D T E X T ()
TextFile_ReadText()
Description The TextFile_ReadText() function reads a specified number of characters
from a text file opened by theTextFile_Open() function.
• return_string – A string containing the text returned from the text file.
Return value A boolean indicating a file error status; true if a file error occurred, false if
no file error occurred. If an error occurs, typically it will be an end-of-file
(EOF) error.
Comments Once this function reads the number of characters indicated by the length
parameter, it sets the current position to immediately after the last character
read. This function will include the end of line marker (a carriage return or
carriage return/line feed combination) just as if they were ordinary
characters.
Examples This example reads the number of characters specified and displays the text
in a window field:
TextFile_WriteDOS()
Description The TextFile_WriteDOS() function writes a line to a text file opened by the
TextFile_Open() function. It’s the same as the TextFile_WriteLine()
function, except that it enforces a DOS text format.
• text – A string containing the text that’s written to the text file.
Return value A long integer containing the number of characters written to the text file.
Comments DOS text formatting requires that a carriage return and line feed follow
each line written to the text file. The TextFile_WriteLine() function
automatically follows this format when used with Windows.
Examples This example writes the contents of a window field to a text file selected
with the getfile() function and opened with the TextFile_Open() function.
It then closes the text file using the TextFile_Close() function:
616 F U N C T I O N L I B R A R Y R E F E R E N C E
T E X T F I L E _ W R I T E L I N E ()
TextFile_WriteLine()
Description The TextFile_WriteLine() function writes a line to a text file opened by the
TextFile_Open() function.
• text – A string or text value containing the text that’s written to the text file.
Return value A long integer indicating the number of characters written to the file.
Comments A carriage return and a line feed will follow each line (DOS format). To
enforce a DOS format regardless of the platform you’re using, use the
TextFile_WriteDOS() function. To write characters to a text file without a
carriage return and a line feed, use the TextFile_WriteText() function.
Examples This example writes the contents of a window field to a text file opened
with the getfile() function. It then closes the text file using the
TextFile_Close() function.
TextFile_WriteText()
Description The TextFile_WriteText() function writes a line to a text file opened by the
TextFile_Open() function without including a line feed or carriage return.
In contrast, the TextFile_WriteDOS() function includes a line feed and
carriage return.
• text – A string or text value containing the text that’s written to the text file.
Return value A long integer indicating the number of characters written to the text file.
Comments You can write a line to a text file, enforcing a line feed and carriage return at
the end of each line, using TextFile_WriteDOS().
Examples This example writes the contents of a window field to a text file opened
with the getfile() function. It then closes the text file using the
TextFile_Close() function.
local long l_characters_written;
local boolean l_result;
local string l_pathname;
local integer l_file_ID;
618 F U N C T I O N L I B R A R Y R E F E R E N C E
Timer function library
Use the functions in this library to access timing capabilities within
Dexterity. This library contains the following function:
• Timer_Sleep()
Timer_Sleep()
Description The Timer_Sleep() function causes the application to wait for the specified
period of time.
Syntax Timer_Sleep(duration)
Parameters • duration – A long integer specifying the number of milliseconds to have the
application wait. This is the minimum amount of time the application will
wait. Depending on the other processes running on the system, the actual
waiting time may be somewhat longer.
Return value A long integer containing the number of milliseconds the application was
told to wait.
delay = Timer_Sleep(5000);
620 F U N C T I O N L I B R A R Y R E F E R E N C E
Tools function library
Use the functions in this library when working with Dexterity system tools
in your application. This library contains the following functions:
• Tools_CloseDUOSTable()
• Tools_DisableLoadBalancing()
• Tools_EnableCommandMenus()
• Tools_EnableCustomizationMaintenance()
• Tools_EnableCustomizationStatus()
• Tools_EnableImport()
• Tools_EnableLoadBalancing()
• Tools_EnableModifier()
• Tools_EnableReportWriter()
• Tools_GetTranLevel()
• Tools_IsAppProcessServer()
• Tools_IsScriptRemote()
• Tools_OpenDUOSTable()
Tools_CloseDUOSTable()
Description The Tools_CloseDUOSTable() function closes the DUOS table available to
the Visual Basic for Applications (VBA) environment.
Syntax Tools_CloseDUOSTable()
Parameters • None
Comments You need to close the DUOS table if you want to reopen it in another
location.
result = Tools_CloseDUOSTable();
622 F U N C T I O N L I B R A R Y R E F E R E N C E
T O O L S _ D I S A B L E L O A D B A L A N C I N G ()
Tools_DisableLoadBalancing()
Description The Tools_DisableLoadBalancing() function causes load balancing to be
disabled for a process server or client workstation.
Syntax Tools_DisableLoadBalancing()
Parameters • None
Comments When load balancing is disabled on a process server, the process server
unregisters itself with the Distributed Process Manager (DPM) so no
processes will be sent to it. When load balancing is disabled on a client, the
DPM is no longer consulted when processes are sent to process servers.
result = Tools_DisableLoadBalancing();
Tools_EnableCommandMenus()
Description The Tools_EnableCommandMenus() function causes command-based
menus to be used for an application, rather than resource-defined menus.
Syntax Tools_EnableCommandMenus()
Parameters • None
Examples The following example is part of the Startup script for the Real Estate Sales
Manager sample application. It enables command menus for the
application.
Tools_EnableCommandMenus();
624 F U N C T I O N L I B R A R Y R E F E R E N C E
T O O L S _ E N A B L E C U S T O M I Z A T I O N M A I N T E N A N C E ()
Tools_EnableCustomizationMaintenance()
Description The Tools_EnableCustomizationMaintenance() function enables the
Customization Maintenance menu item.
Syntax Tools_EnableCustomizationMaintenance(mode)
Value Description
true Enables the Customization Maintenance menu item.
false Disables the Customization Maintenance menu item.
Examples This example enables the Customization Maintenance menu item from the
form pre script for the main menu:
result = Tools_EnableCustomizationMaintenance(true);
Tools_EnableCustomizationStatus()
Description The Tools_EnableCustomizationStatus() function enables the
Customization Status menu item.
Syntax Tools_EnableCustomizationStatus(mode)
Value Description
true Enables the Customization Status menu item.
false Disables the Customization Status menu item.
Examples This example enables the Customization Status menu item from the form
pre script for the main menu:
result = Tools_EnableCustomizationStatus(true);
626 F U N C T I O N L I B R A R Y R E F E R E N C E
T O O L S _ E N A B L E I M P O R T ()
Tools_EnableImport()
Description The Tools_EnableImport() function enables the Table Import menu item.
Syntax Tools_EnableImport(mode)
Value Description
true Enables the Table Import menu item.
false Disables the Table Import menu item.
Comments Refer to your Dexterity license agreement before you enable this item.
Examples This example enables the Table Import menu item from the form pre script
for the main menu:
result = Tools_EnableImport(true);
Tools_EnableLoadBalancing()
Description The Tools_EnableLoadBalancing() function causes load balancing to be
enabled for a process server or client workstation.
Syntax Tools_EnableLoadBalancing()
Parameters • None
Comments When load balancing is enabled on a process server, the process server
registers itself with the Distributed Process Manager (DPM) so processes
will be sent to it. This is typically done in the dpsInit procedure. When load
balancing is enabled on a client, the DPM is consulted when processes are
sent to process servers to ascertain which is the best process server to
receive the process.
result = Tools_EnableLoadBalancing();
628 F U N C T I O N L I B R A R Y R E F E R E N C E
T O O L S _ E N A B L E M O D I F I E R ()
Tools_EnableModifier()
Description The Tools_EnableModifier() function enables the Modifier menu items.
The Modifier is available only when your application is opened with the
runtime engine.
Syntax Tools_EnableModifier(mode)
Parameters • mode – A boolean that enables or disables the Modifier menu items:
Value Description
true Enables the Modifier menu items.
false Disables the Modifier menu items.
Comments Refer to your Dexterity license agreement before you enable this item.
Examples This example enables the Modifier from the form pre script for the main
menu:
result = Tools_EnableModifier(true);
Tools_EnableReportWriter()
Description The Tools_EnableReportWriter() function enables the Report Writer menu
items. The Report Writer is available only when your application is opened
with the runtime engine.
Syntax Tools_EnableReportWriter(mode)
Parameters • mode – A boolean that enables or disables the Report Writer menu items:
Value Description
true Enables the Report Writer menu items.
false Disables the Report Writer menu items.
Comments Add this function to the form pre script for the main menu form. This will
ensure that the Report Writer is available when your application is
launched. Refer to your Dexterity license agreement before you enable this
item.
Examples This example enables the Report Writer from the form pre script for the
main menu:
result = Tools_EnableReportWriter(true);
630 F U N C T I O N L I B R A R Y R E F E R E N C E
T O O L S _ G E T T R A N L E V E L ()
Tools_GetTranLevel()
Description The Tools_GetTranLevel() function indicates whether a database
transaction is currently active.
Syntax Tools_GetTranLevel()
Parameters • None
Return value An integer. The value 0 indicates no transaction is currently active. Any
other value indicates a transaction is active.
Tools_IsAppProcessServer()
Description The Tools_IsAppProcessServer() function returns whether the application
is being run by the Process Server application.
Syntax Tools_IsAppProcessServer()
Parameters • None
Return value A boolean value indicating whether the application is being run by the
Process Server application. True indicates the application is being run by
the Process Server; false indicates the application is being run by Dexterity
or the runtime engine.
result = Tools_IsAppProcessServer();
632 F U N C T I O N L I B R A R Y R E F E R E N C E
T O O L S _ I S S C R I P T R E M O T E ()
Tools_IsScriptRemote()
Description The Tools_IsScriptRemote() function returns whether the current script is
being processed remotely on a Process Server.
Syntax Tools_IsScriptRemote()
Parameters • None
Return value A boolean value indicating whether the current script is being processed
remotely by a Process Server. True indicates the script is being
processed remotely on a Process Server; false indicates the script is
being processed locally.
Comments When procedures are run on a Process Server, they should not display the
Report Destination window. This function is used in procedures that can
generate reports to ascertain whether the procedure is being processed on a
Process Server. If it is, the parameters of the run report and run report with
name statements should be set to not display the Report Destination
window.
Tools_OpenDUOSTable()
Description The Tools_OpenDUOSTable() function opens the DUOS table available to
the Visual Basic for Applications (VBA) environment.
Syntax Tools_OpenDUOSTable()
Parameters • None
Return value A boolean indicating whether the DUOS table can be opened. True
indicates the DUOS table can be opened. False indicates it can’t.
Comments The application must contain the definition for the DUOS table. The DUOS
table must be named SY_User_Object_Store. Refer to Chapter 15, “Using
the Modifier,” in the Stand-alone Application Guide for more information
about implementing the DUOS table. Refer to the VBA Developer’s Guide
for information about using the DUOS.
result = Tools_OpenDUOSTable();
if result = false then
error "Could not open the DUOS table for the VBA environment.";
end if;
634 F U N C T I O N L I B R A R Y R E F E R E N C E
T O O L S _ U S E S H E L L
Tools_UseShell
Description The Tools_UseShell() function specifies which type of application shell
will be used for the Dexterity-based application.
Parameters • type – An integer that specifies which type of application shell to use. The
value corresponds to one of the following constants:
Constant Description
SHELL_TYPE_WIN32_MDI
SHELL_TYPE_MANAGED_SDI
• options – A long integer that specifies options for the selected shell. The
value corresponds to one of the following constants:
Constant Description
SHELL_OPTION_DEFAULT Use the default options for the application shell.
SHELL_OPTION_CREATE_HIDDEN Prevents the application shell from being
displayed.
Comments This function must be run from the Startup_Main procedure in the
application dictionary.
TreeView_AddNode()
Description The TreeView_AddNode() function adds a new child node to the specified
node in a tree view field.
Parameters • tree_view_field – The tree view field to which a new node will be added.
• label – A string specifying the label to use for the new node.
• data – A long integer specifying the data value to associate with the node.
638 F U N C T I O N L I B R A R Y R E F E R E N C E
T R E E V I E W _ A D D N O D E ()
Examples The following example adds five nodes to the Address List tree view field,
one for each region. The nodes are added at the root level, so the parent
node is TV_ROOT. Each node has two associated images. When the node is
selected, an image of a cardfile and hand is shown. When a node is not
selected, an image of a cardfile is shown. The item numbers of these two
images are 1 and 2 in the TreeView Images window.
local integer i;
local long node_ID;
for i = 1 to 5 do
node_ID = TreeView_AddNode('Address List', "Region " + str(i), 0,
➥ TV_ROOT, true, 2, 1);
end for;
TreeView_CollapseNode()
Description The TreeView_CollapseNode() function collapses the specified node in a
tree view field.
Parameters • tree_view_field – The tree view field containing the node to be collapsed.
Return value A boolean indicating whether the node was successfully collapsed. True
indicates the node was successfully collapsed. False indicates the node was
already collapsed.
Examples The following example collapses every root-level node in the Address List
tree view field.
640 F U N C T I O N L I B R A R Y R E F E R E N C E
T R E E V I E W _ C O U N T C H I L D R E N ()
TreeView_CountChildren()
Description The TreeView_CountChildren() function returns the number of children
for the specified node in a tree view field.
Parameters • tree_view_field – The tree view field containing the node whose children will
be counted.
• node_ID – A long integer specifying the ID of the node whose children will
be counted.
Examples The following example counts the number of child nodes in the first root-
level node in the Address List tree view field.
TreeView_CountNodes()
Description The TreeView_CountNodes() function returns the entire number of nodes
in a tree view field.
Syntax TreeView_CountNodes(tree_view_field)
Parameters • tree_view_field – The tree view field whose nodes will be counted.
Return value A long integer containing the number of nodes in the tree, including nodes
that are not visible. This value does not include the invisible node
TV_ROOT.
Examples The following example counts all nodes in the Address List tree view field.
642 F U N C T I O N L I B R A R Y R E F E R E N C E
T R E E V I E W _ E X P A N D N O D E ()
TreeView_ExpandNode()
Description The TreeView_ExpandNode() function expands the specified node in a
tree view field.
Parameters • tree_view_field – The tree view field containing the node to be expanded.
Return value A boolean indicating whether the node was successfully expanded. True
indicates the node was successfully expanded. False indicates the node was
already expanded.
Examples The following example expands the currently-selected node for the
Address List tree view field.
TreeView_GetClickNode()
Description The TreeView_GetClickNode() function returns the ID of the node whose
state image was clicked.
Syntax TreeView_GetClickNode(tree_view_field)
Parameters • tree_view_field – The tree view field containing the node whose state image
was clicked.
Return value A long integer containing the node ID of the node whose state image was
clicked. The value TV_NODEINVALID is returned if no node state image
was clicked.
Comments The TreeView_GetClickNode() should be used only in the state click script
for the tree view field.
Examples The following is the state click script for the Address List tree view field. It
toggles the state image displayed when a node’s state image is clicked.
644 F U N C T I O N L I B R A R Y R E F E R E N C E
T R E E V I E W _ G E T C O L L A P S I N G N O D E ()
TreeView_GetCollapsingNode()
Description The TreeView_GetCollapsingNode() function returns the ID of the node
that is being collapsed in a tree view field.
Syntax TreeView_GetCollapsingNode(tree_view_field)
Parameters • tree_view_field – The tree view field containing the node being collapsed.
Return value A long integer containing the node ID of the node being collapsed. The
value TV_NODEINVALID is returned if no node is being collapsed.
Comments This function is typically used only in the collapse script for a tree view
field to retrieve the ID of the node being collapsed.
Examples The following is the collapse script for the Address List tree view field. It
removes the child nodes from the node being collapsed.
TreeView_GetExpandingNode()
Description The TreeView_GetExpandingNode() function returns the ID of the node
that is being expanded in a tree view field.
Syntax TreeView_GetExpandingNode(tree_view_field)
Parameters • tree_view_field – The tree view field containing the node being expanded.
Return value A long integer containing the node ID of the node being expanded. The
value TV_NODEINVALID is returned if no node is being expanded.
Comments This function is typically used only in the expand script for a tree view field
to retrieve the ID of the node being expanded.
Examples The following is the expand script for the Address List tree view field. It
adds child nodes containing customer information to the node being
expanded.
646 F U N C T I O N L I B R A R Y R E F E R E N C E
T R E E V I E W _ G E T F I R S T C H I L D ()
TreeView_GetFirstChild()
Description The TreeView_GetFirstChild() function returns the ID of the first child
node for the specified parent node in a tree view field.
Parameters • tree_view_field – The tree view field containing the parent node.
Return value A long integer containing the node ID of the first child of the specified
parent node. If the specified node contains no children, the
TV_NODEINVALID constant is returned.
Examples The following example retrieves the first child of the currently-selected
node in the Address List tree view field.
TreeView_GetNextNode()
Description The TreeView_GetNextNode() function returns the ID of the next sibling
for the specified node in a tree view field.
Parameters • tree_view_field – The tree view field containing the specified node.
• node_ID – A long integer specifying the ID of the node whose next sibling
will be returned.
Return value A long integer containing the node ID of the next sibling of the specified
node. If the specified node has no additional sibling, TV_NODEINVALID is
returned.
Examples The following example collapses every root-level node in the Address List
tree view field.
648 F U N C T I O N L I B R A R Y R E F E R E N C E
T R E E V I E W _ G E T N O D E D A T A ()
TreeView_GetNodeData()
Description The TreeView_GetNodeData() function returns the long integer data item
associated with the specified node.
Parameters • tree_view_field – The tree view field containing the specified node.
• node_ID – A long integer specifying the ID of the node whose data item will
be returned.
Return value A long integer containing the data item for the specified node.
Examples The following example retrieves the data item of the currently-selected
node in the Address List tree view field.
TreeView_GetNodeImage()
Description The TreeView_GetNodeImage() function returns an integer indicating the
image associated with the specified node.
Parameters • tree_view_field – The tree view field containing the specified node.
• node_ID – A long integer specifying the ID of the node whose image index
will be returned.
Return value An integer indicating the image. This value corresponds to the item number
of an item image in the TreeView Images window. If no image is associated
with the node, the TV_NOIMAGE constant is returned.
Examples The following example retrieves an integer indicating the image used for
the selected state of the currently-selected node in the Address List tree
view field.
650 F U N C T I O N L I B R A R Y R E F E R E N C E
T R E E V I E W _ G E T N O D E L A B E L ()
TreeView_GetNodeLabel()
Description The TreeView_GetNodeLabel() function returns the label for the specified
node.
Parameters • tree_view_field – The tree view field containing the specified node.
• node_ID – A long integer specifying the ID of the node whose label will be
returned.
Return value A string containing the label for the specified node.
Examples The following example retrieves the label of the currently-selected node in
the Address List tree view field.
TreeView_GetNodeStateImage()
Description The TreeView_GetNodeStateImage() function retrieves the item number
of the state image associated with the specified node.
Parameters • tree_view_field – The tree view field containing the specified node.
• node_ID – A long integer specifying the ID of the node whose state image is
being returned.
Return value An integer indicating the image. This value corresponds to the item number
of a state image listed in the TreeView Images window. If no state image is
associated with the node, the TV_NOIMAGE constant is returned.
652 F U N C T I O N L I B R A R Y R E F E R E N C E
T R E E V I E W _ G E T P A R E N T ()
TreeView_GetParent()
Description The TreeView_GetParent() function returns the node ID of the parent of
the specified node.
Parameters • tree_view_field – The tree view field containing the specified node.
• node_ID – A long integer specifying the ID of the node whose parent will be
returned.
Return value A long integer containing the node ID of the parent of the specified node. If
the specified node is a root-level node, the value TV_ROOT is returned.
TreeView_GetPreviousNode()
Description The TreeView_GetPreviousNode() function returns the ID of the
preceding sibling for the specified node.
Parameters • tree_view_field – The tree view field containing the specified node.
Return value A long integer containing the node ID of the preceding sibling of the
specified node. If the specified node has no preceding sibling,
TV_NODEINVALID is returned.
Examples The following example ascertains whether the current node is the first child
node in the current group of sibling nodes.
654 F U N C T I O N L I B R A R Y R E F E R E N C E
T R E E V I E W _ G E T R O O T N O D E ()
TreeView_GetRootNode()
Description The TreeView_GetRootNode() function returns the ID of the first root-
level node in a tree view field.
Syntax TreeView_GetRootNode(tree_view_field)
Parameters • tree_view_field – The tree view field containing the specified node.
Return value A long integer containing the node ID of the first root-level node. If the tree
has no nodes, TV_NODEINVALID is returned.
Examples The following example collapses every root-level node in the Address List
tree view field.
TreeView_GetSelectedNode()
Description The TreeView_GetSelectedNode() function returns the ID of the currently-
selected node in a tree view field.
Syntax TreeView_GetSelectedNode(tree_view_field)
Parameters • tree_view_field – The tree view field containing the selected node.
Return value A long integer containing the node ID of the selected node. If the tree
doesn’t have a node selected, TV_NODEINVALID is returned.
Examples The following example expands the currently-selected node for the
Address List tree view field.
656 F U N C T I O N L I B R A R Y R E F E R E N C E
T R E E V I E W _ I S P A R E N T N O D E ()
TreeView_IsParentNode()
Description The TreeView_IsParentNode() function indicates whether a specific node
in a tree view field is a parent node.
• node_ID – A long integer specifying the ID of the node whose status will be
determined.
Constant Description
TV_NODE_NONPARENT The node is not a parent.
TV_NODE_PARENT_COLLAPSED The node is a parent and is in the collapsed state.
TV_NODE_PARENT_EXPANDED The node is a parent and is in the expanded state.
Examples The following example returns whether the first root-level node in the
Address List tree view field is a parent.
TreeView_MakeNodeVisible()
Description The TreeView_MakeNodeVisible() function ensures that the specified
node is visible in the tree. If necessary, the contents of the tree will be
scrolled to make the specified node visible.
Parameters • tree_view_field – The tree view field containing the specified node.
Return value A boolean indicating whether the node was made visible. True indicates the
node was made visible, while false indicates it was not.
Comments Making a node visible does not select the node. To select the node, use the
TreeView_SetSelectedNode() function.
Examples The following example makes the currently-selected node for the Address
List tree view field visible to the user.
658 F U N C T I O N L I B R A R Y R E F E R E N C E
T R E E V I E W _ R E M O V E C H I L D R E N ()
TreeView_RemoveChildren()
Description The TreeView_RemoveChildren() function removes the child nodes for
the specified parent node.
Return value A long integer containing the number of child nodes removed. This value
does not include the descendants of the child nodes removed.
Comments To remove all nodes from a tree, specify TV_ROOT as the parent node.
Examples The following example removes all nodes from the Address List tree view
field.
TreeView_RemoveNode()
Description The TreeView_RemoveNode() function deletes the specified node from a
tree view field.
Parameters • tree_view_field – The tree view field containing the node to remove.
Return value A boolean indicating whether the node was successfully removed. True
indicates the node was successfully removed. False indicates the node was
not removed.
Comments When a node is removed, all of its children are removed as well. To remove
all nodes from a tree, use the TreeView_RemoveChildren(), specifying the
node TV_ROOT.
Examples The following example removes the first root-level node in the Address List
tree view field.
660 F U N C T I O N L I B R A R Y R E F E R E N C E
T R E E V I E W _ S E T N O D E D A T A ()
TreeView_SetNodeData()
Description The TreeView_SetNodeData() function sets the data item associated with
the specified node.
Parameters • tree_view_field – The tree view field containing the specified node.
• node_ID – A long integer specifying the ID of the node whose data item will
be set.
Return value A long integer containing the previous data item for the specified node.
Examples The following example sets the data item of the currently-selected node in
the Address List tree view field to -1.
TreeView_SetNodeImage()
Description The TreeView_SetNodeImage() function specifies which image to use for
the specified node.
Parameters • tree_view_field – The tree view field containing the specified node.
• node_ID – A long integer specifying the ID of the node whose image will be
set.
• index – An integer specifying the image to use. The value corresponds to the
item number of an item image listed in the TreeView Images window. If no
image will be displayed for the node, use the TV_NOIMAGE constant.
Return value An integer containing the item number for the image previously associated
with the specified node.
Examples The following example causes every root-level node in the Address List tree
view field to not display an image.
662 F U N C T I O N L I B R A R Y R E F E R E N C E
T R E E V I E W _ S E T N O D E L A B E L ()
TreeView_SetNodeLabel()
Description The TreeView_SetNodeLabel() function sets the label for the specified
node.
Parameters • tree_view_field – The tree view field containing the specified node.
• node_ID – A long integer specifying the ID of the node whose label will be
set.
Return value A boolean indicating whether the label was set. True indicates the label was
set, while false indicates it was not.
Examples The following example allows the user to specify a new label for the current
node in the Address List tree view field.
TreeView_SetNodeStateImage()
Description The TreeView_SetNodeStateImage() function sets the state image
associated with the specified node.
Parameters • tree_view_field – The tree view field containing the specified node.
• node_ID – A long integer specifying the ID of the node whose state image is
being set.
• image – An integer specifying the state image to use. The value corresponds
to the item number of a state image listed in the TreeView Images window.
If no image will be displayed, use the TV_NOIMAGE constant.
Return value An integer containing the item number of the previous state image for the
specified node. If no state image is associated with the tree view node, the
constant TV_NOIMAGE is returned.
664 F U N C T I O N L I B R A R Y R E F E R E N C E
T R E E V I E W _ S E T S E L E C T E D N O D E ()
TreeView_SetSelectedNode()
Description The TreeView_SetSelectedNode() function makes the specified node
selected and visible in the tree view field.
Parameters • tree_view_field – The tree view field containing the specified node.
• node_ID – A long integer specifying the ID of the node that will be selected.
Return value A boolean indicating whether the node was selected. True indicates the
node was selected, while false indicates it was not.
Examples The following example selects the first node in the Address List tree view
field.
Trigger_CausedByProduct()
Description The Trigger_CausedByProduct() function is used in a trigger processing
procedure of a database trigger to find out which product caused the
trigger to activate.
Syntax Trigger_CausedByProduct()
Parameters • None
Return value An integer containing the ID of the product that caused the trigger to
activate. The value -1 is returned if the trigger is activated by a script that is
running in the background. Currently, you can’t find what product caused a
trigger if processing is occurring in the background.
Comments This function is useful if you want to selectively run a database trigger
processing script based on the product that caused the trigger to activate.
668 F U N C T I O N L I B R A R Y R E F E R E N C E
T R I G G E R _ D I S A B L E S I N G L E ()
Trigger_DisableSingle()
Description The Trigger_DisableSingle() function disables a specific trigger.
Syntax Trigger_DisableSingle(tag)
Parameters • tag – An integer that uniquely identifies a trigger. The tag was assigned
when the trigger was registered.
Return value A boolean. True indicates the trigger was successfully disabled, while false
indicates it was not.
Examples The following example disables a single trigger. The tag for the trigger is
stored in the Trigger_List global variable, which is an array.
Trigger_Enable()
Description The Trigger_Enable() function enables or disables all object triggers for a
given application.
Value Description
true Triggers are enabled for the specified product.
false Triggers are disabled for the specified product.
Return value A boolean indicating the result; true if the function succeeded, false if it
didn’t succeed.
Comments You can use this function or the Customization Status window to disable all
triggers for a given application. Use the Trigger_DisableSingle() and
Trigger_EnableSingle() functions to disable and enable individual triggers.
670 F U N C T I O N L I B R A R Y R E F E R E N C E
T R I G G E R _ E N A B L E S I N G L E ()
Trigger_EnableSingle()
Description The Trigger_EnableSingle() function enables a specific trigger.
Syntax Trigger_EnableSingle(tag)
Parameters • tag – An integer that uniquely identifies a trigger. The tag was assigned
when the trigger was registered.
Return value A boolean. True indicates the trigger was successfully enabled, while false
indicates it was not.
Examples The following example enables a single trigger. The tag for the trigger is
stored in the Trigger_List global variable, which is an array.
Trigger_GetCurrentTag
Description The Trigger_GetCurrentTag() function is used in a trigger processing
procedure to retrieve the tag associated with the current trigger.
Syntax Trigger_GetCurrentTag()
Parameters • None
Return value An integer containing the tag for the current trigger.
Examples The following example is a trigger processing procedure. It retrieves the tag
for the current trigger, and then disables the trigger.
tag = Trigger_GetCurrentTag();
result = Trigger_Unregister(tag);
672 F U N C T I O N L I B R A R Y R E F E R E N C E
T R I G G E R _ I S T R I G G E R E N A B L E D ()
Trigger_IsTriggerEnabled()
Description The Trigger_IsTriggerEnabled() function returns a boolean indicating
whether a specific trigger is enabled.
Syntax Trigger_IsTriggerEnabled(tag)
Parameters • tag – An integer that uniquely identifies a trigger. The tag was assigned
when the trigger was registered.
Return value A boolean. True indicates the trigger is enabled, while false indicates it is
not.
Examples The following example examines the state of a single trigger. The tag for the
trigger is stored in the Trigger_List global variable, which is an array. If the
trigger is currently enabled, it will be disabled.
Trigger_RegisterDatabase()
Description The Trigger_RegisterDatabase() function registers a database trigger for
use with the runtime engine. Database triggers are activated by successful
table operations in an application, such as saving a record, deleting a record
or reading a record.
Parameters • table table_name – A table resource in the application dictionary. This is the
table for which the trigger will be registered. Use the anonymous() function
with this parameter to avoid implicitly opening the table.
• form form_name – The restriction for the database trigger. The form_name is
a form resource in the application. This restricts the trigger to database
operations that originate from the table buffer for the form form_name. Use a
zero (0) if no form restriction applies.
674 F U N C T I O N L I B R A R Y R E F E R E N C E
T R I G G E R _ R E G I S T E R D A T A B A S E ()
• script processing_procedure – The procedure you write that’s run (called the
trigger processing procedure) when the database trigger is activated. Upon a
successful table operation, the database trigger passes the current record
buffer to this procedure as an inout parameter.
• tag – An optional returned integer that uniquely identifies the trigger. This
value is used when you want to unregister, enable or disable the trigger
individually.
Comments Upon a successful table operation, a database trigger is activated and passes
the table buffer on which the table operation occurred to the trigger
processing procedure as an inout parameter. This buffer is always available
to the processing procedure, regardless of the table operation successfully
completed. Successful table operations that occur for a range of records will
activate a database trigger for each record in the range. Each record’s buffer
is then passed to the processing procedure.
Examples This example registers a database trigger used to delete a customer contact
record when the user deletes its corresponding customer record.
{Name: Startup}
local integer l_result;
{Name: Delete_Customer_Contacts}
inout table Customers;
in integer table_operation;
676 F U N C T I O N L I B R A R Y R E F E R E N C E
T R I G G E R _ R E G I S T E R D A T A B A S E B Y N A M E ()
Trigger_RegisterDatabaseByName()
Description The Trigger_RegisterDatabaseByName() function registers a database
trigger for a table in the specified dictionary. Database triggers are activated
by successful table operations in an application, such as saving a record,
deleting a record or reading a record.
Parameters • product_ID – An integer specifying the ID of the product that contains the
table for which the trigger is being registered.
• table_name – A string specifying the table for which the trigger is being
registered.
• script processing_procedure – The procedure you write that’s run (called the
trigger processing procedure) when the database trigger is activated. Upon a
successful table operation, the database trigger passes the current record
buffer to this procedure as an inout parameter.
• tag – An optional returned integer that uniquely identifies the trigger. This
value is used when you want to unregister, enable or disable the trigger
individually.
Comments Upon a successful table operation, a database trigger is activated and passes
the table buffer on which the table operation occurred to the trigger
processing procedure as an anonymous inout parameter. This buffer is
always available to the processing procedure, regardless of whether the
table operation successfully completed. Use the column() function to
retrieve specific fields from the table buffer.
Successful table operations that occur for a range of records will activate a
database trigger for each record in the range. Each record’s buffer is then
passed to the processing procedure.
678 F U N C T I O N L I B R A R Y R E F E R E N C E
T R I G G E R _ R E G I S T E R D A T A B A S E B Y N A M E ()
{Name: Startup}
local integer result;
{Register the database trigger that runs when deleting the applicant
record.}
result = Trigger_RegisterDatabaseByName(414, "HR_Applicant", "",
TRIGGER_ON_DB_DELETE, script Delete_Applicant_Internet_Info);
if result <> SY_NOERR then
warning "Database trigger 3 registration failed.";
end if;
When the trigger is activated, this processing procedure deletes the Internet
information record corresponding to the applicant record that was deleted.
{Name: Delete_Applicant_Internet_Info}
inout anonymous table 'Triggered Table';
Trigger_RegisterFocus()
Description The Trigger_RegisterFocus() function registers a focus trigger for use with
the runtime engine. Focus triggers are activated by “focus” events in an
application, such as a window opening or closing, or the focus moving from
one field to the next. Focus triggers can be linked to any location where
Dexterity allows you to attach a script, such as window pre and post scripts,
or field pre, change and post scripts.
Typically, you should use the anonymous() function with this parameter to
avoid implicitly opening the resource.
Constant Value
TRIGGER_FOCUS_PRE 0
TRIGGER_FOCUS_CHANGE 1
TRIGGER_FOCUS_POST 2
TRIGGER_FOCUS_PRINT 3
TRIGGER_FOCUS_ACTIVATE 4
TRIGGER_FOCUS_FILL 5
TRIGGER_FOCUS_INSERT 6
TRIGGER_FOCUS_DELETE 7
TRIGGER_FOCUS_CONTEXT_MENU 9
680 F U N C T I O N L I B R A R Y R E F E R E N C E
T R I G G E R _ R E G I S T E R F O C U S ()
Constant Value
TRIGGER_BEFORE_ORIGINAL 1
TRIGGER_AFTER_ORIGINAL 2
• tag – An optional returned integer that uniquely identifies the trigger. This
value is used when you want to unregister, enable or disable the trigger
individually.
Comments It’s important to remember that focus triggers are activated by focus events
regardless of whether a script already exists for that focus event. You can create
focus triggers that are activated by the following types of objects and focus
events:
Examples This example registers a focus trigger that is activated when the Customers
form closes.
{Name: Startup}
local integer l_result;
{Name: Close_Customer_Contacts}
close form Customer_Contacts;
682 F U N C T I O N L I B R A R Y R E F E R E N C E
T R I G G E R _ R E G I S T E R F O C U S B Y N A M E ()
Trigger_RegisterFocusByName()
Description The Trigger_RegisterFocusByName() function registers a focus trigger for
a resource in the specified dictionary. Focus triggers are activated by
“focus” events in an application, such as a window opening or closing, or
the focus moving from one field to the next. Focus triggers can be linked to
any location where Dexterity allows you to attach a script, such as window
pre and post scripts, or field pre, change and post scripts.
Parameters • product_ID – An integer specifying the ID of the product that contains the
form for which the trigger is being registered.
Constant Value
TRIGGER_FOCUS_PRE 0
TRIGGER_FOCUS_CHANGE 1
TRIGGER_FOCUS_POST 2
TRIGGER_FOCUS_PRINT 3
TRIGGER_FOCUS_ACTIVATE 4
TRIGGER_FOCUS_FILL 5
TRIGGER_FOCUS_INSERT 6
TRIGGER_FOCUS_DELETE 7
TRIGGER_FOCUS_CONTEXT_MENU 9
Constant Value
TRIGGER_BEFORE_ORIGINAL 1
TRIGGER_AFTER_ORIGINAL 2
• tag – An optional returned integer that uniquely identifies the trigger. This
value is used when you want to unregister, enable or disable the trigger
individually.
684 F U N C T I O N L I B R A R Y R E F E R E N C E
T R I G G E R _ R E G I S T E R F O C U S B Y N A M E ()
Comments It’s important to remember that focus triggers are activated by focus events
regardless of whether a script already exists for that focus event. Focus triggers
are activated by the following types of objects and focus events:
Examples The following example registers a focus trigger that runs when the
Applicants window restarts.
{Name: Startup}
{Register the focus trigger that runs when the Applicants window
restarts.}
result = Trigger_RegisterFocusByName(414,
➥ "window 'HR Applicant Tracking' of form 'HR Applicant'",
➥ TRIGGER_FOCUS_PRE, TRIGGER_AFTER_ORIGINAL,
➥ script Restart_Applicant_Internet_Info);
if result <> SY_NOERR then
warning "Focus trigger registration failed.";
end if;
Trigger_RegisterForm()
Description The Trigger_RegisterForm() function registers a form trigger for use with
the runtime engine. When a form trigger is registered, an “Extras” menu
will appear when the specified form is opened.
Parameters • form form_name – The name of the form for which the trigger is registered.
The Extras menu will appear when this form is open.
• menu_item_name – The name of the menu item as it will appear in the Extras
menu.
• script processing_procedure – The procedure you write that will run when
you choose the menu_item_name from the Extras menu.
• tag – An optional returned integer that uniquely identifies the trigger. This
value is used when you want to unregister, enable or disable the trigger
individually.
686 F U N C T I O N L I B R A R Y R E F E R E N C E
T R I G G E R _ R E G I S T E R F O R M ()
Comments You can disable all triggers for a given application using the
Trigger_Enable() function or the Customization Status window. If you
disable a form trigger for a form that’s currently open, the Extras menu
won’t disappear until the form is closed. If the user chooses the menu item
before closing the form, the message “Cannot run form trigger” will appear.
Examples This example registers a form trigger for the Customers form. It adds the
menu item “Customer Contacts” to the Extras menu displayed when the
Customers form is open. When the user chooses the menu item, the
procedure named Open_Customer_Contacts is called.
{Name: Startup}
local integer l_result;
When the user chooses Customer Contacts from the Extras menu, this
processing procedure is run. It opens the form named Customer_Contacts,
sets window fields, and retrieves a record from the Customer Contacts
table.
{Name: Open_Customer_Contacts}
open form Customer_Contacts;
Trigger_RegisterFormByName()
Description The Trigger_RegisterFormByName() function registers a form trigger for a
form in the specified dictionary. When a form trigger is registered, an
“Extras” menu will appear when the specified form is opened.
Parameters • product_ID – An integer specifying the ID of the product that contains the
form for which the trigger is being registered.
• form_name – A string containing the name of the form for which the trigger
is registered. The Extras menu will appear when this form is open.
• script processing_procedure – The procedure you write that will run when
you choose the menu_item_name from the Extras menu.
• tag – An optional returned integer that uniquely identifies the trigger. This
value is used when you want to unregister, enable or disable the trigger
individually.
688 F U N C T I O N L I B R A R Y R E F E R E N C E
T R I G G E R _ R E G I S T E R F O R M B Y N A M E ()
Comments You can disable all triggers for a given application using the
Trigger_Enable() function or the Customization Status window. If you
disable a form trigger for a form that’s currently open, the Extras menu
won’t disappear until the form is closed. If the user chooses the menu item
before closing the form, the message “Cannot run form trigger” will appear.
Examples This example registers a form trigger for the HR_Applicant form. It adds
the menu item “Internet Information” to the Extras menu displayed when
the HR_Applicant form is open. When the user chooses the menu item, the
procedure named Open_Applicant_Internet_Info is called.
{Name: Startup}
local integer result;
When the user chooses Internet Information from the Extras menu, this
processing procedure is run. It opens the form named
Applicant_Internet_Info and uses the GetWindowValue() user-defined
function to retrieve the appropriate record from the
Applicant_Internet_Info table.
{Name: Open_Applicant_Internet_Info}
local anonymous appl_number;
local integer result;
local integer datatype;
Trigger_RegisterFunction()
Description The Trigger_RegisterFunction() function registers a function trigger for use
with the runtime engine. A function trigger is activated when a specified
function is run.
Constant Value
TRIGGER_BEFORE_ORIGINAL 1
TRIGGER_AFTER_ORIGINAL 2
• tag – An optional returned integer that uniquely identifies the trigger. This
value is used when you want to unregister, enable or disable the trigger
individually.
690 F U N C T I O N L I B R A R Y R E F E R E N C E
T R I G G E R _ R E G I S T E R F U N C T I O N ()
Comments If a function runs in response to the function trigger, it must have exactly
the same set of parameters as the function that is being triggered on. If a
procedure runs in response to the function, it can’t have any parameters.
Examples This example registers a trigger that is activated when the GetNoteIndex
function is run.
{Name: Startup}
local integer l_result;
Trigger_RegisterFunctionByName()
Description The Trigger_RegisterFunctionByName() function registers a function
trigger for a function in the specified dictionary. A function trigger is
activated when a specified function is run.
Parameters • product_ID – An integer specifying the ID of the product that contains the
function for which the trigger is being registered.
• function_name – A string containing the name of the function for which the
function trigger is registered. When this function is run, the function trigger
is activated. If the function is a form function, be sure to include the of form
form_name clause in the name.
Constant Value
TRIGGER_BEFORE_ORIGINAL 1
TRIGGER_AFTER_ORIGINAL 2
• tag – An optional returned integer that uniquely identifies the trigger. This
value is used when you want to unregister, enable or disable the trigger
individually.
692 F U N C T I O N L I B R A R Y R E F E R E N C E
T R I G G E R _ R E G I S T E R F U N C T I O N B Y N A M E ()
Comments If a function runs in response to the function trigger, it must have exactly
the same set of parameters as the function that is being triggered on. If a
procedure runs in response to the function, it can’t have any parameters.
Examples The following example registers a trigger that is activated when the
ValidateApplicant function is called.
Trigger_RegisterProcedure()
Description The Trigger_RegisterProcedure() function registers a procedure trigger for
use with the runtime engine. A procedure trigger is activated when the
specified procedure is run.
Parameters • script procedure – The procedure for which the procedure trigger is
registered. When this procedure is run, the procedure trigger is activated.
Constant Value
TRIGGER_BEFORE_ORIGINAL 1
TRIGGER_AFTER_ORIGINAL 2
• tag – An optional returned integer that uniquely identifies the trigger. This
value is used when you want to unregister, enable or disable the trigger
individually.
694 F U N C T I O N L I B R A R Y R E F E R E N C E
T R I G G E R _ R E G I S T E R P R O C E D U R E ()
Examples This example registers a trigger that is activated when the Security
procedure runs. The runtime engine calls a procedure named Security
automatically whenever the user opens a form. Refer to Chapter 5,
“Security,” in the Dexterity Stand-Alone Application Guide for information
about using the Security procedure.
{Name: Startup}
local integer l_result;
Trigger_RegisterProcedureByName()
Description The Trigger_RegisterProcedureByName() function registers a procedure
trigger for a procedure in the specified dictionary. A procedure trigger is
activated when the specified procedure is run.
Parameters • product_ID – An integer specifying the ID of the product that contains the
procedure for which the trigger is being registered.
Constant Value
TRIGGER_BEFORE_ORIGINAL 1
TRIGGER_AFTER_ORIGINAL 2
• tag – An optional returned integer that uniquely identifies the trigger. This
value is used when you want to unregister, enable or disable the trigger
individually.
696 F U N C T I O N L I B R A R Y R E F E R E N C E
T R I G G E R _ R E G I S T E R P R O C E D U R E B Y N A M E ()
Examples The following example registers a trigger that is activated when the
Process_Applicant form procedure runs.
result = Trigger_RegisterProcedureByName(414,
➥ "Process_Applicant of form HR_Applicant_Tracking",
➥ TRIGGER_AFTER_ORIGINAL, script Applicant_PostProcessing);
Trigger_Unregister()
Description The Trigger_Unregister() function unregisters a specific trigger.
Syntax Trigger_Unregister(tag)
Parameters • tag – An integer that uniquely identifies a trigger. The tag was assigned
when the trigger was registered.
Return value A boolean. True indicates the trigger was successfully unregistered, while
false indicates it was not.
Comments When you unregister a trigger, its tag becomes invalid. If you reregister the
trigger, a new tag will be assigned.
Examples The following example unregisters a single trigger. The tag for the trigger is
stored in the Trigger_List global variable, which is an array. Since the tag is
no longer valid, the array element that stored the tag is cleared.
698 F U N C T I O N L I B R A R Y R E F E R E N C E
Utility function library
Use the functions in this library for various utility operations you may need
to perform in your application. This library includes the following
functions:
• Utility_DecodeString()
• Utility_DecryptTableString()
• Utility_EncodeString()
• Utility_EncryptTableString()
• Utility_LaunchUrl()
• Utility_LoadDLL()
• Utility_SubstituteTokens()
• Utility_UnloadDLL()
Utility_DecodeString()
Description The Utility_DecodeString() function decodes a string that was encoded by
the Utility_EncodeString() function.
Syntax Utility_DecodeString(source_string)
700 F U N C T I O N L I B R A R Y R E F E R E N C E
U T I L I T Y _ D E C R Y P T T A B L E S T R I N G ()
Utility_DecryptTableString()
Description The Utility_DecryptTableString() function decrypts a string that has been
stored in a table in encrypted format.
Syntax Utility_DecryptTableString(source_string)
Examples The following example decrypts the value stored in the Password field of
the Users table. The Encrypt option for the table field was unmarked, so the
field was read without being decrypted by the database manager.
Utility_EncodeString()
Description The Utility_EncodeString() function converts a string into a format that
isn’t easily readable by users or other applications.
Syntax Utility_EncodeString(source_string)
Comments The encoded string will be up to 40% longer than the original string. When
you specify the storage size of the string in the table, be sure to allow for the
increased size. For example, if the string field allows up to 8 characters to be
entered by the user, be sure the storage size of the field allows for up to 12
characters to be stored.
702 F U N C T I O N L I B R A R Y R E F E R E N C E
U T I L I T Y _ E N C R Y P T T A B L E S T R I N G ()
Utility_EncryptTableString()
Description The Utility_EncryptTableString() function encrypts a string using the
same method that Dexterity uses when storing encrypted strings in tables.
Syntax Utility_EncryptTableString(source_string)
encrypted_result = Utility_EncryptTableString("Steve");
Utility_LaunchUrl()
Description The Utility_LaunchUrl() function opens a web browser and displays the
content of the specified URL.
Syntax Utility_LaunchUrl(URL)
Examples The following example displays the Microsoft web site in a browser
window.
Utility_LaunchUrl("http://www.microsoft.com");
704 F U N C T I O N L I B R A R Y R E F E R E N C E
U T I L I T Y _ L O A D D L L ()
Utility_LoadDLL()
Description The Utility_LoadDLL() function loads the specified DLL into memory. The
DLL remains in memory until it is unloaded or the application is closed.
Syntax Utility_LoadDLL(DLL_name)
Parameters • DLL_name – A string specifying the name of the DLL to load into memory.
The DLL must be in the current directory, or in a directory included in the
PATH variable for the system.
Return value A long integer containing the handle to the DLL. You must save this value
to use when unloading the DLL from memory.
Comments You will use the Utility_LoadDLL() function when a DLL must maintain
state information between calls. Use this function to load the DLL into
memory, make the necessary calls, and then use the Utility_UnloadDLL()
function to remove the DLL from memory.
Examples The following example uses the Crystal Print Engine (CRPE32.DLL) to
print a report. The DLL is loaded into memory, and several calls are issued
to print the report. Then the DLL is unloaded from memory.
Additional information
Chapter 22, “Dynamic Link Libraries,” in Volume 2 of the Dexterity Programmer’s Guide
706 F U N C T I O N L I B R A R Y R E F E R E N C E
U T I L I T Y _ S U B S T I T U T E T O K E N S ()
Utility_SubstituteTokens()
Description The Utility_SubstituteTokens() function replaces product tokens in a
string with the corresponding product names.
Syntax Utility_SubstituteTokens(string)
Comments Rather than hard-coding product names in strings, we recommend that you
use tokens to represent product names. The token to indicate the product
name in a string is @PRODprodID@ where prodID is the product ID of the
product whose name you want to include in the message. The product
name will be read automatically from the launch file.
If the token specifies a product for which a product name cannot be found,
the string [unknown] is substituted.
Examples The following example replaces the product tokens in a string with the
corresponding product names, and then the string is used to display a
message.
Utility_UnloadDLL()
Description The Utility_UnloadDLL() function removes the specified DLL from
memory.
Syntax Utility_UnloadDLL(handle)
Parameters • handle – A long integer that is the handle of the DLL to unload. This is the
value that was returned from the Utility_LoadDLL() function.
Comments You will use the Utility_LoadDLL() function when a DLL must maintain
state information between calls. Use this function to load the DLL into
memory, make the necessary calls, and then use the Utility_UnloadDLL()
function to remove the DLL from memory.
Additional information
Chapter 22, “Dynamic Link Libraries,” in Volume 2 of the Dexterity Programmer’s Guide
708 F U N C T I O N L I B R A R Y R E F E R E N C E
Window function library
Refer to Chapter 11, Use the functions in this library to manipulate window resources in your
“Windows,” in Volume dictionary. Most of these functions deal with window titles and window
1 of the Dexterity names. A window title is the string that appears at the top of a window when
Programmer’s Guide it’s displayed in test mode or at runtime. A window’s name is the string
for more information. that’s used to refer to the window in sanScript.
• Window_ForceRedraw()
• Window_GetMainWindowTitle()
• Window_GetPosition()
• Window_GetRibbonCommandTag()
• Window_GetSize()
• Window_GetState()
• Window_GetTitle()
• Window_GetTitleByProduct()
• Window_PullFocus()
• Window_ScrollScrollingWindow()
• Window_SetBaseSize()
• Window_SetLineMode()
• Window_SetState()
Window_ForceRedraw()
Description The Window_ForceRedraw() function forces a window to be redrawn. Its
primary use is to redraw a progress control window when it is first opened.
Comments During normal processing, a newly-opened window is not drawn until all
foreground scripts have finished processing. This function redraws the
window immediately after it is executed. Thus, it forces the window to be
redisplayed, even while foreground script processing is occurring.
Typically once a window has been drawn, any set statements used to
update window fields will automatically redraw the window. Thus, it is
usually necessary to call the Window_ForceRedraw() function only once
when the window is opened, rather than each time the window is updated.
Avoid setting the BackColor property for fields to Transparent. These fields are not
updated automatically by the set statement. If you use fields that have the
BackColor property set to Transparent, you must use Window_ForceRedraw()
each time these fields are changed in order for the changes to be displayed.
710 F U N C T I O N L I B R A R Y R E F E R E N C E
W I N D O W _ F O R C E R E D R A W ()
in string l_Table_name;
in string l_Record;
in long l_Current_Records;
in long l_Total_Records;
712 F U N C T I O N L I B R A R Y R E F E R E N C E
W I N D O W _ G E T M A I N W I N D O W T I T L E ()
Window_GetMainWindowTitle()
Description The Window_GetMainWindowTitle() function returns the window title of
a form’s main window.
• form_name – A string containing the name of the form for which you wish to
retrieve the main window’s title.
Comments A window’s title is the string that appears in the window’s title bar in test
mode or at runtime. The title is specified in the window’s Title property.
If you are in tools mode, or have yet to add product information to your
dictionary, the product ID for your dictionary will be zero. The product ID
for Dynamics.dic is always zero.
This function returns the title of the first window listed for the form in the
Form Definition window. This is also referred to as the form’s parent, or
main window. A main window will open first when the form opens.
Examples The following example returns the window title of a form’s main window
to a local string field. The form is located in a dictionary with the product
ID 3333.
Window_GetPosition()
Description The Window_GetPosition() function returns the current coordinates of the
named window’s top left corner.
Parameters • window window_name – The name of the window for which you wish to
retrieve a position.
Comments The coordinates are expressed in pixels. The coordinates 0,0 specify the
upper left corner of the screen. If a toolbar is present, the vertical position 0
is located below the bottom of the toolbar.
Use the isopen() function to see if the specified window is open before using this
function. Then, you’ll know that the 0,0 coordinates returned by this function
represent the location of the window, not the fact that the window is closed.
Examples The following example returns the coordinates of the Customer Data
window’s current location.
714 F U N C T I O N L I B R A R Y R E F E R E N C E
W I N D O W _ G E T R I B B O N C O M M A N D T A G ()
Window_GetRibbonCommandTag()
Description The Window_GetRibbonCommandTag() function retrieves the command
tag for the root command list that defines the ribbon for a window.
Parameters • window window_name – The window for which the ribbon command tag is
being retrieved.
Return value An integer containing the command tag. If the window is not open, or the
ribbon has not been created for the window, the value 0 is returned.
Window_GetSize()
Description The Window_GetSize() function returns the current height and width, in
pixels, of a specified window.
Parameters • window window_name – The name of the window for which you wish to
retrieve the height and width.
Comments The height and width are expressed in pixels. If the specified window is
closed, the width and height parameters are set to 0.
Examples The following example returns the current width and height of the Sales
Data window.
716 F U N C T I O N L I B R A R Y R E F E R E N C E
W I N D O W _ G E T S T A T E ()
Window_GetState()
Description The Window_GetState() function retrieves the visual state for a window.
Return value An integer indicating the window state. The value corresponds to one of the
following constants:
Constant Description
WINDOW_STATE_MAXIMIZED The window is in the maximized state.
WINDOW_STATE_MINIMIZED The window is in the minimized state.
WINDOW_STATE_NORMAL The window is in the normal state.
WINDOW_STATE_MODAL The window is modal.
WINDOW_STATE_UNKNOWN The window is in an unknown state.
Examples The following example retrieves the state of the Buyers window.
Window_GetTitle()
Description The Window_GetTitle() function returns the title of the specified window.
Parameters • window window_name – The name of the window for which you want to
retrieve the title.
Comments A window title is the string that appears in the window’s title bar in test
mode or at runtime. The title is specified in the window’s Title property.
This function will return the window title of a window in the current
dictionary only. To retrieve the name of a window in another dictionary, use
the Window_GetTitleByProduct() function.
Examples The following example displays a warning message if the user doesn’t enter
all required fields when attempting to save a record. The
Window_GetTitle() function is used to retrieve the window title for use in
the warning dialog.
718 F U N C T I O N L I B R A R Y R E F E R E N C E
W I N D O W _ G E T T I T L E B Y P R O D U C T ()
Window_GetTitleByProduct()
Description The Window_GetTitleByProduct() function returns the title of a window
in a specified form in a specified dictionary. If the window title has been
modified using the Modifier, the revised window title is not returned.
• window_name – The string containing the name of the window whose title
you want to retrieve.
Comments If you are in tools mode, or have yet to add product information to your
dictionary, the product ID for your dictionary will be zero. The product ID
for Dynamics.dic is always zero.
Examples The following example returns a window title to the local variable
l_win_title. The product ID is represented by the constant
INVENT_PRODID.
l_win_title = Window_GetTitleByProduct(INVENT_PRODID,
➥ '(L) form_name', '(L) window_name');
'(L) Window_Title' of window Title_Test = l_win_title;
Window_PullFocus()
Description The Window_PullFocus() function pulls the focus from the specified
window. Any pending change or post scripts for the currently-focused field
will be run.
Parameters • window window_name – The name of the window from which you want to
pull the focus.
After the focus has been pulled from the window, no item in the window
will be focused.
Examples The following example pulls the focus from the Houses window of the
Houses form.
720 F U N C T I O N L I B R A R Y R E F E R E N C E
W I N D O W _ S C R O L L S C R O L L I N G W I N D O W ()
Window_ScrollScrollingWindow()
Description The Window_ScrollScrollingWindow() function causes the contents of a
scrolling window to scroll to the next or previous record. It is intended for
use within single-line scrolling windows.
Constant Description
SCROLLTYPE_NEXT Scrolls to the next record.
SCROLLTYPE_PREV Scrolls to the previous record.
Constant Description
FOCUS_OK The scrolling window was scrolled successfully.
FOCUS_DENIED The scrolling window could not be scrolled because a line
was already locked in the scrolling window.
FOCUS_DIVERTED The scrolling window could not be scrolled because a
focus statement prevented the focus from remaining on
the same field in the new line to be displayed.
FOCUS_RESTART The scrolling window could not be scrolled because a
restart field statement prevented the focus from
moving.
FOCUS_NOEXIST The scrolling window could not be scrolled because the
record to be displayed has been deleted.
FOCUS_NOEXIST_EOF The scrolling window could not be scrolled because the
end of the table was reached.
FOCUS_NOEXIST_SOF The scrolling window could not be scrolled because the
beginning of the table was reached.
FOCUS_NOT_IN_SWIN Attempted to call the function from outside of the
scrolling window.
Comments A single-line scrolling window is created when the small line item or the
big line item is set to use the entire scrolling window area. When used in
this way, a scrolling window displays only one record of information at a
time. Push buttons in the scrolling window are typically used to move to
the next or previous records. The change scripts attached to these push
buttons use the Window_ScrollScrollingWindow() function to perform the
scrolling.
This function cannot be used in a change script for a push button that has the
Hyperspace property set to true.
Examples The following example is the change script of the Previous button in a
single-line scrolling window. It attempts to display the previous record
from the table linked to the scrolling window.
722 F U N C T I O N L I B R A R Y R E F E R E N C E
W I N D O W _ S E T B A S E S I Z E ()
Window_SetBaseSize()
Description The Window_SetBaseSize() function sets the size of the window without
resizing any of the controls in the window.
Return value A boolean. True indicates the window was resized, while false indicates it
was not.
Examples In the following example, the base size of the Customer Maintenance
window is resized to 250 pixels wide, while the height is unchanged.
Window_SetLineMode()
Description The Window_SetLineMode() function changes the window type of the
scrolling window.
Parameters • window window_name – The scrolling window whose type will be changed.
• mode – An integer specifying the mode to use. The value corresponds to one
of the following constants:
Constant Mode
LINEMODE_BROWSE_ONLY Browse-only scrolling window
LINEMODE_EDITABLE Editable scrolling window
LINEMODE_ADDS_ALLOWED Adds-allowed scrolling window
Return value A boolean. True indicates the scrolling window mode was changed, while
false indicates it was not.
Comments To ensure the scrolling window is in a consistent state, use the fill window
statement to refill the scrolling window after you change the window type.
724 F U N C T I O N L I B R A R Y R E F E R E N C E
W I N D O W _ S E T S T A T E ()
Window_SetState()
Description The Window_SetState() function sets the visual state for a window.
Constant Description
WINDOW_STATE_MAXIMIZED Sets the window to its maximized state.
WINDOW_STATE_MINIMIZED Sets the window to its minimized state.
WINDOW_STATE_NORMAL Restores the window from the minimized
or maximized state.
Return value A boolean. True indicates the window state was set, while false indicates it
was not.
Examples The following example sets the Buyers window to the minimized state.
• WindowGroup_AddWindow()
• WindowGroup_SetBooleanProperty()
• WindowGroup_SetPosition()
• WindowGroup_SetSize()
• WindowGroup_SetState()
• WindowGroup_SetStringProperty()
WindowGroup_AddWindow()
Description The WindowGroup_AddWindow() function adds a window to the
specified window group.
• command_tag – An integer specifying the tag for the command that will be
run when the window in the group is activated.
Return value A boolean. The value true indicates the window was added successfully,
while false indicates that it was not.
Examples The following example is the trigger processing procedure that runs in
response to the SetupWindowGroup procedure for the
RM_Customer_Maintenance form. The trigger processing procedure
retrieves the window group for the Customer Maintenance window. It uses
the WindowGroup_AddWindow() function to add the Contact History
window to the end of the window group.
local long windowGroupId;
local integer tag;
{Get the tag for the command that runs when the new tab is clicked.}
tag = Command_GetTag(command 'IG_Contact_History_Tab' of form
➥ 'Command_IG_Sample');
728 F U N C T I O N L I B R A R Y R E F E R E N C E
W I N D O W G R O U P _ S E T B O O L EA N P R O P ER TY ()
WindowGroup_SetBooleanProperty()
Description The WindowGroup_SetBooleanProperty() function sets the value of a
boolean property for the specified window group.
Parameters • window_group_ID – A long integer specifying the window group for which
a boolean property is being set.
Constant Description
WG_PROP_HONOR_WINDOW_SIZE Specifies whether the window group will
automatically resize based on the size of the
window currently being displayed by the
window group. True indicates the window
group will automatically resize. False indicates
it will not.
WG_PROP_CAN_MINIMIZE Specifies whether the window group can be
minimized.
WG_PROP_CAN_USER_RESIZE Specifies whether the user can resize the
window group.
WG_PROP_HAS_CLOSE_BOX Specifies whether the window group displays
the close box.
WG_PROP_IS_MODAL Specifies whether the window group displays
as a modal window.
• value – A boolean indicating how to set the property. Refer to the preceding
table.
Return value A boolean indicating whether the property was set. True indicates the
property was set, while false indicates it was not.
Examples The following example prevents the user from being able to resize the
window group for the Customer Maintenance form.
730 F U N C T I O N L I B R A R Y R E F E R E N C E
W I N D O W G R O U P_ S ET P O S I TI O N ()
WindowGroup_SetPosition()
Description The WindowGroup_SetPosition() function changes the position of a
window group.
• h-position – The new horizontal position of the upper left corner of the
window group. This value is measured from the left edge of the screen.
• v-position – The new vertical position of the upper left corner of the window
group. This value is measured from the top edge of the screen.
Return value A boolean indicating whether the window group position was set. True
indicates the position was set, while false indicates it was not.
Comments The positions are expressed in pixels. The coordinates 0,0 specify the upper
left corner of the screen.
Examples The following example sets the position of the window group for the
Customer Maintenance form.
WindowGroup_SetSize()
Description The WindowGroup_SetSize() function changes the size of a window
group.
Return value A boolean indicating whether the window group size was set. True
indicates the size was set, while false indicates it was not.
Comments This function doesn’t change the top, left position of the window group. It
only changes the overall horizontal or vertical size. If the window group
size is reduced, fields located outside of the new size may no longer be
accessible.
Examples The following example resizes the window group for the Customer
Maintenance form. The width is set to 400, and the height is set to 600.
732 F U N C T I O N L I B R A R Y R E F E R E N C E
WI N DO W G R O U P _ S E T S T AT E ()
WindowGroup_SetState()
Description The WindowGroup_SetState() function sets the visual state for a window
group.
Parameters • window_group_ID – A long integer specifying the window group for which
the visual state is being set.
Constant Description
WG_STATE_MAXIMIZED Sets the window group to its maximized state.
WG_STATE_MINIMIZED Sets the window group to its minimized state.
WG_STATE_NORMAL Restores the window group from the
minimized or maximized state.
Return value A boolean. True indicates the window group state was set, while false
indicates it was not.
Examples The following example minimizes the window group for the Customer
Maintenance form.
WindowGroup_SetStringProperty()
Description The WindowGroup_SetStringProperty() function sets the value of a string
property for the specified window group.
Parameters • window_group_ID – A long integer specifying the window group for which
a string property is being set.
Constant Description
WG_PROP_INTERNAL_NAME An internal string used to identify the window
group.
WG_PROP_TITLE A string that is displayed in the title bar for the
ribbon group.
• value – A string indicating how to set the property. Refer to the preceding
table.
Return value A boolean indicating whether the property was set. True indicates the
property was set, while false indicates it was not.
Examples The following example sets the title of the window group for the Customer
Maintenance form.
734 F U N C T I O N L I B R A R Y R E F E R E N C E
WinHelp function library
Refer to Chapter 7, Use the functions in this library when implementing Windows help or
“Windows Help,” and HTML Help for Dexterity applications. They allow you to find out the type
Chapter 8, “HTML of help requested, find the correct topic in the help file, display a help topic,
Help,” in the Dexterity and run help macros.
Stand-alone Applica-
tion Guide for informa- This library contains the following functions:
tion about online help
support for Dexterity • WinHelp_ALinkLookup()
applications. • WinHelp_GetCurWindow()
• WinHelp_GetFieldContextNumber()
• WinHelp_GetHelpType()
• WinHelp_GetWindowContextNumber()
• WinHelp_InvokeHelp()
• WinHelp_LaunchUrl()
• WinHelp_RegisterHelpProcedure()
• WinHelp_RunHelpMacro()
• WinHelp_Search()
WinHelp_ALinkLookup()
Description The WinHelp_ALinkLookup() function starts the help engine, indicating
the help file to be used, and displays the topic corresponding to the ALink
(associative link) value specified.
Parameters • help_file – A string containing the name and complete path to the help file to
be accessed. The path is in generic format.
• ALink – A string containing the ALink value that indicates which help topic
to display.
Return value An integer indicating the status. If 0 is returned, no error occurred. If any
other value is returned, an error occurred while invoking help.
Comments Associative links are used to identify topics in HTML Help files. They are
useful in cases where the context number or HTML filename associated
with the topic might change. The ALink can remain constant, allowing the
topic to be found.
To display a topic using its ALink, you must know the ALink value that
was defined for the topic in the help file.
Examples The following example displays the topic from the Dexterity help file that
has the ALink value “close window”. This is the help topic for the close
window statement.
736 F U N C T I O N L I B R A R Y R E F E R E N C E
W I N H E L P _ G E T C U R W I N D O W ()
WinHelp_GetCurWindow()
Description The WinHelp_GetCurWindow() function returns the resource ID of the
currently-active window.
Syntax WinHelp_GetCurWindow()
Parameters • None
Comments This function is typically used in the help processing procedure script for
applications that integrate with Microsoft Dynamics GP. When help is
accessed for a window or window field, the WinHelp_GetCurWindow()
function is used to find out whether help was requested for an alternate
Microsoft Dynamics GP window or a third-party window. If the resource
ID returned is below 20,000, then the currently-active window is a
Microsoft Dynamics GP window. If the resource ID returned is 22,000 or
greater, the window is a third-party window.
Examples The following example retrieves the resource ID for the current window.
res_ID = WinHelp_GetCurWindow();
WinHelp_GetFieldContextNumber()
Description The WinHelp_GetFieldContextNumber() function returns the context
number (a long integer) for the currently-selected field.
Syntax WinHelp_GetFieldContextNumber()
Parameters • None
Comments This function is typically used in the help processing procedure script. It
returns the context number for the window field for which help was
requested.
Examples The following example handles requests for field-level help. The context
number for the current field is returned and passed to the help engine.
738 F U N C T I O N L I B R A R Y R E F E R E N C E
W I N H E L P _ G E T H E L P T Y P E ()
WinHelp_GetHelpType()
Description The WinHelp_GetHelpType() function returns an integer indicating the
type of help the user requested.
Syntax WinHelp_GetHelpType()
Parameters • None
Comments This function is typically used in the help processing procedure script to
find out the type of help the user requested.
Examples The following example is part of the help processing procedure script for an
application. The WinHelp_GetHelpType() function is used to indicate the
type of help requested by the user.
WinHelp_GetWindowContextNumber()
Description The WinHelp_GetWindowContextNumber() function returns the context
number (a long integer) for the current (front-most) window.
Syntax WinHelp_GetWindowContextNumber()
Parameters • None
Comments This function is typically used in the help processing procedure script. It
returns the context number for the current window. If your application
supports only window-level help, this function can be used to retrieve the
context number for the current window when help is requested using the
keyboard or “What’s this?” mode.
Examples The following example handles requests for window-level help. The
context number for the current window is returned and passed to the help
engine.
740 F U N C T I O N L I B R A R Y R E F E R E N C E
W I N H E L P _ I N V O K E H E L P ()
WinHelp_InvokeHelp()
Description The WinHelp_InvokeHelp() function starts the help engine, indicating the
help file, help command, and context number (a long integer) to be used.
Parameters • help_file – A string containing the name and complete path to the help file to
be accessed. The path is in generic format.
Constant Command
HELP_CMD_CONTENTS Display help contents topic.
HELP_CMD_CONTEXT Display context-sensitive help in a
standard help window.
HELP_CMD_CONTEXTPOPUP Display context-sensitive help in a pop-
up window. This is available only for
Windows Help.
Return value An integer indicating the status. If 0 is returned, no error occurred. If any
other value is returned, an error occurred while invoking help.
Examples The following example displays help for the current window. The context
number for the current window is returned and help is invoked, displaying
the topic in a standard help window.
The following example displays the Contents topic for the RESM.CHM help
file.
742 F U N C T I O N L I B R A R Y R E F E R E N C E
W I N H E L P _ L A U N C H U R L ()
WinHelp_LaunchUrl()
Description The WinHelp_LaunchUrl() function launches help content for the
Microsoft Dynamics GP web client. The content is displayed in a new web
browser window.
Syntax WinHelp_LaunchUrl(url)
Parameters • url – A string that specifies the URL of the content to be displayed in a new
web browser window. The URL can be a complete URL or a partial URL.
Comments If you are specifying a complete URL, the URL should begin with http:// or
https:// and contains the full path to the content to be displayed.
If you are specifying a relative URL, the relative URL should begin with a
forward slash (/) and provide the remaining path to the content after the
server name. The Microsoft Dynamics GP web client runtime will
automatically prepend the server name to the relative URL.
The content is displayed in new web browser window that has a special
name assigned to it. If this browser window is left open, subsequent calls to
the WinHelp_LaunchUrl() function will replace the content of this browser
window.
The code in the second half of the procedure processes the help requests
that originate from the web client. The procedure uses the
WinHelp_GetHelpType() function to find out the type of help being being
requested.
/Help/Develop/Frameset.htm?Context=532480
For the sample help collection, the Frameset.htm file contains JavaScript
code that parses the Context parameter and displays the appropriate topic.
{Is help being processed on the Windows client or the Web client?}
if Runtime_GetClientType() = DEX_CLIENT_TYPE_STANDARD then
case help_type
in [HELP_TYPE_WHATS_THIS_MODE, HELP_TYPE_HELP_KEY,
➥ HELP_TYPE_WHATS_THIS_WIN]
{Get the context number for the current window.}
context_number = WinHelp_GetWindowContextNumber();
{Call the help engine, displaying the help for the window.}
result = WinHelp_InvokeHelp(help_path_and_file,
➥ HELP_CMD_CONTEXT, context_number);
in [HELP_TYPE_DIALOG_HELP]
{Process the help for modal dialogs.}
{Get the context number for the item chosen.}
context_number = WinHelp_GetFieldContextNumber();
{Call the help engine, displaying help for the dialog.}
result = WinHelp_InvokeHelp(help_path_and_file,
➥ HELP_CMD_CONTEXT, context_number);
in [HELP_TYPE_CONTENTS]
{Invoke the Contents topic.}
result = WinHelp_InvokeHelp(help_path_and_file,
744 F U N C T I O N L I B R A R Y R E F E R E N C E
W I N H E L P _ L A U N C H U R L ()
➥ HELP_CMD_CONTENTS, 0);
in [HELP_TYPE_SEARCH]
{Invoke the search engine.}
result = WinHelp_Search(help_path_and_file, "");
else
{Invoke the Contents topic.}
result = WinHelp_InvokeHelp(help_path_and_file,
➥ HELP_CMD_CONTENTS, 0);
end case;
else
case help_type
in [HELP_TYPE_WHATS_THIS_MODE, HELP_TYPE_HELP_KEY,
➥ HELP_TYPE_WHATS_THIS_WIN]
{Get the context number for the current window.}
context_number = WinHelp_GetWindowContextNumber();
{Call the help set, displaying the help for the window.}
url = url + "?Context=" + str(context_number);
WinHelp_LaunchUrl(url);
in [HELP_TYPE_CONTENTS]
{Invoke the Contents topic.}
WinHelp_LaunchUrl(url);
else
{Invoke the Contents topic.}
WinHelp_LaunchUrl(url);
end case;
end if;
746 F U N C T I O N L I B R A R Y R E F E R E N C E
W I N H E L P _ R E G I S T E R H E L P P R O C E D U R E ()
WinHelp_RegisterHelpProcedure()
Description The WinHelp_RegisterHelpProcedure() function indicates which
procedure script will be called when help is accessed.
Parameters • script procedure_script – The name of the procedure script to be called each
time help is accessed.
Return value An integer indicating the status. If 0 is returned, no error occurred. If any
other value is returned, an error occurred while registering the help
processing procedure.
Examples The following example is part of the Main Menu pre script for the Real
Estate Sales manager. It registers the RESM_Help_Processing procedure
script as the help processing procedure script.
WinHelp_RunHelpMacro()
Description The WinHelp_RunHelpMacro() function specifies a help file and the help
macro or macros to run.
Parameters • help_file – A string containing the name and complete path to the help file to
be accessed. The path is in generic format.
Return value An integer indicating the status. If 0 is returned, no error occurred. If any
other value is returned, an error occurred while attempting to run the help
macro or macros.
Examples The following example uses the History help macro to display the viewing
history of the RESM.HLP help file.
The following example uses two help macros to resize the help window and
display the contents topic. Notice that double quotation marks are used to
enclose one of the macro parameters in quotation marks.
result = WinHelp_RunHelpMacro(":C:RESM/RESM.HLP",
➥ "PositionWindow(0,0,512,512,1,""main""); Contents()");
748 F U N C T I O N L I B R A R Y R E F E R E N C E
W I N H E L P _ S E A R C H ()
WinHelp_Search()
Description The WinHelp_Search() function starts the help engine and searches for the
specified keyword in the help file indicated.
Parameters • help_file – A string containing the name and complete path to the help file to
be searched. The path is in generic format.
Return value An integer indicating the status. If 0 is returned, no error occurred. If any
other value is returned, an error occurred while attempting to start the
search.
Comments If there is one exact match for the keyword in the help file, that help topic is
displayed. If there is more than one match, the Topics found dialog is
displayed listing the topics with the keyword. If there is no match, the
Index tab is displayed, allowing you to select a keyword from the list.
Examples The following example searches for the keyword “sellers” in the
RESM.CHM help file.
752 F U N C T I O N L I B R A R Y R E F E R E N C E
I N D E X
754 F U N C T I O N L I B R A R Y R E F E R E N C E
I N D E X
756 F U N C T I O N L I B R A R Y R E F E R E N C E
I N D E X
758 F U N C T I O N L I B R A R Y R E F E R E N C E
I N D E X
760 F U N C T I O N L I B R A R Y R E F E R E N C E
I N D E X
762 F U N C T I O N L I B R A R Y R E F E R E N C E
I N D E X
764 F U N C T I O N L I B R A R Y R E F E R E N C E