GetValue
The GetValue function opens a dialog to request a string (or a value). If you click [OK], the entered string is saved to a history list and is returned. The current string is shown in the edit field of the list box. The remaining items in the list box show a history of strings that have been recently used and which may be selected. This function is similar to GetString except that a history list is maintained.
|
|
sStr, bOK = GetValue( s=nil, sPrompt=nil, sTitle=nil, sRegistry=nil, sTooltip=nil )
All arguments are optional and assume default values beyond the last argument you specify. To use a default argument but follow it with a specified argument, use a nil in its place.
This function maintains a history list in the Windows registry. By choosing different names for the sHistory argument, you can have different history lists for different instances of the dialog. If [OK] is clicked, the string is added to the history list and returned as the value sStr.
Although this function returns a string, it can also be used to fetch numbers. After the function returns, the calling module can convert sStr to a number using the Lua function tonumber(). Of course, Lua allows implicit conversion; when a number is needed but a string form of the number exists, Lua will automatically attempt to convert the string to a number.
The window shown above was created using the following code, specifying on the initial value:
|
-- initial value is specified |