QT Class console

 

Overview

The RAD console class is the principal tool for AIS Lisp to surface console functionality. The RAD Console class features a main console pane for showing writeln output, for editing Lisp commands, etc. The RAD Console main pane inherits from QTextEdit. The RAD Console class also contains Clear and Run buttons plus a command line with a drop down command list. The RAD Console command line inherits from QComboBox and QLineEdit. Opening and showing the console object causes the AIS Lisp .exe to move from the Background Processes list to the Apps list in the Windows Task Manager. The console is one of the key words accepted by the qt function. There can be only one console object.

Instantiating and showing the console object displaye a GUI background containing

The functions surfaced with the console object allow the AIS Lisp programmer to manage the various features and services available via the RAD console object.

 

Display Pane

The Display Pane appears in the center of the application main window GUI and shows all writeln displays as well as allowing the editing of Lisp commands.

 

Clear Button

The Clear Button appears above the top of the application main window GUI just below the Tab Bar. Pressing the Clear button erases all display contents in the console display pane.

 

Run Button

The Run Button appears above the top of the application main window GUI just below the Tab Bar and the the right of the Clear Button. Pressing the Run button evaluates the Lisp command contained in the Console Command Line.

 

Command Line

The Command Line appears above the top of the application main window GUI just below the Tab Bar and the the right of the Run Button. The Console Command Line supports entering Lisp commands and also contains a drop down list of helpful ocmmand hints.

 

Console Tab

Opening the console, displays the Console tab containing the Lisp console window. The Lisp console tab displays all Lisp (writeln ...) function output as well as logging all console output to the log file. The console main pane also allows the researcher to enter an to execute Lisp commands.

IDE Console Tab

addCommandItem

Overview

The console addCommandItem function adds a new text item to the console command drop down list. The console object must be showing for the command line drop down list to work properly. To display the current properties of the console, use the maximize function.

 

Syntax

(qt console: addCommandItem: myText)

Arguments

myTextThe text to be added to the command line drop down list.
ReturnsAlways returns true.

 

Example1

(qt console: setTitle: (append "My QT Console Demo."))
(qt console: addCommandItem: "(* 1 2)") ;; Add another Lisp command hint to the command line drop down list.
(qt console: addCommandItem: "(+ 1 2)") ;; Add another Lisp command hint to the command line drop down list.
(qt console: setCommandText: "(/ 1 2)") ;; Add a Lisp command to the command line itself.
(qt console: maximize:) ;; Display the console window.

find

Overview

The console find function locates and selects (highlights) the next occurance of the specified text in the console display pane. The find can be case sensitive, backwards or forewards, and search for whole words only depending on the specified switches. Once found the matching text is selected (highlighted) in the console display pane. The find function returns true if the specified text was found and selected.

 

Syntax

(setq result (qt console: find: text caseInSensitiveSW backWardsSW wholeWordSW))

Arguments

textThe text to be matched in the console display pane.
caseInSensitiveSWTrue if the find is to be case sensitive.
backWardsSWTrue if the find is to be backwards from the current cursor location.
wholeWordSWTrue if the find is to be for whole words only.
resultAlways returns the true if the find was successful.

 

Example1

(qt console: setTitle: (append "My QT find Demo.")) ;; Set the console title
(qt console: setDisplayText: "")) ;; Clear the console display pane.
(writeln "Now is the time for all good men") ;; Write to the console display pane.
(setq return (qt console: find: "time" false true false)) ;; Select and highlight the "time" text on the console pane.
(qt console: maximize:) ;; Display the console

getCommandCount

Overview

The console getCommandCount function returns the number of items currently in the console command drop down list.

 

Syntax

(setq count (qt console: getCommandCount:))

Arguments

countAlways returns the number of items in the console command drop down list.

 

Example1

(qt console: setTitle: (append "My QT Console Demo."))
(qt console: addCommandItem: "(* 1 2)") ;; Add another Lisp command hint to the command line drop down list.
(qt console: addCommandItem: "(+ 1 2)") ;; Add another Lisp command hint to the command line drop down list.
(qt console: setCommandText: "(/ 1 2)") ;; Add a Lisp command to the command line itself.
(qt console: maximize:) ;; Display the console window.
(setq n (qt console: getCommandCount:)) ;; Return count of items in the command line drop down list.
(writeln n ) ;; Displays 2 on the console display pane.

getCommandItem

Overview

The console getCommandItem function returns the specified item in the console command drop down menu. Items are added to the console command drop down menu with the addCommandItem function. Once populated, the console user can chose from the command drop down menu to find the proper command to execute.

 

Syntax

(setq myText (qt console: getCommandItem: index))

Arguments

indexThe index of the command drop down item to be returned (starts at 0).
myTextAlways returns the text of the specified console command drop down item.

 

Example1

(qt console: setTitle: (append "My QT Console Demo."))
(qt console: addCommandItem: "(* 1 2)") ;; Add another Lisp command hint to the command line drop down list.
(qt console: addCommandItem: "(+ 1 2)") ;; Add another Lisp command hint to the command line drop down list.
(qt console: setCommandText: "(/ 1 2)") ;; Add a Lisp command to the command line itself.
(qt console: maximize:) ;; Display the console window.
(setq myText (qt console: getCommandItem: 1)) ;; Return the text of command line drop down list item 1.
(writeln myText) ;; Displays "(+ 1 2)" on the console display pane.

getCommandText

Overview

The console getCommandText function returns the entire contents of the console command line.

 

Syntax

(setq myText (qt console: getCommandText:)))

Arguments

myTextAlways returns the entire contents of the console command line.

 

Example1

(qt console: setTitle: (append "My QT Console Demo."))
(qt console: addCommandItem: "(* 1 2)") ;; Add another Lisp command hint to the command line drop down list.
(qt console: addCommandItem: "(+ 1 2)") ;; Add another Lisp command hint to the command line drop down list.
(qt console: setCommandText: "(/ 1 2)") ;; Add a Lisp command to the command line itself.
(qt console: maximize:) ;; Display the console window.
(setq myText (qt console: getCommandText:)) ;; Return the text in the command line.
(writeln (eval myText)) ;; Displays "3" on the console display pane.

getConsoleLog

Overview

The console getConsoleLog function returns the entire contents of the console log and reset the console log to "".

 

Syntax

(setq myText (qt console: getConsoleLog:))

Arguments

myTextAlways returns the entire contents of the console log and reset to "".

 

Example1

(defun consoleMgr(code) vars:(s) (setq s (qt console: getConsoleLog:)) (qt console: setDisplayText: s) true) ;; Define a console display manager.
(qt console: setTitle: (append "My QT display manager Demo.")) ;; Set the console title
(qt console: setConsoleMgr: consoleMgr) ;; Set the console manager. (qt console: maximize:) ;; Display the console
(writeln "Hello there") ;; Invokes the consoleMgr which set the console pane to "Hello there".

getConsoleSize

Overview

The console getConsoleSize function returns the maximum size of the console display before truncation begins. The console size default is 50000 ascii characters.

 

Syntax

(setq size (qt console: getConsoleSize:))

Arguments

sizeAlways returns the maximum size of the console display before truncation begins.

 

Example1

        (writeln "The console can display "(qt console: getConsoleSize:) " characters before truncation begins.")
        

getDisplayHtml

Overview

The console getDisplayHtml function returns the entire contents of the console display pane as an HTML markup string.

 

Syntax

(setq myHtml (qt console: getDisplayHtml:))

Arguments

myHtmlAlways returns the entire contents of the console display pane as an HTML markup string.

 

Example1

(qt console: setTitle: (append "My QT HTML Demo.")) ;; Set the console title
(qt console: maximize:) ;; Display the console.
(qt console: setHtmlText: "Hello there") ;; Sets the console display pane with HTML content.
(setq myHtml (qt console: getDisplayHtml:)) ;; Returns the console display pane contents as an HTML string.
(qt console: setCommandText: myHtml) ;; Sets the console command line with the specified HTML string.

getDisplayText

Overview

The console getDisplayText function returns the entire contents of the console display pane as an ASCII string.

 

Syntax

(setq myText (qt console: getDisplayText:))

Arguments

myTextAlways returns the entire contents of the console display pane as an ADCII string.

 

Example1

(qt console: setTitle: (append "My QT HTML Demo.")) ;; Set the console title
(qt console: maximize:) ;; Display the console.
(qt console: setHtmlText: "Hello there") ;; Sets the console display pane with HTML content.
(setq myText (qt console: getDisplayText:)) ;; Returns the console display pane contents as an ASCII string.
(qt console: setCommandText: myText) ;; Sets the console command line with "Hello there".

getSelectedText

Overview

The console getSelectedText function returns the entire contents of currently selected text in the console display pane.

 

Syntax

(setq myText (qt console: getSelectedText:))

Arguments

myTextAlways returns the entire contents of currently selected text in the console display pane.

 

Example1

(qt console: setTitle: (append "My QT find Demo.")) ;; Set the console title
(qt console: setDisplayText: "")) ;; Clear the console display pane.
(qt console: maximize:) ;; Display the console
(writeln "Now is the time for all good men") ;; Write to the console display pane.
(setq result (qt console: find: "time" false true false)) ;; Select and highlight the "time" text on the console pane.
(setq result (qt console: getSelectedText:)) ;; Return the text selected by the find.
(writeln result) ;; Write "time" to the console display pane.

getSelectionEnd

Overview

The console getSelectionEnd function returns the end position of the currently selected text in the console display pane.

 

Syntax

(setq pos (qt console: getSelectionEnd:))

Arguments

posAlways returns the end position of the currently selected text in the console display pane.

 

Example1

(qt console: setTitle: (append "My QT find Demo.")) ;; Set the console title
(qt console: setDisplayText: "")) ;; Clear the console display pane.
(qt console: maximize:) ;; Display the console
(writeln "Now is the time for all good men") ;; Write to the console display pane.
(setq result (qt console: find: "time" false true false)) ;; Select and highlight the "time" text on the console pane.
(setq result (qt console: getSelectionEnd:)) ;; Return end position of the currently selected text in the console display pane.
(writeln result) ;; Write 15 to the console display pane.

getSelectionStart

Overview

The console getSelectionStart function returns the start position of the currently selected text in the console display pane.

 

Syntax

(setq pos (qt console: getSelectionStart:))

Arguments

posAlways returns the start position of the currently selected text in the console display pane.

 

Example1

(qt console: setTitle: (append "My QT find Demo.")) ;; Set the console title
(qt console: setDisplayText: "")) ;; Clear the console display pane.
(qt console: maximize:) ;; Display the console
(writeln "Now is the time for all good men") ;; Write to the console display pane.
(setq result (qt console: find: "time" false true false)) ;; Select and highlight the "time" text on the console pane.
(setq result (qt console: getSelectionStart:)) ;; Return start position of the currently selected text in the console display pane.
(writeln result) ;; Write 12 to the console display pane.

initTitle

Overview

The console initTitle function sets the title on the console tab. The initTitle must be the first command sent to the qt function. If no initTitle function is issued, the default console tab title will be "Console". Once the console is initialized, the title in the tab cannot be changed.

 

Syntax

(qt console: initTitle: title))

Arguments

titletitle to be set into the console tab on the main window.
ReturnsAlways returns void.

 

Example1

(qt console: initTitle: "Display Area") ;; Display the console
(writeln "Hello world") ;; Write on the console

maximize

Overview

The console maximize function displays the console in its full screen format.

 

Syntax

(qt console: maximize:))

(qt console: maximize: title))

Arguments

title(Optional) title to be set into the title bar of the main window.
ReturnsAlways returns void.

 

Example1

(qt console: maximize: (append "My Console Demo.")) ;; Display the console
(writeln "Hello world") ;; Write on the console

minimize

Overview

The console minimize function displays the console in its minimal format for the host operating system.

 

Syntax

(qt console: minimize:))

(qt console: minimize: title))

Arguments

title(Optional) title to be set into the title bar of the main window.
ReturnsAlways returns void.

 

Example1

(qt console: maximize: (append "My Console Demo.")) ;; Display the console
(writeln "Hello world") ;; Write on the console
(sleep 1000.0) ;; Wait
(qt console: minimize:)) ;; Minimize the console

paste

Overview

The console paste function pastes the text in the mainWindow clipboard into the console display pane.

 

Syntax

(qt console: paste:)

Arguments

resultAlways returns #void.

 

Example1

(qt console: maximize: (append "My Console Demo.")) ;; Display the console
(qt mainWindow setClipboardText: "Hello world") ;; Set "Hello world" into the main window clipboard
(qt console: paste:)) ;; Writes "Hello world" to the console

removeCommandItem

Overview

The console removeCommandItem function removes the specified text item from the console command drop down list.

 

Syntax

(qt console: removeCommandItem: index)

Arguments

indexThe index of the item to be removed from the console command drop down list.

 

Example1

(qt console: setTitle: (append "My QT Console Demo."))
(qt console: addCommandItem: "(* 1 2)") ;; Add another Lisp command hint to the command line drop down list.
(qt console: addCommandItem: "(+ 1 2)") ;; Add another Lisp command hint to the command line drop down list.
(qt console: setCommandText: "(/ 1 2)") ;; Add a Lisp command to the command line itself.
(qt console: maximize:) ;; Display the console window.
(qt console: removeCommandItem: 0) ;; Drop the "(* 1 2)" Lisp command from the command line drop down list.

setCommandItem

Overview

The console setCommandItem function sets the specified text item in the console command drop down menu. The console setCommandItem function sets the specified item in the console command drop down menu. The console setCommandItem function only works if the drop down menu already contains an item at the specified location. Items can only be added to the console command drop down menu with the addCommandItem function. Once populated, the console user can chose from the drop down menu to find the proper command to execute.

 

Syntax

(qt console: setCommandItem: index text)

Arguments

indexThe index of the item to be set in the console command drop down list.
textThe text of the item to be set in the console command drop down list.

 

Example1

(qt console: setTitle: (append "My QT Console Demo."))
(qt console: addCommandItem: "(* 1 2)") ;; Add another Lisp command hint to the command line drop down list.
(qt console: addCommandItem: "(+ 1 2)") ;; Add another Lisp command hint to the command line drop down list.
(qt console: setCommandText: "(/ 1 2)") ;; Add a Lisp command to the command line itself.
(qt console: maximize:) ;; Display the console window.
(qt console: setCommandItem: 0 "(- 1 2)") ;; Set the "(- 1 2)" Lisp command into the 0th command line drop down list.

setCommandText

Overview

The console setCommandText function sets the entire contents of the console command line.

 

Syntax

(qt console: setCommandText: myText)

Arguments

myTextThe text value to be set in the console command line.

 

Example1

(qt console: setTitle: (append "My QT Console Demo."))
(qt console: addCommandItem: "(* 1 2)") ;; Add another Lisp command hint to the command line drop down list.
(qt console: addCommandItem: "(+ 1 2)") ;; Add another Lisp command hint to the command line drop down list.
(qt console: setCommandText: "(/ 1 2)") ;; Add a Lisp command to the command line itself.
(qt console: maximize:) ;; Display the console window.

setConsoleSize

Overview

The console setConsoleSize function sets the maximum size of the console display before truncation begins. The console size default is 50000 ascii characters.

 

Syntax

(qt console: setConsoleSize: size)

Arguments

sizeThe maximum size of the console display before truncation begins.
ReturnAlways returns void.

 

Example1

        (qt console: setConsoleSize: 100000) 
        (qt console: setDisplayText: "Now the console will hold 100000 characters before tuncation.")
        

setDisplayHtml

Overview

The console setDisplayHtml function sets the entire contents of the console display pane to the specified HTML text.

 

Syntax

(qt console: setDisplayHtml: myText)

Arguments

myTextThe HTML text value to be set in the console display pane.

 

Example1

(qt console: setTitle: (append "My QT Console Demo."))
(qt console: maximize:) ;; Display the console window.
(qt console: setDisplayHtml: "Hello world") ;; Display HTML in the console display pane.

setDisplayText

Overview

The console setDisplayText function sets the entire contents of the console display pane to the specified ASCII text.

 

Syntax

(qt console: setDisplayText: myText)

Arguments

myTextThe ASCII text value to be set in the console display pane.

 

Example1

(qt console: setTitle: (append "My QT Console Demo."))
(qt console: maximize:) ;; Display the console window.
(qt console: setDisplayText: "Hello world") ;; Display ASCII in the console display pane.

setConsoleMgr

Overview

The console setConsoleMgr function sets the console manager name - where (defun mgrLambdaName(command) ...lisp code...)

 

Syntax

(qt console: setConsoleMgr: mgrLambdaName)

Arguments

mgrLambdaNameThe console manager name - where (defun mgrLambdaName(command) ...lisp code...).

 

Example1

(defun consoleMgr(code) vars:(s) (setq s (qt console: getConsoleLog:)) (qt console: setDisplayText: s) true) ;; Define a console display manager.
(qt console: setTitle: (append "My QT display manager Demo.")) ;; Set the console title
(qt console: setConsoleMgr: consoleMgr) ;; Set the console manager. (qt console: maximize:) ;; Display the console
(writeln "Hello there") ;; Invokes the consoleMgr which set the console pane to "Hello there".

setTabIndex

Overview

The console setTabIndex function sets the index of the RAD Main Tab index to which the console display system is assigned (sent by RadMainWindow, etc.).

 

Syntax

(qt console: setTabIndex: tabIndex)

Arguments

tabIndexThe RAD Main Tab index to which the console display system is to be assigned.

 

Example1

(defun editMgr(...) true) ;; Don't do anything special when the tab is clicked
(qt mainWindow: setTitle: (append "My QT Horizontal Tab Demo.")) ;; Set the main window title
(setq radTextEditPtr (qt new: RadTextEdit:)) ;; Create a QT TextEdit object (a GUI descentant of RadWidget).
(setq tabIndex (qt mainWindow: addTab: radTextEditPtr "Edit" editMgr)) ;; Add a new tab to the main window horizontal tab bar
(setq tabCount (qt mainWindow: count:)) ;; Return the count of tabs
(qt radTextEditPtr setText: (string tabCount)) ;; Display the main window
(qt console: setTabIndex: 1) ;; Display the console window in tab 1
(qt mainWindow: maximize:) ;; Display the main window

setSelectedText

Overview

The console setSelectedText function sets the currently selected text based on the command (all, line, word).

 

Syntax

(qt console: setSelectedText: command)

(qt console: setSelectedText: start end)

Arguments

commandThe the command (all, line, word) for selecting the text around the current cursor position.
startThe starting position for selecting the text in the console display pane.
endThe ending position for selecting the text in the console display pane.

 

Example1

(qt console: maximize:) ;; Display the main window
(writeln "Hello World") ;; Display on the console leaving the cursor at the end of "world".
(qt console: setSelectedText: word:) ;; The term "world" is highlighted on the console.

setTitle

Overview

The console setTitle function sets the contents of the main window title bar (but does not display the title bar). The AIS Lisp programmer has full control over the contents of the .exe title bar. To display the title bar and all other current properties of the console, use the maximize function.

 

Syntax

(qt console: setTitle: textData)

Arguments

textDataThe text data to appear in the title bar.
ReturnsAlways returns void.

 

Example1

(qt console: setTitle: (append "My Application with [" (inspect) "] bytes of free heap memory."))
(qt console: maximize:) ;; Display the console.