man page(1) manual page
Table of Contents

NAME

Fx_Menubar - Build a menubar with the default buttons and menus.

SYNOPSIS

Fx_Menubar itcl_instancename -w window -schema schema_desc

DESCRIPTION

Fx_Menubar builds a menubar with all the standard options and menus.

OPTIONS

-schema schema_desc
Sets the schema descriptor (returned by qddb_schema open) to schema_desc for all menubar operations. This option is mandatory.

-w frame_path
Use the Tk window path frame_path when creating the frame for the entry and its buttons/label. This option is mandatory.

-array arrayname
Specifies the array name to use when entering any of the modes. Each attribute declared with Fx_Entry will be bound to arrayname(attributename). The default name for the array is gv_attr.

-restrict directory
Restricts all configuration files and templates to a particular directory. Typically, this is the same application-specific directory given by the -restrict option to Fx_Frame. The directory need not exist, but some ancestor must be writable by the user. The user is constrained to the Templates subdirectory for template access and the :search_results: subdirectory for search results configurations.

-auto_clear 0|1
Turns on or off the "Auto-clear" option. This overrides the user's configuration.

-auto_save 0|1
Turns on or off the "Auto-save" option. This overrides the user's configuration.

-beforechangemode
list Evaluate list before entering Change Mode. You should be careful when using this option.

-afterchangemode
list Evaluate list after entering Change Mode.

-beforereadonlymode
list Evaluate list before entering Read-only Mode. You should be careful when using this option.

-afterreadonlymode
list Evaluate list after entering Read-only Mode.

-beforesearchmode
list Evaluate list before entering Search Mode. You should be careful when using this option.

-aftersearchmode list
Evaluate list after entering Search Mode.

-beforeaddmode list
Evaluate list before entering Add Mode. You should be careful when using this option.

-afteraddmode list
Evaluate list after entering Add Mode. This is useful for adding default values.

-beforetupledelete list
Evaluate list before deleting the tuple. Useful for inserting custom dialogs. Defaults to: { if {[tk_dialog .dialog "RECORD DELETION PENDING" \ "Are you SURE you want to delete this record? \ Click on OK to proceed, Cancel to cancel." \ warning 0 Cancel OK] == 0} { return } }

-beforeimport list
Evaluate list before importing records from an external format via File-Import.

-afterimport list
Evaluate list after importing records from an external format via File-Import.

-beforequit list
Evaluate list before closing the schema. Useful for custom checking or exit cleanup.

-afterquit list
Evaluate list after closing the schema. Useful for custom checking or exit cleanup.

-exitproc list
Evaluate list to exit the program. Defaults to "exit 0". Useful for adding your own exit procedures.

-beforesave list
Evaluate list before saving the tuple. Useful for custom checking.

-aftersave list
Evaluate list after saving the tuple. Useful for custom mode switching.

-beforeclear list
Evaluate list before clearing a tuple via Edit/Clear in Add Mode.

-afterclear list
Evaluate list after clearing a tuple via Edit/Clear in Add Mode.

-aftersearch list
Evaluate list after performing a search and filling the last search results internal variable. Can be used in conjunction with -search_results 0 and Get_LastSearch to build a custom way of displaying the Search Results.

-config_dir directory
Default location of the user's personal configuration. Defaults to .fx_config. Always prefixed by ~/. You must also set the global variable fx_config_dir to the same value before calling Fx:Init.

-searchfor 0|1
Defines whether to show the "Search for:" entry box. Defaults to 1.

-modebar 0|1
Defines whether to show the mode bar (showing which mode you are in). Defaults to 1.

-statusbar 0|1
Defines whether to show the status bar (showing miscellaneous messages). Defaults to 1.

-menubar 0|1
Defines whether to show the main menubar. Defaults to 1.

-force_readonly_mode 0|1
If 1, forces Read-only Mode instead of Change Mode; otherwise, allows entry into Change Mode. Defaults to 0.

-instances list
Defines a list of Fx_Entry instances associated with this menubar. Must be specified with the configure method after all Fx_Entry instances have been created.

-frames list
Defines a list of Fx_Frame instances associated with this menubar. Must be specified with the configure method after all Fx_Frame instances have been created.

-auxbuttons list
Defines a list of menubuttons to pack after the View menubutton. This option provides a convenient mechanism for inserting new menubuttons into the standard Fx menubar.

-mode_variable variable_name
Specifies the -textvariable option for the mode label. Defaults to fx:mode_variable. Probably should not be changed.

-status_variable variable_name
Specifies the -textvariable option for the status label. Defaults to fx:status_variable. Probably should not be changed.

-searchfor_variable variable_name
Specifies the -textvariable option for the searchfor entry. Defaults to fx:searchfor_variable. Probably should not be changed.

-search_results 0|1
Specifies whether to display the last search results when the user performs a search or when selecting View Last Search Results. Defaults to 1.

-afterpost_file list
Evaluate list after posting the File menu. Allows changing the default stippling.

-afterpost_edit list
Evaluate list after posting the Edit menu. Allows changing the default stippling.

-afterpost_modes list
Evaluate list after posting the Modes menu. Allows changing the default stippling.

-afterpost_view list
Evaluate list after posting the View menu. Allows changing the default stippling.

-afterpost_templates list
Evaluate list after posting the Templates menu. Allows changing the default stippling.

tearoffs 0|1
Tk 4.0 only! Specifies whether the standard Fx_Menubar menus are tear-off menus. You should not manually override any standard Fx_menubar menu's -tearoff value. All menus should be the same for consistency. If you add your own menus to the menubar, you should specify the -tearoff option to the Tk menu command.

MISC. PUBLIC VARIABLES

There are several useful public variables for the Fx_Menubar itcl_class. These variables may be read with instance info public varName -value.

schema Contains the current schema descriptor.

tuple Contains the current tuple descriptor.

view
Contains the current view descriptor.

OPTION NOTES

The mode variable (fx:mode_variable) must be one of Search Mode, Add Mode, Change Mode, or Read-only Mode. Fx uses the mode variable to determine what mode it is in, so you must take care when modifying this variable (actually, you probably shouldn't attempt to do it at all).

METHODS

configure options
Reconfigure the instance with the specified options.

DisplayLastSearch
Displays the results of the last search in a listbox.

KillLastSearch
Kills the results of the last search so that it cannot be displayed.

GetLastSearch
Returns the last non-empty results of a search. This list is in the format returned by a call to qddb_rows select -format table.

SetLastSearch list
Sets the results of the last search to the specified list. This list must be a list returned by a call to
qddb_rows select -format table.

LastSearchWasNull
Returns 1 if the last search returned an empty set or the query was empty; returns 0 otherwise. This is useful to check whether the list returned by GetLastSearch is from the most recent search (generally in -aftersearch lists). GetLastSearch returns the last non-empty search results.

SearchModeProc
Enters Search Mode after checking whether the current tuple has been modified. Sets the mode variable to "Search Mode".

ChangeModeProc index
Enters Change Mode with the tuple located at the index specified by index in the list of last search results. Checks to see if the current tuple has been modified first. Locks the tuple for writing if possible; if the tuple is already locked for writing by another process, ChangeModeProc will enter Read-only Mode. Sets the mode variable to "Change Mode".

ReadOnlyModeProc index
Enters Read-only Mode with the tuple located at the index specified by index in the list of last search results. This command releases the lock if the tuple was in change mode. Sets the mode variable to "Read-only Mode".

AddModeProc
Enters Add Mode after checking whether the current tuple has been modified. Sets the mode variable to "Add Mode".

SearchProc
Performs a search based on the contents of the variable specified by -searchfor_variable and

-searcharrayname.
The search is the logical intersection of the contents of each variable. Sets the mode variable to "Search Mode".

ClearProc
Clear the viewed tuple; must be in "Add Mode" or "Search Mode".

SaveProc
Save the current tuple; must be in "Change Mode" or "Add Mode".

QuitProc
Quit after checking the need to save the current tuple. If the current tuple has been modified, the user will be given the opportunity to save it.

GLOBAL VARIABLES

Several global variables are available for setting miscellaneous messages and values. Fx uses variables of the form fx:MODE_modeval to determine the current mode. Variables of the form fx:MODE_statusval are informational messages placed in the status line when entering MODE.

fx:search_modeval
Set the value of the mode line to "${fx:search_modeval}" whenever entering Search Mode. The default is "Search Mode".

fx:add_modeval
Set the value of the mode line to "${fx:add_modeval}" whenever entering Add Mode. The default is "Add Mode".

fx:change_modeval
Set the value of the mode line to "${fx:change_modeval}" whenever entering Change Mode. The default is "Change Mode".

fx:readonly_modeval
Set the value of the mode line to "${fx:readonly_modeval}" whenever entering Read-only Mode. The default is "Read-only Mode".

fx:search_statusval
Set the value of the status line to "${fx:search_statusval}" whenever entering Search Mode. The default is "Ready to search".

fx:add_statusval
Set the value of the status line to "${fx:add_statusval}" whenever entering Add Mode. The default is "Ready to add new record".

fx:change_statusval
Set the value of the status line to "${fx:change_statusval}" whenever entering Change Mode. The default is "Ready to modify record".

fx:readonly_statusval
Set the value of the status line to "${fx:readonly_statusval}" whenever entering Read-only Mode. The default is "Modifications not allowed".

TK WIDGETS

Fx_Menubar builds a set of predefined menubuttons in the frame specified with -w (say .mb). These are: (1) file (File), (2) edit (Edit), (3) modes (Modes), (4) view (View), (5) config (Configure) and (6) help (Help). The individual menus can be augmented by accessing the menubutton name plus menu. For example:
.mb.help.menu add command -label "Do Something"
-command "DoSomething"

NOTES

You must specify --with-itcl when configuring Qddb to install the Fx toolkit. Fx depends on [Incr Tcl]. The busy cursor depends on BLT (configure with --with-blt).

SEE ALSO

Fx_Entry(n), Fx_Frame(n), Fx_Print(n), Fx_QddbSearchParser(n), Fx(n)

REFERENCES

A Guide to QDDB
Eric H. Herrin II and Raphael A. Finkel

Qddb User's Guide

An ASCII Database for Fast Queries of Relatively Stable Data Eric H. Herrin II and Raphael A. Finkel Computing Systems, Volume 4 Number 2
University of California Press, Berkeley CA

Schema and Tuple Trees: An Intuitive Structure for Representing Relational Data
Eric H. Herrin, II and Raphael A. Finkel Computing Systems, Volume 9, Number 2
MIT Press, Cambridge MA

TCL and the TK Toolkit
John K. Ousterhout
Addison-Wesley, 1994
ISBN 0-201-63337-X

DIAGNOSTICS

BUGS

None known.


Table of Contents