next up previous contents
Next: 3.6 Putting it all Up: 3 Custom Programming Previous: 3.4 Using Tcl libraries

3.5 Common Fx settings and functions

Most Fx settings and functions are built into Fx_Menubar. Almost all the menu buttons, menu items, and modes can be modified for any particular application at runtime. Table 3.1 lists the common settings and Table 3.2 lists the common Fx_Menubar functions used by most applications. For a complete list, see the Fx_Menubar(n) manual page.

Options can be set or retrieved with configure and cget, respectively. For example:

    menubar configure -auto_clear 1 -force_readonly_mode 1
    puts "autoclear: [menubar cget -auto_clear]"
    puts "readonly:  [menubar cget -force_readonly_mode]"

Fx_Menubar functions are called using the ``menubar'' command:

    proc MyApp:GetCode {{code 42}} {
        global gv_attr

        menubar SearchModeProc ;# go to Search Mode
        menubar ClearProc      ;# clear array
        set gv_attr(Items.Code) $code
        menubar SearchProc     ;# search and display results
    }

  

OptionAction
-auto_clear 0|1 autoclear entries for search/add modes
-auto_save 0|1 automatically save tuples when necessary
-force_readonly_mode 0|1 don't allow change mode on any tuple
-menubar 0|1 show the menubar
-searchfor 0|1 show the generic ``search for:'' entry
-modebar 0|1 show the mode bar
-statusbar 0|1 show the status bar
-auxbuttons list set extra menubuttons
-beforechangemode list eval list before entering ``Change Mode''
-afterchangemode list eval list after entering ``Change Mode''
-beforeaddmode list eval list before entering ``Add Mode''
-afteraddmode list eval list after entering ``Add Mode''
-beforesearchmode list eval list before entering ``Search Mode''
-aftersearchmode list eval list after entering ``Search Mode''
-beforereadonlymode list eval list before entering ``Read-only Mode''
-afterreadonlymode list eval list after entering ``Read-only Mode''
-beforetupledelete list eval list before entering deleting a tuple
-beforesave list eval list before saving a tuple
-aftersave list eval list after saving a tuple
-beforequit list eval list before starting exit checks
-afterquit list eval list after starting exit checks
-exitproc list eval list as the exit procedure
-beforeclear list eval list before clearing a tuple
-afterclear list eval list after clearing a tuple
-tearoffs 0|1 use Tk tearoffs for menus
-afterpost_file list eval list after posting File menu
-afterpost_edit list eval list after posting Edit menu
-afterpost_modes list eval list after posting Modes menu
-afterpost_view list eval list after posting View menu
-afterpost_templates list eval list after posting Template menu

Table 3.1: Common Fx_Menubar options

  

Function Action
DisplayLastSearch display last search results
KillLastSearch kill last search results
GetLastSearch returns qddb_table as returned by
qddb_rows select -format table
SetLastSearch list list must be a qddb_table as returned by
qddb_rows select -format table
LastSearchWasNull returns 1 if last search returned no entries, 0 otherwise
SearchModeProc go into search mode
ChangeModeProc index go into change mode using tuple at index
row of the last search results table
ReadOnlyModeProc index go into read-only mode using tuple at index
row of the last search results table
AddModeProc go into add mode
SearchProc search using contents of the global attribute array gv_attr
ClearProc clear the screen in search or add mode
SaveProc save the currently viewed tuple
QuitProc exit the application

Table 3.2: Common Fx_Menubar functions



Herrin Software Development, Inc.