Common Desktop Environment: Desktop KornShell User's Guide

Functions and Callbacks

script_find has the following functions and callbacks:

PostErrorDialog()

This function is called when an error is detected, such as when the user enters an invalid directory. The function calls the convenience function DtkshDisplayErrorDialog() which displays a dialog box whose title is Find Error and whose message is contained in the variable $1, which is passed from the calling location.

dialogPostErrorDialog()
{
			DtDisplayErrorDialog "Find Error" "$1" \     
			DIALOG_PRIMARY_APPLICATION_MODAL }

The last parameter, DIALOG_PRIMARY_APPLICATION_MODAL, tells dtksh to create a dialog that must be responded to before any other interaction can occur.

OkCallback()

OkCallback() is called when either the OK or Apply button on the main script_find window is pressed. If the OK button is pressed, the script_find window is unmanaged. For either Apply or OK, the input search directory is validated; if it is invalid, then OkCallback() calls PostErrorDialog(). If it is valid, checks are made on the status of the toggle buttons on the script_find window and corresponding adjustments are made to the variable $CMD. This variable contains the entire command that is ultimately executed.

LoadStickyValues()

This function is called from the main program after the window has been created and managed. It loads all the values from the most recent execution of the script. These values are saved in a file called Find.sticky by the function RetrieveandSaveCurrentValues().

EvalCmd()

EvalCmd() is used by LoadStickyValues() to evaluate each line in Find.sticky as a dtksh command. The following is a list of a Find.sticky file:

XmTextSetString $SD "/users/dlm" 
XmTextFieldSetInsertionPosition $SD 10 
XmTextSetString $FNP "two_letter_calls" 
XmTextFieldSetInsertionPosition $FNP 16 
XtSetValues $FSTYPE menuHistory:$NODIR 
XtSetValues $FILETYPE menuHistory:$NOTYPE 
XmToggleButtonSetState $T2 true false 
XmToggleButtonSetState $T4 true false

RetrievAndSaveCurrentValues()

RetrieveAndSaveCurrentValues() retrieves the current settings and values of the widgets in the script_find window and saves them in the file Find.sticky. Find.sticky is then used by LoadStickyValues() the next time the script is executed.