User Input and Output Functions. Source Dynamics Source Insight 4.0
تبلیغات
تبلیغات
User Input and Output Functions
islower (ch)
Returns TRUE if the given character ch is lowercase. If ch is a string with more than one character, only the first character is tested.
IsNumber (s)
Returns TRUE if the string s contains a numeric string. Non numeric strings cause a run-time error when used in arithmetic expressions.
isupper (ch)
Returns TRUE if the given character ch is uppercase. If ch is a string with more than one character, only the first character is tested.
strlen (s)
Returns the length of the string.
strmid (s, ichFirst, ichLim)
Returns the middle string of s in the range from ichFirst up to, but not including ichLim. That is, s[ichFirst] through s[ichLim - 1]. If ichFirst equals ichLim, then an empty string range is specified.
strtrunc (s, cch)
Returns string s truncated to cch count of characters.
tolower (s)
Returns the lowercase version of the given string.
toupper (s)
Returns the uppercase version of the given string.
User Input and Output Functions
User input and output functions allow you to get input from a user, or display output in a message window.
Ask (prompt_string)
Prompts the user with a message box window displaying the string prompt_string. The Ask message box has an OK button, and a Cancel button. Clicking the Cancel button stops the macro.
AssignKeyToCmd(key_value, cmd_name)
Assigns the key_value to command named by cmd_name. Subsequently, when the user presses the key_value, the command is invoked.
key_value is a numeric keyboard value that is returned by GetKey and KeyFromChar. You can use CharFrom-
Key to convert a key_value into a character.
cmd_name is the string name of the command.
384 Source Insight 4 User Guide
User Input and Output Functions
Example: key = GetKey();
AssignKeyToCmd(key, "Open Project");
Beep ()
Gives a single beep.
CharFromKey (key_code)
Returns the character associated with the given key code. Returns zero if the key_code is not a regular character key code.
key_code is a numeric keyboard value that is returned by GetKey and KeyFromChar. You can use CharFrom-
Key to convert a key_code into a character.
CmdFromKey(key_value)
Returns the string name of the Source Insight command currently mapped to key_value. The command returned is the name of the command that gets invoked when the user presses key_value.
key_value is a numeric keyboard value that is returned by GetKey and KeyFromChar.
You can use CharFromKey to convert a key_value into a character.
Example: key = GetKey(); cmd_name = CmdFromKey(key); msg("That key will invoke the @cmd@ command.");
EndMsg ()
Takes down the message box started by StartMsg.
FuncFromKey (key_code)
Return the function key number (1 - 12 for F1 - F12) from a function key code. Returns zero if key_code is not a function key code.
key_code is a numeric keyboard value that is returned by GetKey and KeyFromChar. You can use CharFrom-
Key to convert a key_code into a character.
GetChar ()
Waits for the user to press a key and returns a single character.
GetKey ()
Waits for the user to press a key and returns the key code. The key code is a special numeric value that Source
Insight associates with each key. You can use the CharFromKey function to map a key code into a character.
GetSysTime(fLocalTime)
If fLocalTime is non-zero, then the local time is returned, otherwise the system time (expressed in Coordinated Universal Time (UTC)) is returned.
IsAltKeyDown (key_code)
Returns TRUE if the ALT key is down for key_code. key codes contain the CTRL and ALT key state.
key_code is a numeric keyboard value that is returned by GetKey and KeyFromChar. You can use CharFrom-
Key to convert a key_code into a character.
Source Insight 4 User Guide 385
User Input and Output Functions
IsCtrlKeyDown (key_code)
Returns TRUE if the CTRL key is down for key_code. key codes contain the CTRL and ALT key state.
key_code is a numeric keyboard value that is returned by GetKey and KeyFromChar. You can use CharFrom-
Key to convert a key_code into a character.
IsFuncKey (key_code)
Returns TRUE if key_code is a function key, or FALSE if not.
key_code is a numeric keyboard value that is returned by GetKey and KeyFromChar. You can use CharFrom-
Key to convert a key_code into a character.
KeyFromChar(char, fCtrl, fShift, fAlt)
Returns a key value, given a character and modifier key states. A key value is a numeric keyboard value that is returned by GetKey. You can use CharFromKey to convert a key value into a character.
Inputs: char - the character part of the keystroke. It is not case sensitive.
fCtrl - non-zero if the CTRL key is included. fShift - non-zero if the Shift key is included. fAlt - non-zero if the ALT key is included.
The char parameter can have some special values:
Table 5.6: "char' Parameter Values and Their Meanings
Char Value
a-z
Fx
Nx
Up, Down, Left, Right
Page Up, Page Down
Insert, Delete
Home, End,
Tab, Enter
Meaning
Simple alpha characters
Function Key number x; e.g. F10
Numeric keypad character x; e.g. N+ for "+" key
Arrow keys
Other special keys
Examples of Key Assignments
:
// assign Ctrl+C to Page Down command: key = KeyFromChar("c", 1, 0, 0); // Ctrl+C
AssignKeyToCmd(key, "Page Down");
// assign F9 to Close Project command: key = KeyFromChar("F9", 0, 0, 1); // Alt+F9
AssignKeyToCmd(key, "Close Project");
386 Source Insight 4 User Guide
دانلود
تبلیغات