LitDev Extension API
LDTextWindow
TextWindow utilities.
Includes low level keyboard events.
Capture | Encoding | Exit |
Hide | KeyDown | KeyUp |
LastKey | Minimise | |
Read | ReadNumber | SendKey |
SetColour | SetColours | Show |
UpdateShowHide |
Capture(fileName,border)
Save the TextWindow as an image file (png, jpg, bmp, gif, tiff or ico).
The window must be visible and a short delay may be required after updating the window before calling.
fileName The file to save the image to (*.png, *.jpg, *.bmp, *.gif, *.tiff or *.ico).
If this is set to "", then the image is created internally as an ImageList.
border Include the window border ("True" or "False").
returns The ImageList image if fileName is "", otherwise if output to a file, then "" is returned.
Encoding
Set extended encoding for the TextWindow.
Allowed values are:
"ASCII" (default), "Unicode", "UTF7", "UTF8"
Exit
Event when TextWindow is closing.
You can perform any final actions here.
Hide()
Completely hide the TextWindow.
Replacement for standard method that may fail if window manually changed by the user.
KeyDown
Low level event when a key is pressed down.
This event is independent of any window focus, i.e. not just for TextWindow or GraphicsWindow.
KeyUp
Low level event when a key is released.
This event is independent of any window focus, i.e. not just for TextWindow or GraphicsWindow.
LastKey
Last key pressed or released.
Minimise()
Minimise the TextWindow.
Print(border)
Print the TextWindow contents.
The window must be visible and a short delay may be required after updating the window before calling.
border Include the window border ("True" or "False").
returns None.
Read(delay)
Read from a TextWindow with a maximum delay.
This sends a Return (ENTER) to the TextWindow after the delay.
If the user presses Return before the delay is completed, then no further action is taken.
delay A maximum delay in ms before the Read is terminated.
returns The text that was read from the TextWindow.
ReadNumber(delay)
Read a number from a TextWindow with a maximum delay.
This sends a Return (ENTER) to the TextWindow after the delay.
If the user presses Return before the delay is completed, then no further action is taken.
delay A maximum delay in ms before the Read is terminated.
returns The number that was read from the TextWindow.
SendKey(window,key)
Send a key to a window. This is the same a typing the key into a window.
window The window title e.g. TextWindow.Title or GraphicsWindow.Title.
key The key to send e.g. "Return"
SetColour(index,colour)
Replace one of the standard TextWindow colours.
There are 16 available colours, by default they are indexed 0 to 15:
Black (0), DarkBlue (1), DarkGreen (2), DarkCyan (3), DarkRed (4), DarkMagenta (5), DarkYellow (6), Gray (7),
DarkGray (8), Blue (9), Green (10), Cyan (11), Red (12), Magenta (13), Yellow (14), White (15).
Note that you can still use TextWindow.BackgroundColor and TextWindow.ForegroundColor to use the new colours (with the original colour names), alternatively the colours can be selected using LDTextWindow.SetColours from the indices.
The colours must be set using either method before they are applied.
index The stanadard colour index colour to replace.
colour Any colour to replace a standard colour with.
SetColours(fgIndex,bgIndex)
Set the current foreground and background colour indices.
fgIndex The foreground colour index (0 to 15).
bgIndex The background colour index (0 to 15).
Show()
Show the TextWindow and give it focus.
Replacement for standard method that may fail if window manually changed by the user.
UpdateShowHide
Also update internal state when using Hide and Minimise methods, "True" (default) or "False".
If the internal state is updated as hidden or minimised, then methods like Read will automatically bring the window into focus.