osd-dialog - OSD dialog box
osd-xdialog - OSD Extended dialog box
osd-entry - OSD entry dialog box
n osd-dialog "title" "prompt" [ "x-pos" "y-pos" ] "but1"
n osd-xdialog "title" "prompt" default [ "x-pos" "y-pos" ]
osd-dialog constructs a OSD dialog prompt with a title string title, a prompt string within the dialog of prompt. A single button, with text rendering but1, is placed within the dialog. The dialog remains on the screen until the button is selected or the user aborts.
osd-xdialog creates an extended dialog with multiple buttons similar to osd-dialog, the number of buttons created (#) is determined from the number of but arguments. The default integer argument specifies the default button (1..#), a value of 0 specifies that there is no default button.
The commands return the button pressed in the variable $result(5).
osd-entry constructs a simple OSD entry dialog which prompts the user to type in a value. The value of the supplied variable is used as an initial entry value, the variable is set to the entered value when the user presses the "Okay" button but remains unchanged if the user Cancel or aborts.
The size of the entry defaults to 30 characters if not specified by the user, when a size parameter is given it can take one of two forms, either simply "w" specifying the width, the height defaulting to 1, or "wxh" (i.e. "40x5") specifying both. The last optional argument type sets the type of value being entered (e.g. file name, buffer name, etc) see flag h on the help page for @ml(4) for a list of entry types and the numerical value to be supplied.
The argument n can be used to change the default behavior of the commands described above, n is a bit based flag where:-
0x01
0x02
A simple query dialog is typically constructed using osd-dialog, as follows:-
!if &seq %osd-search-str "" osd-dialog "Replace" "Error: Search string is empty!" " &OK " !return !endif
The following example uses multiple buttons within a single dialog, using osd-xdialog, as follows:-
0 define-macro osd-close !if &bmod "edit" set-variable #l0 &spr "Buffer \"%s\" changed" $buffer-bname osd-xdialog "Buffer Close" #l0 1 "&Save First" \ "&Loose Changes" "&Cancel" !if &equ $result 3 !abort !elif &equ $result 2 -1 buffer-mode "edit" !else !if &seq $buffer-fname "" !nma write-buffer !else !nma save-buffer !endif !endif !endif delete-buffer $buffer-bname @mna !emacro
The next example macro can be used to change the value of a user variable to a user supplied file name:
set-variable %source-root "~/" define-macro set-source-root osd-entry "Source Root" "&Path : " %source-root 35 1 !emacro
osd-dialog, osd-xdialog and osd-entry are macros defined in osd.emf, using osd(2) to create the dialog.
(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12