Open Object Rexx™: Windows OODialog Reference | ||
---|---|---|
Prev | Chapter 10. Standard Dialogs, External Functions, and Public Routines | Next |
The ooDialog framework provides external functions that can be used as callable functions in your Open Object Rexx programs. These functions are registered automatically when the first dialog is initialized. If no dialog has been created, the programmer must register the functions prior to calling them. An individual function is registered with:
call RxFuncAdd functionname, "oodialog", functionname
To register all the ooDialog functions in this group use:
call RxFuncAdd InstMMFuncs, "oodialog", InstMMFuncs call InstMMFuncs
A more convenient way to call many of these functions is provided by the Public Routines in the ooDialog framework. The public routines do not require that the programmer register any of the external functions. That task is handled transparently by the routine.
Note: The ooDialog framework includes a number of external functions that are not listed here. In general, using the external functions not listed requires a good working knowledge of C and an understanding of the underlying Windows API. Therefore, those functions are not listed. The functions listed in this section are the functions that are convenient and easy to use in an ooRexx program for the general Rexx programmer. They require no understanding of C or the Windows API.
Displays an information message window:
call InfoMessage "some message text" ret = InfoMessage("another text")
See also the public routine InfoDialog.
Displays an error message window:
call ErrorMessage "some error message text" ret = ErrorMessage("another error message")
See also the public routine ErrorDialog.
Displays a message and ask the user for a YES or NO answer:
ret = YesNoMessage("Delete these files?", "No") if ret=1 then /* this is yes */
The second argument is optional and can have a value of either Yes or No. An argument of Yes gives the Yes button the default focus, No gives the No button the default focus. If the argument is omitted the Yes button is given the default focus. Only the first letter of the argument is needed and case is not significant.
See also the public routine AskDialog.
Queries the monitor size in dialog units and pixels:
val = GetScreenSize() parse var val dunitx dunity pixelx pixely
See also the public routine ScreenSize.
Queries a system metric value:
SM_CMONITORS = 80 metric = GetSysMetric(SM_CMONITORS) say 'There are' metric 'monitors connected to this system.'
The public routine, SystemMetrics, provides an easy way to use this external routine without first creating an ooDialog dialog or manually loading the C functions. Check the documentation for the public routine for more detailed information on the system metrics in Windows.
Plays a sound file (.WAV):
call PlaySoundFile "d:\wav\sound.wav" ret = PlaySoundFile("d:\wav\sound.wav","YES")
The optional second parameter YES plays the file asynchronously, that is the program continues execution. See also the public routine Play.
Plays a sound file (.WAV) continuously and asynchronously:
call PlaySoundFileInLoop "d:\wav\sound.wav"
Displays an Open File window:
file = GetFileNameWindow(filename,handle,filter,loadorsave,title, , defExtension,multiSelect,sepChar)
Parameters (optional):
A preselected file name and / or initial directory information.
This argument places a preselected file name in the "File name" field of the file selection dialog. In addition this argument can also be used to specify the initial directory (folder) the dialog opens in.
When this argument contains no path information, then the File name field will contain the argument and the initial directory is determined by the operating system. Which directory the operating system picks varies slightly between Windows 98, Windows NT, Windows XP, etc. But, in general, it will be a directory previously used in one of the Windows common dialogs, or a directory in the users My Documents. (The exact behavior is documented by Microsoft.)
If the argument contains file name and path information, the initial directory will be determined by the path information and the File name field will contain the file information. When the filename argument contains only path information and no file name information, i.e. the argument ends with a back slash ("\"), then the initial directory will be that path and the File name field will be left blank.
In cases where the argument contains incorrect path information the initial directory is determined as if no path information had been supplied and the entire value of the argument is placed in the File name field.
Note: Windows treats normal wild card characters as valid for file names. Therefore, values such as C:\*.* or C:\Windows\*.exe are acceptable for this argument.
The parent window handle.
A file mask specification.
If you specify 1, which is the default, you get the file name for a load operation. If you specify 0, you get the file name for a save operation.
The window title. The default is "Open a File" or "Save File As", depending on what you specify for loadorsave.
The default extension that is added if no extension was specified. The default is TXT.
If you specify 1, you can select several files. In this case, loadorsave must also be 1. The result is then path file1 file2 file3 ....
If you specify 0 or omit this parameter, you get the selected file name or an empty string when the Open File window is canceled.
Specifies which character should be used for separating the file names when multiSelect = 1.
This is needed for file names with blank characters. If this argument is omitted, the separation character is a blank. If the argument is specified, the returned path and file name uses this separation character. For example, if you specify "#" as the separation character, the return string might look as follows:
C:\WINNT#file with blank.ext#fileWithNoBlank.TXT
Example:
"Text files (*.txt)"'0'x"*.TXT"'0'x , "All files (*.*)"'0'x"*.*"
Sleeps for a given time interval, in milliseconds:
call SleepMS(3000) /* 3 seconds */
See also the public routine MSSleep.
Starts, stops, and waits for a windows timer:
tid = WinTimer("START",300) /* 0,3 seconds */ call WinTimer("WAIT,tid) /* wait... */ ret = WinTimer("STOP",tid) /* stop premature */