Foundation 6

Fnd_Gen

44 shared methods.

Fnd_Gen_Alert

Fnd_Gen_Alert (message{; button text})

Displays an alert message. Uses the Foundation Dialog module alert if available.

ParameterTypeDirectionDescription
messageTextinThe alert message text
buttonTextinThe button label (optional)

Fnd_Gen_BugAlert

Fnd_Gen_BugAlert (method{; details{; options}})

Reports a code bug without blocking the caller: a Foundation log entry, a line in the system standard output, and an alert shown by another process so this one carries on.

The alert shows the method and the description only. Diagnostic detail belongs in options.columns, which is logged but not shown.

options.seconds turns the alert into a self-dismissing notification of that many seconds instead of a modal dialog. Pass it from any call site that knows nobody is watching: a modal in an unattended process waits forever, and the compile-check scheduler stops answering behind one. A notification is not guaranteed to be seen - the OS may suppress or silence it - so it buys "will not block", not "will be read".

Fnd_Gen_BugAlert(Current method name; "No number known for \""+$name_t+"\".")
Fnd_Gen_BugAlert(Current method name; "Lookup failed."; {columns: [$module_t; $code_t]})
ParameterTypeDirectionDescription
methodNameTextinMethod name (4D's 'Current method name' function doesn't work in components)
descriptionTextinDetails about the problem (optional)
optionsObjectin{ columns | Collection ; seconds | Integer } extra detail, logged only, and

Fnd_Gen_BugAlert2

Fnd_Gen_BugAlert2 (title; description{; options})

Reports a code bug without blocking the caller. Kept as a name only: Fnd_Gen_BugAlert now does this, and this passes straight through to it.

Prefer Fnd_Gen_BugAlert in new code. This one exists so that the call sites migrated to it between 2026-05-09 and 2026-08-14 keep working, and so that a host calling it is unaffected.

ParameterTypeDirectionDescription
titleTextinShort title, usually Current method name
descriptionTextinShown in the alert and logged
optionsObjectin{ columns | Collection } extra detail, logged only (optional)

Fnd_Gen_ButtonText

Fnd_Gen_ButtonText (->button; text; alignment{; ->obj1..->objN}) --> Number

A replacement for 4D's BUTTON TEXT command.

Sets the button text and resizes the button if necessary. Also moves any adjacent form objects so they stay properly aligned with the modified button.

Due to a bug in 4D 2003.1, this routine won't work properly if the primary button is set as the default button. If this is a problem, UPGRADE!

ParameterTypeDirectionDescription
buttonVariantinA pointer to the button, or its name
textTextinNew button text
alignmentLongintinWhich end to keep stationary (optional)
$4..$NVariantinOther form objects to move, by pointer or by name
ResultLongintoutThe increase in the button size

Fnd_Gen_CanCallHostMethod

Fnd_Gen_CanCallHostMethod --> Boolean

True when EXECUTE METHOD, called from the component, will actually reach the named host method: the method exists and carries "Shared by components and host database". One that exists unshared raises -10508 when called.

Not thread safe, because METHOD Get attribute is not - probe once and cache the answer rather than asking per call.

The name must be literal. METHOD GET NAMES honours the @ wildcard, so a name containing one answers for whatever it happens to match.

ParameterTypeDirectionDescription
methodNameTextinName of the host method
ResultBooleanoutTrue when the method exists and is shared

Fnd_Gen_CancelQuit

Fnd_Gen_CancelQuit

Call this to end Foundation's attempts to quit.

No parameters.

Fnd_Gen_CenterWindow

Fnd_Gen_CenterWindow (width; height{; type{; position{; title{; close box?}}}})

Opens a new window centered on the screen or over the frontmost window (depending on the value of Fnd_Gen_WindowPosition_i).

ParameterTypeDirectionDescription
widthLongintinWidth of the new window
heightLongintinHeight of the new window
inTypeLongintinThe window type (optional)
inPositionLongintinWindow position (optional)
inTitleTextinThe window title (optional)
inHasCloseBoxBooleaninHas a close box (optional)
ResultLongintoutThe window reference number

Fnd_Gen_ComponentAvailable

Fnd_Gen_ComponentAvailable (component name) --> Boolean

Returns true if the component is installed.

ParameterTypeDirectionDescription
componentTextinThe name of the component
ResultBooleanoutTrue if the component is available

Fnd_Gen_ComponentCheck

Fnd_Gen_ComponentCheck (calling component; required component)

Alerts the developer if the specified component isn't available. Then ends execution.

ParameterTypeDirectionDescription
callingComponentTextinThe internal name of the calling component
requiredComponentTextinThe internal name of the required component

Fnd_Gen_ComponentData

Fnd_Gen_ComponentData (->prefixes array{; ->installed versions array{; ->current versions array}})

Modifies the arrays to contain the installed Foundation component prefixes, installed versions, and current versions.

ParameterTypeDirectionDescription
namesArrayPointerinA text array to receive the component prefixes
versionsArrayPointerinA text array to receive the installed component version numbers (optional)
crntVersionsArrayPointerinA text array to receive the current component version numbers (optional)

Fnd_Gen_ComponentInfo

Fnd_Gen_ComponentInfo (component name; info requested) --> Text

Pass this method a component name and name for the information you want. If the component exists, Foundation will call its _Info routine, pass it the info label, and return the result. This allows you to get information from a component in a single call, rather than having to first test to see if the component is available.

If the component isn't installed, "Component Not Available" will be returned.

If the component doesn't have an _Info routine, "Component Did Not Recognize Request" will be returned.

We recommend that if a component doesn't recognize a request it should return the text "Fnd_LabelNotRecognized". This routine will return this response as "Component Did Not Recognize Request".

These values will not be localized so the calling method can test for them.

ParameterTypeDirectionDescription
componentTextinThe component name
requestTextinInfo desired
ResultTextoutResponse from component

Fnd_Gen_CurrentFormType

Fnd_Gen_CurrentFormType ({form type}) --> Number

If no parameters are passed, this method returns the type of the currently displayed form. Pass a form type to set the type of the currently displayed form.

Designed specifically so we can tell if the window is displaying an input form or an output form.

Can be one of these: 0 = Fnd_Gen_NoForm = No window 1 = Fnd_Gen_UnknownForm = Unknown form type 2 = Fnd_Gen_OutputForm = An output form 3 = Fnd_Gen_InputForm = An input form 4 = Fnd_Gen_PreferencesForm = The Preferences window 5 = Fnd_Gen_AboutForm = The About box

ParameterTypeDirectionDescription
inFormLongintinThe form type constant
ResultLongintoutThe form type constant

Fnd_Gen_CurrentTable

Fnd_Gen_CurrentTable ({->table}) --> Pointer

Returns a pointer to the current table. If no table is current, a nil pointer is returned.

Pass a pointer to a table to this routine to make it the current table.

ParameterTypeDirectionDescription
inPointerTableMakePointerinA pointer to the table to make current (optional)
ResultPointeroutThe current table

Fnd_Gen_DummyMethod

Fnd_Gen_DummyMethod

A generic method with no code. This is useful for assigning as the close box method

for new windows (handle the close in the form method) or to use with ON ERR CALL

to disable any automatic reaction to errors.

Deprecated 2026-08-22. Call Fnd_Gen_SilentError instead. The body was always empty, so the two methods were never different. This one served six ON ERR CALL sites and one Open window close box.

No parameters.

Fnd_Gen_FieldIsVisible

Fnd_Gen_FieldIsVisible ( fieldPtr | tableNum {; fieldNum} --> ReturnType

Determines if a field is visible

ParameterTypeDirectionDescription
inFieldPointerinField pointer
inFieldLongintinTable number
inFieldNumberLongintinField number
ResultBooleanoutTrue - the field is visible

Fnd_Gen_FileName

Fnd_Gen_FileName (path) --> Text

Returns the file name from the full pathname.

ParameterTypeDirectionDescription
pathTextinA full pathname
ResultTextoutThe file name at the end of the pathname

Fnd_Gen_FormMethod

Fnd_Gen_FormMethod

Standard form method for non-modal forms.

Handles the close box and quitting the application. Responds to On Activate On Close Box On Outside Call Fnd_Gen_QuitNow Fnd_Wnd_CloseAllWindows

No parameters.

Fnd_Gen_GetArrayWidth

Fnd_Gen_GetArrayWidth (->text array; font; size; style) --> Number

Returns the width required to display the array text given the specified font settings.

Only measures the text - does not take into account the object used to display the text.

Basically this just measures the width of the longest element.

ParameterTypeDirectionDescription
arrayPointerinThe text array to measure
fontNameTextinThe font name
fontSizeLongintinThe font size
fontStyleLongintinThe font style
ResultLongintoutThe width of the longest element

Fnd_Gen_GetDatabaseInfo

Fnd_Gen_GetDatabaseInfo (info type) --> Text

Gets the specified database information value.

Use the Fnd_Gen_SetDatabaseInfo to set this information.

ParameterTypeDirectionDescription
labelTextinThe info type label
ResultTextoutThe value

Fnd_Gen_GetString

Fnd_Gen_GetString (component; internal string{; replace1..replace5})

Calls the Foundation localization routines if they're available. If not, the default English string is returned.

ParameterTypeDirectionDescription
moduleNameTextinThe component's code ("Fnd_xxx")
internalLabelTextinThe lookup code
inReplacementString1_t..$inReplacementString3TextinReplacement strings (optional)
ResultTextoutThe localized string

Fnd_Gen_Info

Fnd_Gen_Info (label) --> Text

Returns requested information. See the Fnd_Gen_ComponentInfo method for more information.

Responds to: version: The current version of the component name: The name of the component minimum_extras_version: The minimum version number of Foundation Extras to compare to the Fnd_Gen_ExtrasVersion constant minimum_extras_version_string: The minimum version number of Foundation Extras as a string compiled: Whether the component itself is running compiled, as the text "True" or "False" (not "1"/"0") — evaluated inside the component, so a host can tell its own compiled state from Foundation's

ParameterTypeDirectionDescription
requestTextinInfo desired
ResultTextoutResponse

Fnd_Gen_IsRunning

Fnd_Gen_IsRunning --> Boolean

True when Foundation is loaded as a component inside a host, rather than being open as a project in its own right.

ParameterTypeDirectionDescription
ResultBooleanoutTrue when running inside a host

Fnd_Gen_LaunchAsNewProcess

Fnd_Gen_LaunchAsNewProcess (method name; process name) --> Boolean

Launches the specified process as a new process. If the process is already

running, it's just brought to the front.

ParameterTypeDirectionDescription
methodNameTextinThe method name to launch
newProcessNameTextinThe name to give the new process
ResultBooleanoutTrue if we're in a new process

Fnd_Gen_Localize

Fnd_Gen_Localize

Passed the localization strings to the General and (if available) Localization components.

No parameters.

Fnd_Gen_MenuBar

Fnd_Gen_MenuBar ({menu bar name})

If the Menu component is installed, it is called to handle the menu bar.

If it's not, nothing happens with the menus.

ParameterTypeDirectionDescription
inMenuBarNameTextinmenu bar name (optional)

Fnd_Gen_Platform

Fnd_Gen_Platform --> Number

Returns the platform number.

Returns 10 if we're running on Mac OS X.

Returns 3 if we're running on Windows.

ParameterTypeDirectionDescription
ResultLongintoutThe platform number

Fnd_Gen_PlugInAvailable

Fnd_Gen_PlugInAvailable (plug-in name) --> Boolean

Returns true if the plug-in is installed. This is done by executing a valid call to the plug-in, then checking to see if 4D set the Error variable to something other than zero.

ParameterTypeDirectionDescription
plugInTextinThe name of the plug-in
ResultBooleanoutTrue if the plug-in is available

Fnd_Gen_PositionR

Fnd_Gen_PositionR (find; string) --> Number

Just like 4D's Position function, but work backwards.

ParameterTypeDirectionDescription
findTextinThe string to find
inStringTextinThe string to search in
ResultLongintoutThe position of the first character

Fnd_Gen_QuitNow

Fnd_Gen_QuitNow ({quit?}) --> Boolean

Returns True if the user wants to quit. Pass True to tell Foundation to do its quit stuff now.

ParameterTypeDirectionDescription
inQuitBooleaninCause Foundation to quit now? (optional)
ResultBooleanoutTrue if it's time to quit

Fnd_Gen_Quitting

Fnd_Gen_Quitting ({$setQuittingStatus_b : Boolean}) --> Boolean

Reports whether the application is shutting down, and optionally sets it.

Getter and setter in one, on the usual Foundation pattern: called with no parameter it reports, called with one it sets and then reports.

ParameterTypeDirectionDescription
setQuittingStatusBooleaninSets the quitting state (optional)
ResultBooleanoutThe state after any change

Fnd_Gen_RequiredHookMethod

Fnd_Gen_RequiredHookMethod (method name)

Creates the specified method in the host database if it doesn't already exist.

If it does already exist and the host is interpreted, its declared parameters and return type are compared with those Foundation now uses. A mismatch is recorded for Fnd_Gen_GeneratedReport. A hook holds the host developer's own code, so it is never rewritten. A hook that declares nothing cannot be compared, as its parameters may be typed in a Compiler_ method; where Foundation passes it parameters or expects a result, it is recorded as left unchanged for the developer to check.

ParameterTypeDirectionDescription
methodNameTextinThe name of the method to create

Fnd_Gen_RequiredHostMethod

Fnd_Gen_RequiredHostMethod (method name)

Creates the specified method in the host database if it doesn't already exist.

If it does already exist and the host is interpreted, the parameter and return types it declares are compared with the current template's. A host copy declared differently is replaced by the template, the previous code kept below as a /* comment */, and the replacement is recorded for Fnd_Gen_GeneratedReport. A copy that differs only in how it is written is left alone, as is any method in a compiled host. A copy that declares nothing cannot be judged, so it is left alone and recorded for the developer to check.

ParameterTypeDirectionDescription
methodNameTextinThe name of the method to create

Fnd_Gen_Reset

Fnd_Gen_Reset

Resets all of the available Foundation components.

No parameters.

Fnd_Gen_RunningInHost

Fnd_Gen_RunningInHost ({running in host?}) --> Boolean

Tells whether Foundation is running as a component inside a host database. With a parameter, records the answer; without one, returns it.

ParameterTypeDirectionDescription
setFnd_Gen_RunningInHostBooleaninTrue when Foundation is a component in a host (optional)
ResultBooleanoutTrue when running in a host

Fnd_Gen_SelectionChanged

Fnd_Gen_SelectionChanged

Call this whenever the current selection of records displayed in the output list changes.

No parameters.

Fnd_Gen_SetDatabaseInfo

Fnd_Gen_SetDatabaseInfo (info type; value)

Sets the specified database information value.

Use the Fnd_Gen_GetDatabaseInfo to retrieve this information.

ParameterTypeDirectionDescription
labelTextinThe info type label
valueTextinThe info value

Fnd_Gen_SetLocalizationStrings

Fnd_Gen_SetLocalizationStrings (component; ->lookup codes; ->strings)

Called from the Fnd_xxx_Localize method of other components to pass their localization info to this, and (if available) the Localization component.

ParameterTypeDirectionDescription
componentTextinThe component's code ("Fnd_xxx")
lookupCodesArrayPointerinArray of lookup codes
stringsArrayPointerinArray of localized strings

Fnd_Gen_SilentError

Fnd_Gen_SilentError

A method with no code. Foundation's single no-op, for the two places one is wanted: swallowing an error, and satisfying a parameter that demands a method name but has nothing to do.

As an error handler, install it with ON ERR CALL around a call that is expected to fail and whose failure is not interesting, then restore the previous handler immediately:

$oldHandler_t:=Method called on error
ON ERR CALL("Fnd_Gen_SilentError")
...the call that may fail...
ON ERR CALL($oldHandler_t)

Leaving it installed suppresses every subsequent error in the process, including the ones that matter, so the restore is not optional.

As a close box method, pass its name to Open window when the close is handled in the form method:

$windowRef_i:=Open window($l; $t; $r; $b; $type_i; $title_t; "Fnd_Gen_SilentError")

No parameters.

Fnd_Gen_TableIsVisible

Fnd_Gen_TableIsVisible (Table pointer or number) --> Boolean

Returns TRUE if table $1-> is visible

ParameterTypeDirectionDescription
tablePointerinthe pointer to a table OR table number
ResultBooleanoutTrue = Visible table

Fnd_Gen_TableOf

Fnd_Gen_TableOf (table pointer) --> field pointer

Returns a pointer to the table that the field passed in belongs to

ParameterTypeDirectionDescription
fieldPointerinA field Pointer
ResultPointeroutThe table the field belongs to

Fnd_Gen_ToolbarDisplayed

Fnd_Gen_ToolbarDisplayed --> Boolean

Returns true if the design toolbar is visible

ParameterTypeDirectionDescription
ResultBooleanoutDescription

Fnd_Gen_UIWorker

Fnd_Gen_UIWorker --> $worker_v : Variant

Returns the identifier of the UI worker every Foundation UI message is dispatched to — the host's "UI Process" hook value when one exists, otherwise "$Fnd_UI". Pass the result straight to CALL WORKER.

ParameterTypeDirectionDescription
ResultVariantoutThe UI worker's process name (Text) or process number (Integer)

Fnd_Gen_VerifyStructureItem

Fnd_Gen_VerifyStructureItem (component; table or field name; field type{; indexed}) --> Pointer

Makes sure the required field exists. If not, the developer is notified.

ParameterTypeDirectionDescription
componentText :The component prefixin
fieldNameTextinThe required table or field name
inFieldTypeLongintinThe expected field type
inIndexedBooleaninThe field should be indexed? (optional)
ResultPointeroutA pointer to the field

Fnd_Gen_WaitToContinue

Fnd_Gen_WaitToContinue (boolean)

Causes a process to wait

ParameterTypeDirectionDescription
ResultBooleanoutwhether or not to wait Added by Walt Nelson on 2/19/10