style can be one of ...
Example
Beep( MB_ICONEXCLAMATION )
See Also: FormatMsg, getOpt, getRandInt, makeStandardName, setContainer, setUserLanguage, UseText
This searches the current messages file (see setContainer ) for the text code in the current language category (see setUserLanguage ) and when found the function uses it as a template with formatting codes in it.
pTextCode is either the code (an integer) to search for in the messages file, or
a message template.
pData is either a single string or a sequence of strings.
Example:
Assume you have the following messages file ...
[english] 1 = File '%1' not found in folder '%2' 2 = Record ID '%1' not found 3 = Record ID '%1' already exists 9 = Internal error: Code '%1'.
Then we can call this function thus ...
sequence lText lText = FormatMsg(1, {"link.opt", "c:\\temp\\"} ) -- returns "File 'link.opt' not found in folder 'c:\temp\'" lText = FormatMsg(3, "djp") -- returns "Record ID 'djp' already exists" lText = FormatMsg("%1 %3, %2", {"Mr", "Derek", "Parnell"}) -- returns "Mr Parnell, Derek"
See Also: Beep, getOpt, getRandInt, makeStandardName, setContainer, setUserLanguage, UseText
pSource is the name of a text file in which the data can be found.
pCategory is the name of a category, or grouping, found in pSource. The catgories are coded
in the file in the form "[" category "]" as the only thing in a line.
pKey is the key that will be searched for in the category. If found the associated string
will be returned otherwise pDefault is returned.
pDefault is a string to be returned if the key is not found in the file.
Note that the category and key are not case sensitive.
If the associated data can be converted to a Euphoria atom it will be, otherwise it will be returned as a text string. With the exception that the strings "yes", "true", "on" will be returned as the integer 1 (one), and the strings "no", "false", "off" will be returned as the integer 0 (zero). If you actually need any of these strings to be returned verbatim then enclose them in quotes in the file.
If the associated text contains "\n" or "\t" these are replaced with 10 (newline) and 9 (tab) respectively.
The associated data can span multiple lines. This done by simply
Example:
Assume we have an options file, App.Ini, containing the following lines ...
[COMMS] Baud=9600 Stop=1 Bits=7 Parity=Odd AutoConnect=yes ACKResponse="yes" Welcome= "Application V1.0\n" "Welcome to my application.\n" "(c) 2004 HardMacro"[COLOR] Background = White Text = Black Highlight = Blue Selection = Pink
[LIMITS] Files = 10 DBSize = 1024MB
then we could call this routine ...
object lRes lRes = getOpt("App.Ini", "color", "text", "Gray") -- Returns "Black" lRes = getOpt("App.Ini", "comms", "autoconnect", "no") -- Returns 1 lRes = getOpt("App.Ini", "comms", "ACKResponse", "none") -- Returns "yes" lRes = getOpt("App.Ini", "comms", "Parity", "even") -- Returns "Odd" lRes = getOpt("App.Ini", "comms", "CRC", "yes") -- Returns "yes" lRes = getOpt("App.Ini", "User", "ID", -1) -- Returns -1 lRes = getOpt("App.Ini", "limits", "files", -1) -- Returns 10 lRes = getOpt("App.Ini", "limits", "connections", 4) -- Returns 4 lRes = getOpt("App.Ini", "comms", "welcome", "") -- Returns ... Application V1.0 Welcome to my application. (c) 2004 HardMacro
See Also: Beep, FormatMsg, getRandInt, makeStandardName, setContainer, setUserLanguage, UseText
This uses the cryptographic routines built into Windows. It gathers entropy from various sources in between calls and thus you cannot seed this generator to produce a known stream of numbers.
pMin and pMax are limited to 32-bit integer values.
Example:
integer guess Get a random number between 4 and 19. guess = getRandInt(4, 19)
See Also: Beep, FormatMsg, getOpt, makeStandardName, setContainer, setUserLanguage, UseText
Name is any string. It is converted to a standard form by removing any characters that are not alphanumeric, except that the first character can only be alphabetic or the underscore character.
Example:
sequence lName lName = makeStandardName("Customer Dialog #1") -- This should return "CustomerDialog1"
See Also: Beep, FormatMsg, getOpt, getRandInt, setContainer, setUserLanguage, UseText
Initially the language is set to "msgs.ini". You would use this if the messages file containing the text has a different name or is on a different path.
pNew is the name and path of the file that will be searched by UseText.
Example:
sequence lOld lOld = setContainer( "Application\\Data\\Message.Text" )
See Also: Beep, FormatMsg, getOpt, getRandInt, makeStandardName, setUserLanguage, UseText
Initially the language is set to "english". You would use this if the messages file contained other language catgories.
pNew is the category that will be searched by UseText in the messages file.
Example:
sequence lOld lOld = setUserLanguage( "thai" ) -- Note that the category can be anything. lOld = setUserLanguage( "geek jargon" )
See Also: Beep, FormatMsg, getOpt, getRandInt, makeStandardName, setContainer, UseText
This searches the current messages file (see setContainer ) for the text code in the current language category (see setUserLanguage ) and when found returns the associated text string.
Example:
Assume you have the following messages file ...
[english] 0 = Okay 1 = File not found 2 = Record not found 3 = Record already exists 9 = Internal error. UM = Unit of Measure KG = Kilogram
Then we can call this function thus ...
sequence lText lText = UseText(0, "") -- returns "Okay" lText = UseText(9, "") -- returns "Internal error." lText = UseText("KG", "kilo") -- returns "Kilogram"
See Also: Beep, FormatMsg, getOpt, getRandInt, makeStandardName, setContainer, setUserLanguage