[Fluent Inc. Logo] return to home search
next up previous contents index

3.5 Text Menu Input from Character Strings

Often, when writing a Scheme extension function for FLUENT, it is convenient to be able to include menu commands in the function. This can be done with ti-menu-load-string. For example, to open graphics window 1, use

(ti-menu-load-string "di ow 1")
A Scheme loop that will open windows 0 and 1 and display the front view of the grid in window 0 and the back view in window 1 is given by

 (lambda (window view)
   (ti-menu-load-string (format #f "di ow ~a gr view rv ~a"
				window view)))
 '(0 1)
 '(front back))
This loop makes use of the format function to construct the string used by menu-load-string. This simple loop could also be written without using menu commands at all, but you need to know the Scheme functions that get executed by the menu commands to do it:

 (lambda (window view)
   (cx-open-window window)
   (cx-restore-view view))
 '(0 1) '(front back))

String input can also provide an easy way to create aliases within FLUENT. For example, to create an alias that will display the grid, you could type the following:

(alias 'dg (lambda () (ti-menu-load-string "/di gr")))
Then any time you enter dg from anywhere in the menu hierarchy, the grid will be drawn in the active window.


ti-menu-load-string evaluates the string argument in the top level menu. It ignores any menu you may be in when you invoke ti-menu-load-string.

As a result, the command

(ti-menu-load-string "open-window 1 gr")    ; incorrect usage
will not work even if you type it from within the display/ menu--the string itself must cause control to enter the display/ menu, as in

(ti-menu-load-string "display open-window 1 grid")

next up previous contents index Previous: 3.4.2 System Commands for
Up: 3. Text User Interface
Next: 3.6 Using the Text
© Fluent Inc. 2006-09-20