The top-level object of the TextWindow UCX component. Used for retrieving information about text windows.
Sets or returns the background color of the text window.
object.BackColor[=ColorConstant As Constant]
Integer.
Read/write.
ColorConstant is an optional parameter that sets the background color of the text window. Either the integer value or the constant name can be given. See Section A.3, Background Color Constants.
See example in Example for setting the background color of the text window to Red.
Returns the Cursor object.
object.Cursor
Cursor.
Read-only.
This example sets the back ground color and the foreground color of the textwindow and the input fields and displays the specified text in the set cursor position.
’Displays the given text at the set cursor position
’Sets the coordinates of the text window
Win.Define(5, 20, 10, 60)
’Sets the background color of the text window
Win.BackColor = WIN_BG_RED
’Sets the foreground color of the text window
Win.ForeColor = WIN_FG_YELLOW
’Sets the background color of the input field
Win.InputBackColor = WIN_BG_CYAN
’Sets the foreground color of the input field
Win.InputForeColor = WIN_FG_WHITE
’Defines the title of the text window
Win.Title = "Unbelievably Great Window!"
’Wraps the displayed strings
Win.TextWrap = FALSE
’Sets the current window to be visible
Win.Visible = TRUE
’Defines the cursor for the text window
Set cursor = Win.Cursor
’positions the cursor
cursor.MoveTo(2,10)
’displays the given text
Win.TextOut("Make it a great day")
cursor.MoveTo(3,10)
Win.TextOut("for you and yours")
’Displays the window for 1000 mSecs
Wait 1000
’Clears the 3rd row of the window
Win.Clear(3)
Wait 1000
’Closes the window
Win.Close()
Sets or returns the foreground color of the text window.
object.ForeColor[=ColorConstant As Constant]
Integer.
Read/write.
ColorConstant is an optional parameter that sets the foreground color of the text window.Either the integer value or the constant name can be given. See Section A.14, Foreground Color Constants.
See example in Example to set the foreground color of the text window to yellow.
Sets or returns the background color of the input fields defined by the DefineInputs method.
object.InputBackColor[=ColorConstant As Constant]
Integer.
Read/write.
ColorConstant is an optional parameter that sets the background color of the input fields. Either the integer value or the color name can be given. See Section A.3, Background Color Constants.
See example in Example to set the background color of the input fields to cyan.
Sets or returns the foreground color of the input fields defined by the DefineInputs method.
object.InputForeColor[=ColorConstant As Constant]
Integer.
Read/write.
ColorConstant is an optional parameter that sets the foreground color of the input fields. Either the integer value or the color name can be given. See Section A.14, Foreground Color Constants.
See example in Example to set the foreground color of the input fields to white.
Sets or returns the Menu object.
object.Menu
Menu.
Read-Write.
See example in Example for creating a menu and adding menu items.
Sets or returns the title of the text window.
object.Title[=Value As String]
String.
Read/write.
On a set operation, the Value is an optional parameter that takes the title you want to define for the text window.
See example in Example to set the text window's title as "Unbelievably Great Window!".
Sets the wrapping status of the display strings or determines whether they are are wrapped.
object.TextWrap[=Value As Boolean]
String.
Read/write.
Value is an optional parameter that enables (TRUE) or disables (FALSE) wrapping.
See example inExample to disable the Textwrap property.
Sets or determines whether the current window is visible.
object.Visible[=Value As Boolean]
Boolean.
Read/write.
Value is an optional parameter that enables (TRUE) or disables (FALSE) the visibility of the text window.
See example in Example to set the Visible property to TRUE.
Clears the window or a section of the text window.
object.Clear(
[Row As Integer)
Optional. The number of the rows to clear.
Boolean. Returns TRUE if successful; otherwise, FALSE.
If Row is specified, this method clears a section of the window. Otherwise, it clears the entire window.
See example inExample to clear the text in the third row of the textwindow.
Clears pending input regions of the text window. This method will prevent the user from editing the input fields and will display the values set in the script for each field.
object.ClearInputs()
None.
Boolean. Returns TRUE if successful. otherwise, FALSE.
This method corresponds with the WIN:Get:Clear command in NetBasic 6.0.
See example in Example to disable the input region of the string value and display the string set in the script.
Closes the text window.
Object.Close()
None.
Boolean. Returns TRUE if successful. otherwise, FALSE.
The maximum values for the row and column coordinates are 24 and 79 respectively.
See example in Example to close the window.
Defines the coordinates of the default display window.
object.Define(
Row1 As Integer,
Column1 As Integer,
Row2 As Integer,
Column2 As Integer)
The left hand side coordinates of the first row.
The left hand side coordinate of the first column.
The right hand side coordinate of the last row.
The right hand side coordinate of the last column.
Long. Handle of the defined window.
See example in Example to set the coordinates for the default display window to 5, 20, 10, and 60.
Defines a region on the screen that will accept user input.
object.DefineInputs(
MemVar As Anytype
[,Width As Integer
[,Format As String
[,ToUpper As Boolean]]])
The initialized memory variable.
Optional. The maximum number of characters you want displayed.
Optional. Identifies which inputs are acceptable for each position within the edit region.
Optional. Set to TRUE if you want all characters to be in uppercase.
Boolean. Returns TRUE if successful; otherwise FALSE.
The user input is placed in the memory variable MemVar. The number of characters that will be displayed can be limited by specifying the Width. The Format parameter is used to specify the format of the input.
Notice that Width need not be supplied even if Format is supplied. Simply supply an extra comma to indicate Width is not being supplied.
This method corresponds with the WIN:Get and WIN:Get:Picture commands in NetBasic 6.0, where the Format parameter corresponds to the sFormat parameter of the WIN:Get:Picture command.
See example in Example to define input regions for the set string and integer parameters in the text window.
Displays all input regions without initiating user inputs.
object.DisplayInputs()
None.
Void.
This method corresponds with the WIN:Get:Display command in NetBasic 6.0.
This example displays the specified string value and makes that field non-editable.
’Displays the set string
’Read a string input
strInput = " Initialized String"
’Sets the heading of the window
WIN.Heading(True,"Title : ReadInput example")
WIN.Define(5,2,24,79)
WIN.Visible=TRUE
Set Cur = WIN.Cursor
’Read a string and display it in the message box
Cur.MoveTo(3,1)
WIN.TextOut ("Input String:")
Cur.MoveTo(3,20)
WIN.DefineInputs(strInput,20)
WIN.Displayinputs()
WIN.ClearInputs()
Msgbox (" String Input " &strInput)
Sets or returns the heading of the text window.
Object.Heading(
Arg1 As Boolean,
[Arg2 As string,
[Arg3 As String]])
Boolean. Displays the heading if set TRUE.
IMPORTANT:The functionality is not implemented for FALSE.
String. Sets the title of the window.
String. Sets the heading of the window.
Read/write.
See example in Example to set the heading of the text window as "Readinput sample".
Returns a character used for drawing boxes and lines.
object.LineDrawChar(
LineChar As Integer)
The value for the line character you want to draw.
String.
This property corresponds with the WIN:Linedraw:Char command in NetBasic 6.0. See Section A.16, Line Drawing Characters.
See example in Example for creating a double horizontal line.
Displays a popup message in a window on the screen.
object.PopUp(
message1 As String
[,messageN As String])
The first message you want displayed.
Optional. Succeeding messages you want displayed (for example, message2, message3) to a maximum of 20 messages.
Boolean. Returns TRUE if successful; otherwise, FALSE.
This method corresponds with the WIN:Popup command in NetBasic 6.0.
Displays a maximum of 20 messages. Each message appears on a separate line and can be up to 78 characters long. Waits until a key is pressed to display the next message. The first parameter message1 is required; all others are optional.
This example displays the pop-up message "With NSN".
Win.Define(5, 20, 10, 60)
Win.BackColor = WIN_BG_RED
Win.ForeColor = WIN_FG_YELLOW
Win.Title = "Unbelievably Great Window!"
Win.TextWrap = TRUE
Win.Visible = TRUE
Set cursor = Win.Cursor
cursor.MoveTo(2,10)
’Creates a double horizontal line at the set cursor position
for 10 times.
Win.textout(String(15,win.linedrawchar(1)))
cursor.MoveTo(3,10)
Win.TextOut("Enjoy Scripting ")
cursor.MoveTo(4,10)
Win.textout(String(15,win.linedrawchar(1)))
’displays a pop up window and displays the given string
Win.popup(" with NSN")
Wait 1000
Win.Close()
Initiates the user input for all the defined regions.
Object.ReadInputs(
[Param1 As Anytype
[Param2 As Anytype
[....
[Param20 As Anytype]]]...])
Param1, Param2 etc. represent the script variables. A maximum of 20 parameters can be defined in a single Readinputs statement.
AnyType. The values read for the different script variables are copied to the respective arguments.
This example initiates a string and an integer input and displays the final values in the set default inputs.
’Defines 2 different windows x and y
x=Win.Define(5, 20, 10, 60)
y=WIN.Define(5,2,24,79)
’Sets x as the default window and executes the script
Win.setdefault(x)
Win.BackColor = WIN_BG_RED
Win.ForeColor = WIN_FG_YELLOW
Win.InputBackColor = WIN_BG_CYAN
Win.InputForeColor = WIN_FG_WHITE
Win.TextWrap = TRUE
Win.Visible = TRUE
Set cursor = Win.Cursor
cursor.MoveTo(2,5)
Win.TextOut("Displays the default string value")
Wait 1000
Win.Visible = FALSE
’Sets y as the default window and executes the script
Win.setdefault(y)
’Read a string input
WIN.Heading(True,"Title : ReadInput sample ")
WIN.Visible=TRUE
Set Cur = WIN.Cursor
’ Read a string
Cur.MoveTo(3,1)
WIN.TextOut ("Input String:")
Cur.MoveTo(3,20)
WIN.DefineInputs(strInput,25)
WIN.Displayinputs()
WIN.ClearInputs()
Cur.MoveTo(5,10)
Win.Textout("Default String Input is " &strInput)
wait 2000
win.close()
’Sets x as the default window and executes the script
Win.setdefault(x)
Win.Visible = TRUE
Set cursor = Win.Cursor
cursor.MoveTo(2,10)
Win.Textout ("Have a nice day")
wait 1000
Win.close()
Scrolls the contents of a window up or down.
object.Scroll(
Lines As Integer)
The number of lines to scroll.
Boolean. Returns TRUE if successful; otherwise, FALSE.
This method corresponds with the WIN:Scroll command in NetBasic 6.0.
If the Lines parameter is positive, the contents will move up; otherwise, the contents will move down.
This example scrolls down the contents by a line .
Win.Define(5,3,20,60)
Win.BackColor = WIN_BG_Cyan
Win.Visible = True
Set cursor = Win.Cursor
cursor.MoveTo(2,10)
Win.TextOut("Make it a great day")
cursor.MoveTo(3,10)
Win.TextOut("for you and yours")
’Scrolls the contents down by a line.
Win.Scroll(-1)
Sub KeyRead
While True
keylast = Inkey
If (Keylast <> Chr(0)) Then
Exit Sub
End If
wend
End sub
Selects a window as the default window.
object.SetDefault(
[Handle As Long])
Optional. The handle to the defined window you want to select.
Boolean. Returns TRUE if successful; otherwise, FALSE.
Multiple windows can be defined in TextWindow. Use SetDefault to define a particular window as the default window. If no parameters are passed, the last defined window is considered the default window.
See example in Example
Displays text at the current cursor position.
object.TextOut(
message1 As String
[,messageN As String])
The first message you want displayed.
Optional. Succeeding messages you want displayed (for example, message2, message3) to a maximum of 20 messages.
Boolean. Returns TRUE if successful; otherwise, FALSE.
Displays a maximum of 20 messages. Each message appears on a separate line and can be up to 78 characters long. Waits until a key is pressed to display the next message. The first parameter message1 is required; all others are optional.
See example in Example.